-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Issue #14654: fix catch parameter wrong indentation #16627
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
Conversation
Github, generate report for Indentation/all-examples-in-one |
Report for Indentation/all-examples-in-one: |
do not forget to add code to ITs of google style, to let formatter do formatting on code and checkstyle run on same file.
be aware of files that are excluded due to conflict of formatter and checkstyle: checkstyle/.ci/google-java-format.sh Line 45 in d73922d
if you put a lot of samples to ITs of google it will be good prove that formatter and checkstyle validate same code and not conflicting with each other |
Github, generate report |
1 similar comment
Github, generate report |
@mohitsatr , is it still wip ? |
yes, I was busy researching for proposal. i will get to back to it as soon as Im done with that |
8ead1b4
to
81073fc
Compare
Github, generate report |
nevermind, I'm checking the diffs |
there are conflicts created by the google-formatter.
even though I have specified wrong indentation in violation message, it thinks code's formatted wrong.
|
src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java
Show resolved
Hide resolved
google formatter is more strict and opinionated. in regular test area Inputs we can have any crazy indentations and see how Check place violation on it. in IT for google style, we apply auto-formatter first, and must not produce any violation on what formatter did with code. |
81073fc
to
193d44d
Compare
formatter is still red, please fix. |
262b27f
to
501aa8d
Compare
I suppose pitest one is not related to my changes? |
Yes it is not related to your PR. |
501aa8d
to
7d8f4ef
Compare
from semaphore:
if this is are not false positives, please send PR to pgjdbc to fix them to make CI green fully (after they merge). execution from: Lines 635 to 646 in c784535
target code looks ok: https://github.com/pgjdbc/pgjdbc/blob/1e0c88d8bb292417f499d9a4821af67fc5740966/pgjdbc/src/main/java/org/postgresql/util/PasswordUtil.java#L60-L76 it looks like false positive, but it is actually good vioaltions, as it is line wrap on statement inside try not a try itself. please sen PR to pgjdbc |
Just a small nitpick: parameters is not spelled correctly in the commit message |
done pgjdbc/pgjdbc#3611 |
Ok, reports are same, let's extend Inputs and be prepared for merge |
7d8f4ef
to
0198e5f
Compare
@mohitsatr , CI is red, please address. |
00f269a
to
aeb481c
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.
Items
.../checkstyle/test/chapter4formatting/rule4841indentation/InputMultilineStatementsCorrect.java
Outdated
Show resolved
Hide resolved
.../checkstyle/test/chapter4formatting/rule4841indentation/InputMultilineStatementsCorrect.java
Outdated
Show resolved
Hide resolved
aeb481c
to
701b911
Compare
I don't understand why javac11 is failing even though javac17 has passed successfully. |
jdk version matters a lot, this syntax is for jdk17
|
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.
item:
...awl/tools/checkstyle/checks/indentation/indentation/InputIndentationMultilineStatements.java
Outdated
Show resolved
Hide resolved
701b911
to
d39ee66
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.
thanks a lot !!!
@Aziz-755, can you review this PR ?
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.
Great work!
Just minors
src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java
Show resolved
Hide resolved
...awl/tools/checkstyle/checks/indentation/indentation/InputIndentationMultilineStatements.java
Show resolved
Hide resolved
...ools/checkstyle/checks/indentation/indentation/InputIndentationCatchParametersOnNewLine.java
Show resolved
Hide resolved
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.
Items
...awl/tools/checkstyle/checks/indentation/indentation/InputIndentationMultilineStatements.java
Show resolved
Hide resolved
d39ee66
to
f98ed1d
Compare
Github, generate report |
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.
last items:
try { //indent:4 exp:4 | ||
System.out.println("try"); //indent:6 exp:6 | ||
} catch ( //indent:4 exp:4 | ||
@SuppressWarnings("PMD.AvoidCatchingGenericException") //indent:12 exp:8 warn |
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.
please fix vertical alignment of trailing comment
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.
done all.
just curious, can we somehow automate alignment of comments? it's quite tedious doing manually 🥲
try { //indent:4 exp:4 | ||
System.out.println("try0"); //indent:6 exp:6 | ||
} catch (NullPointerException //indent:4 exp:4 | ||
| IllegalArgumentException t) { //indent:0 exp:8 warn |
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.
please fix vertical alignment of trailing comment
@@ -0,0 +1,82 @@ | |||
//non-compiled with javac: Compilable with Java17 //indent:0 exp:0 | |||
package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 |
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.
please fix vertical alignment of trailing comment
try { //indent:4 exp:4 | ||
System.out.println("try1"); //indent:6 exp:6 | ||
} catch ( //indent:4 exp:4 | ||
@SuppressWarnings("PMD.AvoidCatchingGenericException") //indent:4 exp:8 warn |
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.
please fix vertical alignment of trailing comment
System.out.println("try"); //indent:6 exp:6 | ||
} catch ( //indent:4 exp:4 | ||
@SuppressWarnings("PMD.AvoidCatchingGenericException") //indent:8 exp:8 | ||
Exception e) { //indent:4 exp:8 warn |
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.
please fix vertical alignment of trailing comment
@Aziz-755 , please finalize review. |
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.
last last:
1; | ||
} | ||
|
||
int testIfConditionMultiline(int newState, int tableName) { //indent:2 exp:2 |
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.
please remove trailing comment
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.
diff report is good.
thanks a lot for your hard work!!!
Looks good ! |
f98ed1d
to
048fc8f
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.
Thanks a lot!!!!
just curious, can we somehow automate alignment of comments? it's quite tedious doing manually 🥲
Please create issue on this, it should be trivial, we parsing this comment, so we definitely know it's position, but there might be exceptions.
fixes #14654
Diff Regression config: https://gist.githubusercontent.com/mohitsatr/d55485b980e5c7ae9c883ba8f79dcbd6/raw/c824102d90368dbd060f41a1f6bda249cdcf0a5b/master_google_style.xml
Diff Regression projects: https://gist.githubusercontent.com/mohitsatr/68b0817ac52ff7773d35585ee12fc1cc/raw/f9c7774ca78df1f48f34bf30799bd3952abd9e2a/list-of-projects.properties