-
Notifications
You must be signed in to change notification settings - Fork 445
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
ACCUMULO-3771 Configure automatic java code style formatting #35
Conversation
Accumulo-Pull-Requests #69 FAILURE |
Looks like this reintroduces all of the lone-spaces in Javadoc that we've previously worked to remove... |
The plugin is configured to use the existing |
IIRC, there was an issue with Eclipse itself not adhering to the checkstyle. Not knocking what you've done -- my hunch was that it might be the maven plugin itself not doing what it's told to do. |
There are two main problems with the Eclipse formatter:
We've already accounted for the line length in the checkstyle rules by making it much larger than the Eclipse formatter. With this patch, I think we could probably just ignore trailing whitespace (and drop the corresponding checkstyle enforcement), since the formatter will remove the ones we mainly care about anyway (the javadoc ones are annoying, but there's not a lot of good options so long as Eclipse fails to fix that issue). We could just strip whitespace with One thing I'd like to see, though (for the purposes of a review) is just the pom changes, separate from any resulting formatting changes (I'm sure I can do this with some command-line Git Fu, though, so it's no big deal). I did see that the formatting significantly changed some lines that looked deliberately formatted to make it more readable. For those lines, we may wish to add the I'm also curious what happens with the I'm overall +1 to the idea, but it might need some tweaking. I especially like the idea that we could focus our style choices on readability, because writing to conform to a particular style doesn't matter any more (write in whatever style you like and the build will fix it). |
The PR has two commits. Commit 4b69fba has just pom changes. Is that what you are looking for?
Would you happen to know if this if fixed in later versions of Eclipse? This formatter plugin currently relies on Eclipse 3.8.1 code to do the formatting. |
Yes, that commit is exactly what I was looking for. :) |
I found Eclipse bug 49619, but I can't tell what was done from reading the issue comments. We may have to resort to executing a sed command after the format step :) |
That Eclipse bug also doesn't fix the same issue in regular block comments (only javadocs). |
* Added maven-java-formatter-plugin to POM files
Accumulo-Pull-Requests #70 FAILURE |
* Built Accumulo which ran maven-java-formatter-plugin for first time
I just pushed an updated PR with following changes:
I reviewed all of the files that were changed after running the formatter. While they look good to me, feel free to comment on any formatting that should remain and I can add |
Thats nice, instead of completely removing the check |
Accumulo-Pull-Requests #71 SUCCESS |
@@ -950,7 +976,7 @@ | |||
<module name="TreeWalker"> | |||
<module name="OneTopLevelClass" /> | |||
<module name="RegexpSinglelineJava"> | |||
<property name="format" value="\s+$" /> | |||
<property name="format" value="[^*]\s+$" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be more specific: ^(?!\s+([/][*])?[*])\s+$
* Ensure line endings are consistent * Eliminate whitespace in non-javadoc block comments * Insert @Formatter:off/on tags to prevent some reformatting * Make eclipse ignore the plugin
I issued a PR against Mike's branch which addresses the remaining trailing whitespace issues and helps make this work a little nicer. My only remaining concern after that is merged is that if this is not also applied to 1.6 and 1.7 branches, things will merge cleanly into master which are not properly formatted. So, we might want to apply these changes to 1.6 and 1.7? |
ACCUMULO-3771 Improvements to autoformatting
I tried to create a build-tools module. However, I ran into a problem where java-formatter-plugin tries to run on parent pom but fails as the build-tools jar has not been created. The parent pom needs to be configured so that build plugins (formatter, checkstyle, find-bugs, etc) are not run in the parent and only run in child modules after the build-tools jar is built. I will create a separate JIRA issue for this. |
Accumulo-Pull-Requests #72 FAILURE |
Pull request for ACCUMULO-3771
To make code review easier, you should add
&w=0
to your URL to remove any white space differences. This should bring down the files changed to only 88 files.