Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure generated Kotlin code follow Kotlin naming convention #62

Merged
merged 1 commit into from
May 30, 2022

Conversation

bmarty
Copy link
Collaborator

@bmarty bmarty commented May 12, 2022

Constructor parameters cannot start by an upper case letter.
This PR fixes that, hopefully without any side effect on the sent analytics, and on the other generated code.

@bmarty bmarty requested a review from a team as a code owner May 12, 2022 20:08
@bmarty bmarty requested review from novocaine and ouchadam May 12, 2022 20:08
/**
* Whether the user has the people space enabled
*/
val WebMetaSpacePeopleEnabled: Boolean? = null,
val webMetaSpacePeopleEnabled: Boolean? = null,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This are the problems reported by Detekt, a static analysis tool.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like an issue in the source file https://github.com/matrix-org/matrix-analytics-events/blob/main/schemas/UserProperties.json

I'm not sure if posthog will handle casing as unique properties~

Copy link
Collaborator Author

@bmarty bmarty May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I did not change the value we send to Posthog but just the "internal" Kotlin code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I’d agree with Adam that this should be fixed in the schema to maintain consistency.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, did not want to break the existing schema. @novocaine OK for you (as it will impact the Web code)?

Copy link
Member

@t3chguy t3chguy May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is we can't adjust the Typescript generator with tweaks to maintain existing data without a lot of work given it is external to this project https://www.npmjs.com/package/json2ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand why it's preventing this PR to be merged. This PR does not change the plan and do not change the typescript code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never said anything here is preventing this PR being merged.

I'm arguing with

in this instance I believe the schema itself is inconsistent and would lean towards it being changed to avoid future confusion

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, sorry 🤗 . CC @ouchadam ^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

properties should be camelCase, I think that's fairly clear from examples in the README and in the code.

Web has been used as an enum prefix elsewhere which is why it was an uppercase W there, but I don't see why it should be so here, where we are describing a property. It should start with web.

In terms of how disruptive this is to fix, I would be pretty surprised if posthog was case-sensitive..?

bmarty added a commit to element-hq/element-android that referenced this pull request May 12, 2022
@ouchadam
Copy link
Contributor

codewise the fix LGTM, there's still a pending question of if this change is needed and sets a precedent for allowing future inconsistent property naming

perhaps we can merge this and create a separate issue to provide a github action to linter to enforce consistency in the json schemas

@bmarty bmarty merged commit 97e6437 into main May 30, 2022
@bmarty bmarty deleted the bma/fix_kotlin branch May 30, 2022 16:33
piersonleo pushed a commit to piersonleo/element-android that referenced this pull request Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants