-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Code base doesn't comply with JUnit's own coding style #1350
Comments
If you can find a way to guarantee that new code will use the new formatting regardless of what editor they use (for instance, with Spotless) then I'd be fine doing a reformat. |
All I can do is: import Google's code style in Eclipse. Change 2 space indentantion to 4 spaces. And run the formatting over all affected files. |
A non-Eclipse solution could be to use google-java-format. There's also a googleformatter-maven-plugin. |
Thanks, @Stephan202 I'm going on vacation for a few days, but hopefully I can look into the Maven plugin next weekend. |
JUnit uses the Google style with the exception of different indentation. The google-java-format tool doesn't support overriding the indentation. If you want to enforce the style after reformatting, the tool of choice would be Checkstyle, via its Maven plugin. This supports using the Google style as a built-in custom configuration. Again, there's no way to override the indentation. You could use a modified copy of the configuration file, but that's under LGPL, so you immediately run into a license nightmare. Would you consider dropping the indentation exception? If so, automating everything becomes fairly easy. Although you would then change every file. |
Great effort, @tomwhoiscontrary ! 👍 |
I added a comment on PR #1379; seems four space indentation should be possible after all :). |
I'd like to suggest to reformat all code under
org.junit.*
once to meet the defined formatting guidelines.At the moment not all the files are formatted accordingly to that standard. This causes problems for contributors - especially in pull request. If you format the code you get a lot of extraneous diffs - just because of the reformatting - in addition to your actual changes.
I think it's not too late to do this formatting.
Regarding existing PRs that tried to preserve the outdated styling: They would get extraneous diffs then of course, but if they apply the new format as well everything would be fine again. In addition, I think many of PRs are dead anyway, since many of them haven't seen any updates for months or even years.
As a result, contributing to JUnit 4 and reviewing the changes by the core team should become easier in the future.
The text was updated successfully, but these errors were encountered: