# Checks for usage |

## OneMethodPrivateField #### Description Checks that a private field is used in more than one method, constructor, or initializer. Rationale: a private field used in only one method, constructor, or initializer should be replaced by a local variable. #### Properties
name | description | type | default value
--- | --- | --- | ---
ignoreFormat | pattern for field names that should be ignored | regular expression | ^$ (empty)
#### Examples To configure the check:
    <module name="usage.OneMethodPrivateField"/>
To configure the check to ignore fields whose name ends in Temp:
    <module name="usage.OneMethodPrivateField">
        <property name="ignoreFormat" value="Temp$"/>
    </module>
#### Package com.puppycrawl.tools.checkstyle.checks.usage #### Parent Module TreeWalker ## UnusedLocalVariable #### Description Checks that a local variable is used after its declaration. #### Properties
name | description | type | default value
--- | --- | --- | ---
ignoreFormat | pattern for variable names that should be ignored | regular expression | ^$ (empty)
#### Examples To configure the check:
    <module name="usage.UnusedLocalVariable"/>
To configure the check to ignore variables whose name ends in Temp:
    <module name="usage.UnusedLocalVariable">
        <property name="ignoreFormat" value="Temp$"/>
    </module>
#### Package com.puppycrawl.tools.checkstyle.checks.usage #### Parent Module TreeWalker ## UnusedParameter #### Description Checks that a parameter is used. #### Properties
name | description | type | default value
--- | --- | --- | ---
ignoreFormat | pattern for parameter names that should be ignored | regular expression | ^$ (empty)
ignoreCatch | controls whether catch parameters should be ignored | boolean | true
ignoreNonLocal | controls whether parameters of non local (public, protected or package) methods should be ignored | boolean | false
#### Examples To configure the check:
    <module name="usage.UnusedParameter"/>
To configure the check to ignore parameters whose name ends in Temp:
    <module name="usage.UnusedParameter">
        <property name="ignoreFormat" value="Temp$"/>
    </module>
To configure the check to report unused catch parameters:
    <module name="usage.UnusedParameter">
        <property name="ignoreCatch" value="false"/>
    </module>
#### Package com.puppycrawl.tools.checkstyle.checks.usage #### Parent Module TreeWalker ## UnusedPrivateField #### Description Checks that a private field is used. #### Properties
name | description | type | default value
--- | --- | --- | ---
ignoreFormat | pattern for field names that should be ignored | regular expression | ^$ (empty)
#### Examples To configure the check:
    <module name="usage.UnusedPrivateField"/>
To configure the check to ignore fields whose name ends in Temp:
    <module name="usage.UnusedPrivateField">
        <property name="ignoreFormat" value="Temp$"/>
    </module>
#### Package com.puppycrawl.tools.checkstyle.checks.usage #### Parent Module TreeWalker ## UnusedPrivateMethod #### Description Checks that a private method is used. #### Properties
name | description | type | default value
--- | --- | --- | ---
ignoreFormat | pattern for method names that should be ignored | regular expression | ^$ (empty)
#### Examples To configure the check:
    <module name="usage.UnusedPrivateMethod"/>
To configure the check to ignore methods whose name ends in Temp:
    <module name="usage.UnusedPrivateMethod">
        <property name="ignoreFormat" value="Temp$"/>
    </module>
#### Notes The classpath may need to be configured to locate parameter type information. The classpath configuration is dependent on the mechanism used to invoke Checkstyle. #### Package com.puppycrawl.tools.checkstyle.checks.usage #### Parent Module TreeWalker

Back to the Checkstyle Home Page

Copyright © 2002-2003 Oliver Burn. All rights Reserved.