To date any style and coding standards have been de-facto rather than defined. This page is to gather ideas/opinions to improve this, perhaps leading to some maintained configuration for the two main IDEs in use (IntelliJ and JetBrains).
Current set up
Import Orders
Andi and I figured out how to configure Eclipse and IntelliJ so that they are consistent with import orders:
- https://github.com/apache/isis/blob/master/antora/components/conguide/modules/eclipse/attachments/Apache-Isis.importorder - Eclipse
- https://github.com/apache/isis/blob/master/antora/components/conguide/modules/intellij/attachments/Apache-Isis-importorder.xml - IntelliJ
Other Coding Standards
For Eclipse there are also some additional coding standards that I used to use from when I was an Eclipse user (I switched about 6 years ago) ... but I haven't created equivalent settings for IntelliJ.
Contributors Guide
We currently have a Contributors' Guide (https://apache-isis-committers.github.io/isis-nightly/conguide/about.html) though this doesn't - yet - define any standards. My plan is that it ought to reference the Eclipse and IntelliJ standards once we have them (it could reference the import orders, because these do exist .... just haven't got around to updating it).
Sonar Cloud
Andi configured our CI to run through SonarCloud, dashboard at https://sonarcloud.io/dashboard?id=apache_isis. I haven't looked into the quality profile that it's using, I imagine it's probably just the out-of-the-box settings. Note that SonarCloud warnings/errors do NOT break our CI.
Miscellanea
What sort of stuff do we like/dislike? Use this section to gather any pet preferences or hates... We can then figure out which we agree on, and how to enforce (ideally via IDE configuration + SonarCloud config).
- all parameters are final (Dan)
- in a interface (intellij default warnings incl. global fixes)
- method signatures without public and or abstract
- inner classes without public and static
- no multiple empty lines?
- last line empty?
- WIP: rules about character cases
- https://google.github.io/styleguide/javaguide.html#s5.1-identifier-names has good rules incl. examples
Other Topics
- most important is: do only use formatting rules which our IDE can apply during reformatting (some corner cases are really hard for IDE formatter).
- how to keep formatting aligned between different IDEs? For example one way could be to use the eclipse formatter although in intellij or maven.
- Intellij support sharing of settings hosted by public http for example github.
- the google coding style is implement in many formatters (like intellij, eclipse and maven), they even have an commandline tool to apply their rules to a bigger code base (https://github.com/google/google-java-format) => easiest way, but contains some strong opinions about e.g. tab vs spaces (space), indent deep (2 space), max line length (100 char) => But I (Alf) think that the rules are very well thought out. For example if you limit the line length, then you can not use tabs (because the space length depends on settings) ; column width 100 make it easy to have 3 way diff in a screen.