-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add OneStatementPerLineCheck to Checkstyle rules #33682
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
|
Pinging @elastic/es-core-infra |
|
For context: I opened this as a follow up to #33676 after I (or better my Eclipse IDE) stumbled into some offending double semicolons in import statements. Those would be complained about as well with this additional checkstyle rule. |
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.
I also opened a separate PR to separate this change: #33678
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.
Actually it wasn't reformatting, just my Auto-Save trailing whitespace removal.
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.
I also opened a separate PR for this change: #33681
2cdcb73 to
d3dd075
Compare
|
This job triggered CI during a migration of the master. Kicking off an additional build for you manually... Jenkins, test this please. |
This change adds the OneStatementPerLineCheck to our checkstyle precommit checks. This rule restricts the number of statements per line to one. The resoning behind this is that it is very difficult to read multiple statements on one line. People seem to mostly use it in short lambdas and switch statements in our code base, but just going through the changes already uncovered some actual problems in randomization in test code, so I think its worth it.
d3dd075 to
e74219d
Compare
nik9000
left a 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.
I kind of like the switch statements the old way but if we can't convince checkstyle that that is ok then I think this is a net win.
| import static org.elasticsearch.index.mapper.TypeParsers.parseTextField; | ||
|
|
||
| /** A {@link FieldMapper} for full-text fields with annotation markup e.g. | ||
| * |
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.
Could you extract the formatting changes to this file into another commit so I don't have to review them? I'd be happy with you just pushing it so long as all it does is remove trailing spaces.
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.
Sure, I didn't realize this did a reformatting. Will clean this up.
I can understand that for short lines, but I must say I think readability still suffers. Plus this rule fund the two leftovers in test I mentioned, I think its worth it. |
This change adds the OneStatementPerLineCheck to our checkstyle precommit checks. This rule restricts the number of statements per line to one. The resoning behind this is that it is very difficult to read multiple statements on one line. People seem to mostly use it in short lambdas and switch statements in our code base, but just going through the changes already uncovered some actual problems in randomization in test code, so I think its worth it.
This change adds the OneStatementPerLineCheck to our checkstyle precommit checks. This rule restricts the number of statements per line to one. The resoning behind this is that it is very difficult to read multiple statements on one line. People seem to mostly use it in short lambdas and switch statements in our code base, but just going through the changes already uncovered some actual problems in randomization in test code, so I think its worth it.
This change adds the OneStatementPerLineCheck to our checkstyle precommit
checks. This rule restricts the number of statements per line to one. The
resoning behind this is that it is very difficult to read multiple statements on
one line. People seem to mostly use more than one statement per line in short
lambdas and switch statements in our code base, but just going through the
necessary changes this rule enforces already uncovered some actual problems
in randomization in test code, so I think its worth it.