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

Use official Kotlin code style conventions #17704

Closed
4 tasks
thomashorta opened this issue Dec 27, 2022 · 1 comment · Fixed by #17705
Closed
4 tasks

Use official Kotlin code style conventions #17704

thomashorta opened this issue Dec 27, 2022 · 1 comment · Fixed by #17705

Comments

@thomashorta
Copy link
Contributor

thomashorta commented Dec 27, 2022

There were some internal discussions regarding code style and current configurations in this repository (paqN3M-OJ-p2) and there was an overall feeling that we should focus on using the official Kotlin code style as close as possible and maybe stop committing IDE-specific code style configs to Git, as files such as .idea/codeStyles/Project.xml.

That file frequently has its content updated because of IDE changes but is rarely updated. Besides that, having that file in the repo also makes us use outdated conventions. Another option, if we decide to keep the codeStyles files would be to make sure we maintain those code styles configs up-to-date.

The initial plan is to get this repo closer to what WooCommerce has in terms of code-styling, which allows us to always use Android Studio official updated conventions, and avoid conflicts in IDE config files.

Tasks:

  • Update .editorconfig to keep some required settings (if needed)
  • Remove Kotlin code-style settings from .idea/codeStyles/Project.xml or set it to the official defaults (KOTLIN_OFFICIAL code style defaults option in Project.xml)
  • Reformat ALL Kotlin files in the project according to the up-to-date official code style in IDE
  • Update coding-style.md with some instructions for manual IDE configurations (if needed)

Ideally, we would also completely remove the Project.xml file and migrate some configs to .editorconfig for other languages (XML and Java) BUT I was playing with that for a bit and that will introduce quite some different formatting (or just inflate the .editorconfig file with IntelliJ specific rules) so it's something to be discussed a bit more.

@thomashorta thomashorta added this to the 21.5 milestone Dec 27, 2022
@thomashorta thomashorta self-assigned this Dec 27, 2022
@thomashorta
Copy link
Contributor Author

I updated the issue description to focus on Kotlin and not the removal of codeStyle folder, as that would also affect Java and XML code style configurations and this was not discussed with the internal team yet.

It doesn't seem like Java and XML configs in Android Studio have a clear default like the KOTLIN_OFFICIAL option for Kotlin so it is a bit trickier to completely ignore the Project.xml configs as different people might have that configured completely differently.

@thomashorta thomashorta changed the title Use official Kotlin code style and remove IDE code-style settings Use official Kotlin code style conventions Dec 28, 2022
@thomashorta thomashorta modified the milestones: 21.5, 21.6 Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant