Since Checkstyle 5.7
Rationale: Multiple property keys usually appear after merge or rebase of several branches. While there are no problems in runtime, there can be a confusion due to having different values for the duplicated properties.
name | description | type | default value | since |
---|---|---|---|---|
fileExtensions | Specify the file extensions of the files to process. | String[] | .properties |
5.7 |
To configure the check:
<module name="Checker"> <module name="UniqueProperties"/> </module>
Example: in foo.properties file
key.one=44 key.two=32 // OK key.one=54 // violation
To configure the check to scan custom file extensions:
<module name="Checker"> <module name="UniqueProperties"> <property name="fileExtensions" value="customProperties"/> </module> </module>
Example: in foo.customProperties file
key.one=44 key.two=32 // OK key.one=54 // violation
Example: in foo.properties file
key.one=44 key.two=32 // OK key.one=54 // OK, file is not checked
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