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
Update for existing Check: WhitespaceAround #22
Comments
"... may be closed immediately ...." = no rule, it is up to a user. "unless it is part of a multi-block statement" --> this is must rule . So you have a rule to implement - NonEmptyBlocks that will check that blocks of IF-ELSE or IF-ELSE_IF-ELSE and TRY-CATCH or TRY-CATCH-FINALLY or TRY-FINALLY could not be empty. |
I understand you position. So, does this WhitespaceAround Check cover Google requirements? I investigated input tokens and I think that yes, this Check covers all Google requirements. |
http://checkstyle.sourceforge.net/config_blocks.html#EmptyBlock |
We have to update this Check to cover Horizontal whitespace. Now this Check doesn't cover Annotations:
|
Implemented for empty classes, interfaces and for/while cycles. But I could not reproduce cases for annotations and arrays:
|
What about enums?
Change to mAllowEmptyLoops
What about do-while?
Change to:
This logic should be encapsulated in the emptyTypeCheck method. The definition of this method should be as follows: |
Also update xdocs |
Don't understand |
The rest is done. |
Sometimes you use "cycles", somethimes - "loops". Fix it
Should be "Checks if empty methods, ctors or loops are allowed."
Should be "Checks if empty classes, interfaces or enums are allowed."
I meant this case: do {} while (...);
Something wrong with your logic. I'm not sure that you'll get the right parent for every input ast, moreover won't you get NPE in case you don't have a second parent? |
I think, that such implementation will be more stable: commit
I understand this. I could't understand how do-while loop can use in this case. Let's have a call The rest is done |
Change to "this check can be configured to allow empty methods, types,"
Change to "To configure the check to allow empty type blocks use"
Change to "To configure the check to allow empty loop blocks use"
Change to "Sets whether or not empty type bodies are allowed"
Change to "Sets whether or not empty loop bodies are allowed."
Change to "currentType"
Change to "typeNode"
Change to "type"
Each test has to be small and has to have only one responsibility. Devide this test onto: testEmptyTypeBlock and testEmptyLoopBlock |
Please rollback your changes in pom.xml. They shouldn't be present in the pull request |
methods that are return boolean have to start with "is" "are" - to be a question like in English emptyTypeCheck ====> isEmptyType do not follow bad practice that already exists in this Check (emptyCtorBlockCheck). |
isEmptyCtroBlock ??? What is Ctro ? |
Done. |
for, while, do-while loops constructor bodies. |
the rest look good, please provide PR and make a put in PR to your "testproject" where you covered by test whole "4.6.2 Horizontal whitespace" |
Merged |
Need to update existing Check to allow empty classes or interfaces.
Need to ignore missing whitespaces in annotations:
Need to allow empty for cycle:
The text was updated successfully, but these errors were encountered: