Provide .editorconfig for easier contribution
bullshit opened this issue · comments
Working on #127 i had many auto formatting issues (indent style, indent size, new line eof).
It would be awesome if the contributors could add a EditorConfig file so others can easier contribute to this starter project.
Regards
Hi @bullshit , it should be fairly easy with the current setup, just run mvn clean install
as usual before you commit the code, that will automatically format it.
Just as an example mvn formatter:format
and a git diff shows "26 files changed, 919 insertions(+), 1015 deletions(-)"
The formatter also just formats java classes and not for example *.xml.
BTW I'm using Intellij on linux
Would be also better to use this plugin what is much more mature, and handles XML files also:
https://github.com/diffplug/spotless
Looks like a good replacement to validate formatting in CI.
A .editorconfig for indent style, size, .... so the IDE can automatic detect it would be great.
Otherwise i have to figure out which style every project uses. (And i work on quite a few)
VSCode, Eclipse and IntelliJ have a plugin to support editorconfig and it's widely used.
This could be a good start
root = true
[*]
indent_style = spaces
indent_size = 2
charset = utf-8
max_line_length = 140
trim_trailing_whitespace = true
insert_final_newline = true
[{*.markdown,*.md}]
trim_trailing_whitespace = false
But if you add spotless i guess i can live with that and add a commit hook to run the formatter.
It seems to me that the formatter plugin doesn't use the configuration from this project.
I head to execute the formatter like the CI with the -DconfigFile
parameter.
./mvnw -V -ntp -e formatter:format -Dconfigfile=$PWD/contributing/eclipse-google-style.xml --file pom.xml
can be will take a look soon, end migrate it to spotless plugin.
I'm not against the editor config, I just think that having the formatting independent from IDEs make more sense. This does not mean we cannot add editor config, just it is loosing it purpose to some extent.
If spotless also supports other file types than the editorconfig isn't that important. Thanks for your time.
Added a PR that migrates to spotless plugin, but is seems that code was ok according to styles. Added pom.xml formatting too.
Will close this issue, in case we can experiment with other parts too.