RegexpOnFilename: Add a new rule to detect if there are any sync conflict files

Fails if there there are any Syncthing or Dropbox sync conflicts on any *.java file.
This commit is contained in:
Paul Campbell 2017-03-11 16:55:34 +00:00
parent 5287aaadeb
commit f9ee73f148
8 changed files with 67 additions and 5 deletions

View file

@ -219,6 +219,7 @@ Rule|Level|Source|Enabled|Suppressable
[Regexp](#regexp)|unspecified|checkstyle||
[RegexpHeader](#regexpheader)|unspecified|checkstyle||
[RegexpMultiline](#regexpmultiline)|unspecified|checkstyle||
[RegexpOnFilename](#regexponfilename)|layout|checkstyle|Yes|
[RegexpOnFilename](#regexponfilename)|unspecified|checkstyle||
[RegexpSingleline](#regexpsingleline)|unspecified|checkstyle||
[RegexpSinglelineJava](#regexpsinglelinejava)|unspecified|checkstyle||
@ -274,6 +275,22 @@ The following is a list of each of the checks and the expectations each has on y
Rules are listed in alphabetical order.
#### [RegexpOnFilename](http://checkstyle.sourceforge.net/config_regexp.html#RegexpOnFilename)
Checks for the existence of forbidden java file names.
File names are forbidden if they match the pattern `(.sync-conflict-| conflicted copy )`.
N.B. only `*.java` files are checked.
This check is intended to detect Syncthing and Dropbox conflict files.
e.g.
````
DataClass (Bob's conflicted copy 2017-03-11).java
DataClass.sync-conflict-20170311-1648.java
````
#### [AbbreviationAsWordInName](http://checkstyle.sourceforge.net/config_naming.html#AbbreviationAsWordInName)
Enforces proper `CamelCase` and avoids sequences of consecutive uppercase characters in identifiers. Does not apply to @Overridden methods.

View file

@ -12,6 +12,16 @@ template:
readme-template: builder/src/main/resources/README-template.md
readme-fragments: builder/src/main/resources/rules
rules:
-
name: RegexpOnFilename
parent: CHECKER
level: LAYOUT
enabled: true
source: CHECKSTYLE
uri: http://checkstyle.sourceforge.net/config_regexp.html#RegexpOnFilename
properties:
fileNamePattern: "(.sync-conflict-| conflicted copy )"
match: true
-
name: AbbreviationAsWordInName
parent: TREEWALKER

View file

@ -0,0 +1,15 @@
Checks for the existence of forbidden java file names.
File names are forbidden if they match the pattern `(.sync-conflict-| conflicted copy )`.
N.B. only `*.java` files are checked.
This check is intended to detect Syncthing and Dropbox conflict files.
e.g.
````
DataClass (Bob's conflicted copy 2017-03-11).java
DataClass.sync-conflict-20170311-1648.java
````

View file

@ -4,6 +4,10 @@
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="RegexpOnFilename">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
</module>
<module name="FileTabCharacter"/>
<module name="Header">
<property name="fileExtensions" value="java"/>

View file

@ -4,6 +4,10 @@
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="RegexpOnFilename">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
</module>
<module name="FileTabCharacter"/>
<module name="Header">
<property name="fileExtensions" value="java"/>

View file

@ -4,6 +4,10 @@
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="RegexpOnFilename">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
</module>
<module name="FileTabCharacter"/>
<module name="Header">
<property name="fileExtensions" value="java"/>

View file

@ -4,6 +4,10 @@
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="RegexpOnFilename">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
</module>
<module name="FileTabCharacter"/>
<module name="Header">
<property name="fileExtensions" value="java"/>

View file

@ -4,6 +4,10 @@
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="RegexpOnFilename">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
</module>
<module name="FileLength"/>
<module name="FileTabCharacter"/>
<module name="Header">