Skip to content

Instantly share code, notes, and snippets.

@infynyxx
Last active August 29, 2015 14:22
Show Gist options
  • Save infynyxx/3c808f7255fe233d2910 to your computer and use it in GitHub Desktop.
Save infynyxx/3c808f7255fe233d2910 to your computer and use it in GitHub Desktop.
checkstyle.xml
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="FileTabCharacter"/>
<module name="NewlineAtEndOfFile" />
<!-- IDE-generated comment -->
<module name="RegexpSingleline">
<property name="format" value="File \| Settings \| File Templates"/>
<property name="message" value="IDE-generated comment"/>
</module>
<!-- Trailing whitespace -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="trailing whitespace"/>
</module>
<!-- Prohibit consecutive empty lines (except the lines after package/import) -->
<module name="RegexpMultiline">
<property name="format" value="\n *(?!package )(?!import )[^\n]+\n{3,}"/>
<property name="message" value="two or more consecutive empty lines"/>
</module>
<!-- Prohibit an empty after { or before } -->
<module name="RegexpMultiline">
<property name="format" value="\n\n\s+\}[^\n]{0,10}\n"/>
<property name="message" value="an empty line before '}'"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="\n\s+[^\n]{1,8}\{\n\n"/>
<property name="message" value="an empty line after a short line that ends with '{'"/>
</module>
<module name="TreeWalker">
<module name="LineLength">
<property name="max" value="120"/>
</module>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND, DEC, INC"/>
</module>
<module name="MissingOverride"/>
<module name="PackageAnnotation"/>
<module name="EmptyBlock">
<property name="option" value="text"/>
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="NeedBraces"/>
<module name="AvoidNestedBlocks">
<property name="allowInSwitchCase" value="true"/>
</module>
<!--<module name="FinalClass"/> -->
<module name="HideUtilityClassConstructor"/>
<module name="CovariantEquals"/>
<module name="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="NoFinalizer"/>
<module name="SuperFinalize"/>
<module name="PackageDeclaration"/>
<module name="ExplicitInitialization"/>
<module name="DefaultComesLast"/>
<module name="UnnecessaryParentheses"/>
<module name="AvoidStarImport">
<property name="allowStaticMemberImports" value="true"/>
</module>
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false"/>
</module>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
<module name="OuterTypeFilename"/>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="GenericWhitespace"/>
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="ParameterName">
<property name="format" value="^(?!arg[0-9])[_a-z][_a-zA-Z0-9]*$" />
</module>
</module>
</module>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.15</version>
<executions>
<execution>
<id>check-style</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
<configuration>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
<configLocation>./checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment