Since Checkstyle 5.0
Rationale: It is considered good practice to only define one outer type per file.
name | description | type | default value | since |
---|---|---|---|---|
max | Specify the maximum number of outer types allowed. | int | 1 |
5.0 |
To configure the check to accept 1 outer type per file:
<module name="Checker"> <module name="TreeWalker"> <module name="OuterTypeNumber"/> </module> </module>
To configure the check to accept 2 outer types per file:
<module name="Checker"> <module name="TreeWalker"> <module name="OuterTypeNumber"> <property name="max" value="2"/> </module> </module> </module>
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.sizes