Checks for Size Violations |
![]() |
FileLengthDescriptionChecks for long source files. Rationale: If a source file becomes very long it is hard to understand. Therefore long classes should usually be refactored into several individual classes that focus on a specific task. Properties
ExamplesTo configure the check to accept files with up to 1500 lines: <module name="FileLength"> <property name="max" value="1500"/> </module> Packagecom.puppycrawl.tools.checkstyle.checks Parent ModuleLineLengthDescriptionChecks for long lines. Rationale: Long lines are hard to read in printouts or if developers have limited screen space for the source code, e.g. if the IDE displays additional information like project tree, class hierarchy, etc. Properties
ExamplesTo configure the check to accept lines up to 120 characters long: <module name="LineLength"> <property name="max" value="120"/> </module> To configure the check to ignore lines that begin with " * ", followed by just one word, such as within a Javadoc comment: <module name="LineLength"> <property name="ignorePattern" value="^ *\* *[^ ]+$"/> </module> Notes
Packagecom.puppycrawl.tools.checkstyle.checks Parent ModuleMethodLengthDescriptionChecks for long methods and constructors. Rationale: If a method becomes very long it is hard to understand. Therefore long methods should usually be refactored into several individual methods that focus on a specific task. Properties
ExamplesTo configure the check: <module name="MethodLength"/> To configure the check so that it accepts methods with at most 60 lines: <module name="MethodLength"> <property name="tokens" value="METHOD_DEF"/> <property name="max" value="60"/> </module> Packagecom.puppycrawl.tools.checkstyle.checks Parent ModuleParameterNumberDescriptionChecks the number of parameters of a method or constructor. Properties
ExamplesTo configure the check: <module name="ParameterNumber"/> To configure the check to allow 10 parameters for a method: <module name="ParameterNumber"> <property name="max" value="10"/> <property name="tokens" value="METHOD_DEF"/> </module> Packagecom.puppycrawl.tools.checkstyle.checks Parent Module |
Copyright © 2002-2003 Oliver Burn. All rights Reserved.