shipkit icon indicating copy to clipboard operation
shipkit copied to clipboard

Add java code style to project

Open StefMa opened this issue 8 years ago • 2 comments

While working on #468 I found out that my IDE (IntelliJ) wants to Reformat Code and Rerange Code all the time. I have a different code style in my IDE and a shortcut with CMD+S (macOS) which automatically runs

  • Optimize Imports
  • Reformat Code
  • Rerange Code

... anyway.

With IntelIJ it is possible to say that we want to use the code style from the project. The project needs to have the code style living in .idea/codeStyleSettings.xml.

If we have something like that all contributors have the same code style and we don't have merge conflicts (or review unrelated stuff) because the code got reformated or something similar...

There are - of course - the down side, that all "have to use IntelliJ". Don't know if something similar is possible with eclipse (are there other IDE's out there? 😄). But if so - we can maintain both files with the exact same code style...

What do you think about it?

StefMa avatar Oct 03 '17 06:10 StefMa

I'm OK with that, although if we want to require people to use it, we have to support also at least Eclipse, not only Intellij. If there is even one person that would like to contribute but uses Eclipse and we would lose this contribution because of that, then it's not worth it :) And it seems that programmers tend to be quite devoted to their tools.

wwilk avatar Oct 05 '17 21:10 wwilk

What about having gradle handle the formatting using spotless?

This would allow you to ignore what your IDE does during development, and run gradle spotlessApply before committing.

LunNova avatar Oct 05 '17 22:10 LunNova