-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Automate code formatting using Maven (2019 rules) #2495
Automate code formatting using Maven (2019 rules) #2495
Conversation
Still Eclipse based, should accept the same config file format. Docs: https://code.revelc.net/formatter-maven-plugin/ Source: https://github.com/revelc/formatter-maven-plugin
Up from the 2014 version. Source: https://github.com/apache/hbase/blob/master/dev-support/hbase_eclipse_formatter.xml
f06c914
to
dfda2f1
Compare
dfda2f1
to
0f869c2
Compare
The formatter considered by hash that my files were already formatted since #2494 and ignored them after I upgraded the formatting rules, had to make some attempts to get around that. Should be good now. |
Formatter caching problem reported here: revelc/formatter-maven-plugin#453 |
Closing. If somebody wants to revive this, any Java conflicts could probably be fixed by:
|
@sazzad16, just out of curiosity, what kind of discussion do you think would be needed? Are the instructions in |
It's mostly "when" would we want to merge the change as it's likely to invalidate all the existing PRs.
Yes. (We should improve it. But current one doesn't seem wrong.) |
The instructions say:
Which will change tons of code, invalidating all other PRs. So |
@walles Thanks. Striking it for the time being. |
Same as #2494 but with HBase rules from 2019 (the other PR uses the existing 2014 ruleset).
Before this change
CONTRIBUTING.md
encouraged reformatting sources usingmake format
.make format
would reformat lots of files, not just the ones you changed.With this change in place
Any
mvn
operation will implicitly format sources.CI will validate code formatting.
This implicitly means that people have to at least
mvn compile
their sources locally before making PRs to make sure they don't get refused by CI.This enforces good practice, regardless of the actual formatting.
Notes
Files to be reviewed (the rest have been auto formatted):
pom.xml
Makefile
.github/CONTRIBUTING.md
Also, checking the commits list might be easier than looking at files changed, all reformatting is confined to the last change.
The code formatting Maven plugin being used didn't have any
validate
goal so I replaced with another one.Still running the Eclipse formatter though, so
hbase-formatter.xml
still works.hbase-formatter.xml
has been updated to a newer one from 2019.