Follow-up of #19757
Background
Find a way to fail build on cases of //violation .... usage in between of method javadoc java annotations and method signatures
We should keep target code as natural as possible to not let violation comment to do side effect to violation and let users recognize problems as in real code and comment around just hint on what is wrong.
bad
/**
* This Javadoc contains unclosed tag.
* <code>unclosed 'code' tag<code>
*/
// violation 2 lines above 'Unclosed HTML tag found: <code>'
void foo() {}
good:
// violation 3 lines below 'Unclosed HTML tag found: <code>'
/**
* This Javadoc contains unclosed tag.
* <code>unclosed 'code' tag<code>
*/
void foo() {}
bad
@Override
// violation above 'xxx'
void foo() {}
good:
// violation below 'xxx'
@Override
void foo() {}
Task
Ensure no violation comments in between of methods signature and annoation or javadoc all existing input files.
Here is a list of existing input files to be fixed:
|
<!-- until https://github.com/checkstyle/checkstyle/issues/19803 --> |
|
<suppress id="violationBetweenAnnotationAndMethod" |
|
files="[\\/]checks[\\/]annotation[\\/]annotationlocation[\\/]InputAnnotationLocationAnnotation\.java"/> |
|
<suppress id="violationBetweenAnnotationAndMethod" |
|
files="[\\/]checks[\\/]annotation[\\/]annotationlocation[\\/]InputAnnotationLocationClass\.java"/> |
How to contribute
- Choose a Check (group of Inputs for same Check) from the list;
- Move all violation out of target code snippets;
- Remove related suppressions;
- Update violation line numbers inside unit test methods, if any changed.
- Send PR.
Notes
- Moving violating comments around requires adding
(X lines) above/below to make sure they still reference the same line. You can refer to guide to specify violations for syntax.
- Make sure no input files exceed the limit of 120 lines.
Example of expected update https://github.com/checkstyle/checkstyle/pull/19804/changes , #19811
Follow-up of #19757
Background
Find a way to fail build on cases of
//violation ....usage in between of method javadoc java annotations and method signaturesWe should keep target code as natural as possible to not let violation comment to do side effect to violation and let users recognize problems as in real code and comment around just hint on what is wrong.
bad
good:
bad
good:
Task
Ensure no violation comments in between of methods signature and annoation or javadoc all existing input files.
Here is a list of existing input files to be fixed:
checkstyle/config/checkstyle-input-suppressions.xml
Lines 143 to 147 in 876d99c
How to contribute
Notes
(X lines) above/belowto make sure they still reference the same line. You can refer to guide to specify violations for syntax.Example of expected update https://github.com/checkstyle/checkstyle/pull/19804/changes , #19811