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
CodeStyle formatting to conform to basic Checkstyle rules. #360
Conversation
@jianxu FYI since this might cause merging/syncing with internal repo. |
@jianxu : Other than multi-line lambda expressions and very deep-nested generics based expressions, the indentations should work automatically if you use the style/intellij-java-google-style.xml (in this PR) as code-style (for intellij) and do Reformat-Code. For IntelliJ Ultimate 2017.3, the way to setupis Preferences -> Editor -> Code Style -> Java -> Import Schema (under Settings icon) -> IntelliJ IDEA Code Style XML |
@bvaradar Thanks for the info, maybe also update https://github.com/uber/hudi/blob/master/docs/dev_setup.md ? |
Thanks @jianxu. I have updated the doc. |
@bvaradar it LGTM. Can you hold off on merging this till I merge the 1 large PR I have. I would like to avoid dealing with conflicts if possible, thanks |
<AND> | ||
<NAME>.*:id</NAME> | ||
<XML_ATTRIBUTE /> | ||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
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.
Is this supposed to be there by default ?
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.
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.
Just confirming, you have brought checkstyle formatting and the intellij formatting in sync, correct?
As long as one sets up IDE with the checked in style, it should all be fine?
@vinothchandar : Both specifications are aligned to the extent they are not contradicting each other. But there are some exceptions.
|
3feb3c6
to
a1ae125
Compare
@vinothchandar No objections from my end. @bvaradar BTW, does this take care of unused imports too ? |
The code-style rules follow google style with some changes: 1. Increase line length from 100 to 120 2. Disable JavaDoc related checkstyles as this needs more manual work. Both source and test code are checked for code-style
@n3nash : Thanks. Added both Unused and Redundant Imports in checkstyle and corresponding code-style. If there are any other rules missing, we can add them in future PRs. |
@vinothchandar @bvaradar sounds good to me. Let's also make sure all pending PRs are rebased after this change is merged. cc @kaushikd49 @ovj please try to rebase your changes on top of this PR and also setup your IDEs correspondingly. |
This diff contains formatting changes to adhere to basic checkstyle rules (conforming to google-format).
I am adding the checkstyle and corresponding eclipse/IntelliJ code-styles under "style/" folder so that all of us can use the same ide code-styles. I have made few changes to google-format checkstyle:
I have added 2 files to checkstyle suppressions list (style/checkstyle-suppressions.xml). One of them was because of checkstyle bug. Please keep in mind that checkstyle is somewhat of a super-set compared to code-styles when it comes to enforcing rules.
With the maven settings, now "mvn compile" will fail if there are any checkstyle violations.
Major theme in the below diff as suggested by checkstyle: