Since Checkstyle 6.0
| name | description | type | default value | since |
|---|---|---|---|---|
| offset | Specify how many spaces to use for new indentation level. | int | 4 |
6.0 |
| violateExecutionOnNonTightHtml | Control when to print violations if the Javadoc being examined by this check violates the tight html rules defined at Tight-HTML Rules. | boolean | false |
8.3 |
To configure the default check:
<module name="Checker">
<module name="TreeWalker">
<module name="JavadocTagContinuationIndentation"/>
</module>
</module>
Example:
/**
* <p> 'p' tag is unclosed
* <p> 'p' tag is closed</p>
*/
class Example1 {
/**
* @tag comment
* Indentation spacing is 4
*/
public void testMethod1(String input) {
// OK, Default expected Indentation is 4
}
/**
* @tag comment
* Indentation spacing is 2
*/
public void testMethod2(String input) {
// violation 3 lines above 'Line continuation have incorrect indentation level'
}
}
To configure the check with two spaces indentation:
<module name="Checker">
<module name="TreeWalker">
<module name="JavadocTagContinuationIndentation">
<property name="offset" value="2"/>
</module>
</module>
</module>
Example:
/**
* <p> 'p' tag is unclosed
* <p> 'p' tag is closed</p>
*/
class Example2 {
/**
* @tag comment
* Indentation spacing is 4
*/
public void testMethod1(String input) {
// OK, Indentation above 1 is fine as offset value is 2
}
/**
* @tag comment
* Indentation spacing is 2
*/
public void testMethod2(String input) {
// OK, Indentation above 1 is fine as offset value is 2
}
}
To configure the check to show violations for Tight-HTML Rules:
<module name="Checker">
<module name="TreeWalker">
<module name="JavadocTagContinuationIndentation">
<property name="violateExecutionOnNonTightHtml" value="true"/>
</module>
</module>
</module>
Example:
/**
* <p> 'p' tag is unclosed
* <p> 'p' tag is closed</p>
*/
class Example3 {
// violation 4 lines above 'Unclosed HTML tag found: p'
/**
* @tag comment
* Indentation spacing is 4
*/
public void testMethod1(String input) {
// OK, Default expected Indentation is 4
}
/**
* @tag comment
* Indentation spacing is 1
*/
public void testMethod2(String input) {
// violation 3 lines above 'Line continuation have incorrect indentation level'
}
}
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
com.puppycrawl.tools.checkstyle.checks.javadoc