-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
java: implement checkstyle #4599
Conversation
Signed-off-by: Ze'ev Klapow <[email protected]>
Signed-off-by: Ze'ev Klapow <[email protected]>
Signed-off-by: Ze'ev Klapow <[email protected]>
Signed-off-by: Ze'ev Klapow <[email protected]>
Signed-off-by: Ze'ev Klapow <[email protected]>
Signed-off-by: Ze'ev Klapow <[email protected]>
92106b1
to
a016a72
Compare
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.
LGTM
It will be good to enable git pre commit checkstyle java linter plugin. Can you also add this as part of this PR? |
Signed-off-by: Ze'ev Klapow <[email protected]>
Signed-off-by: Ze'ev Klapow <[email protected]>
👍 definitely, just added a pre commit hook that looks for modified files in the java client and runs |
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.
Looks Good.
Thanks for adding git hook.
Can you resolve the conflicts? |
Signed-off-by: Ze'ev Klapow <[email protected]>
a89aae4
to
7b51e94
Compare
just resolved the conflicts, should be good to go now. |
Signed-off-by: Ze'ev Klapow <[email protected]>
1c2979f
to
b4bf807
Compare
@zklapow there is now an error from the pre-commit hooks:
This is coming from the checkstyle hook (confirmed by removing it in my local workspace before trying to commit). Can you please look into and fix this? |
I'm unable to repro @deepthi, can you give me the
|
@deepthi the above info would be very useful. I also can't repro this behavior, but would be happy to do some more digging if I had a better idea of what your setup is like. |
I was doing a `git commit -a -m "some commit message"` from vitess.io/vitess
in the planetscale fork.
There is a .git directory in there, and this directory is not a symlink to
anywhere else.
Once I do `set -ex`, I get more output:
+ cd java
+ modules=()
++ git diff --relative --name-only --cached '*.java'
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>
+ '[' 0 -eq 0 ']'
+ exit
…On Wed, Feb 20, 2019 at 11:59 AM zklapow ***@***.***> wrote:
@deepthi <https://github.com/deepthi> the above info would be very
useful. I also can't repro this behavior, but would be happy to do some
more digging if I had a better idea of what your setup is like.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4599 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXs16IR7fSzVo7_gQWYHc9Ea_R_cAs2ks5vPak4gaJpZM4anie0>
.
|
@deepthi can you try applying this patch to the git hook and see if that fixes things? I think my cd'ing might be overly naive and this should help:
If that works for you I can PR that in. Sorry for the inconvenience! |
I had to try it slightly differently:
|
Apologies for the enormous diff.
This PR adds checkstyle linting to the java codebase based on google's checkstyle rules (googles defaults were chosen because A) they are included with checkstyle B) they are widely used and thus have good IDE support and C) this was originally a youtube project)
The pom has been updated to fail the build on checkstyle violations, and all of the existing code has been updated to conform to checkstyle so that it will build.
This PR contains a huge number of whitespace changes (because these files were inconsistently using tabs/spaces) as well as a number of other minor refactorings (renaming single letter variables, moving oddly placed variable declarations) but no logic has been changed.
This should make working on and contributing to this project much easier.