Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Java coding style
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<!--<property name="fileExtensions" value="java, xml, properties"/>-->
<module name="SuppressionFilter">
<property name="file" value="${checkstyle.config.path}/suppressions.xml"/>
</module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="NewlineAtEndOfFile">
<property name="fileExtensions" value="java, xml, properties"/>
</module>
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="UniqueProperties">
<property name="fileExtensions" value="properties"/>
</module>
<module name="TreeWalker">
<!-- Annotation checks -->
<!-- http://checkstyle.sourceforge.net/config_annotation.html -->
<!--<module name="AnnotationLocation" />--> <!-- TODO: decide -->
<!-- Blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyCatchBlock">
<property name="commentFormat" value="\\S+"/>
</module>
<module name="LeftCurly">
<property name="option" value="nl"/>
<property name="tokens" value="INTERFACE_DEF, CLASS_DEF, ANNOTATION_DEF, ENUM_DEF, CTOR_DEF, METHOD_DEF"/>
</module>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<!-- Class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<module name="FinalClass"/>
<module name="InnerTypeLast"/>
<module name="InterfaceIsType"/>
<module name="MutableException"/>
<module name="OneTopLevelClass"/>
<module name="VisibilityModifier">
<property name="id" value="VisibilityModifierCode"/>
</module>
<!-- Common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="DeclarationOrder"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<!--<module name="IllegalCatch"/>--> <!-- TODO: transaction management?? -->
<module name="IllegalThrows"/>
<module name="IllegalInstantiation">
<property name="classes" value="java.lang.Boolean"/>
</module>
<module name="IllegalType">
<property name="memberModifiers" value="LITERAL_PUBLIC, LITERAL_PROTECTED, LITERAL_STATIC"/>
</module>
<module name="MagicNumber">
<property name="id" value="MagicNumberCode"/>
<property name="ignoreAnnotation" value="true"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="MissingSwitchDefault"/>
<module name="DefaultComesLast"/>
<!--<module name="ModifiedControlVariable"> TODO: decide -->
<!--<property name="skipEnhancedForLoopVariable" value="true"/>-->
<!--</module>-->
<!--<module name="MultipleStringLiterals">-->
<!--<property name="ignoreStringsRegexp" value='^(("")|(", ")|(\()|(\))|(\|))$'/>-->
<!--</module>-->
<module name="MultipleVariableDeclarations"/>
<!--<module name="OneStatementPerLine"/>--> <!-- doesn't allow multiple resources in try-with-resources statement -->
<module name="PackageDeclaration"/>
<module name="ParameterAssignment"/>
<module name="ReturnCount">
<property name="max" value="0"/>
<property name="tokens" value="CTOR_DEF"/>
</module>
<module name="ReturnCount">
<property name="max" value="1"/>
<property name="tokens" value="LAMBDA"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="UnnecessaryParentheses"/>
<!-- Imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport">
<property name="excludes" value="java.io,java.net,java.util,javax.persistence"/>
<property name="allowClassImports" value="false"/>
<property name="allowStaticMemberImports" value="true"/>
</module>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!--<module name="ImportControl"/>--> <!-- TODO: check if can be used to enforce not importing of exception names -->
<!-- Metrics -->
<!-- http://checkstyle.sourceforge.net/config_metrics.html -->
<module name="CyclomaticComplexity">
<property name="max" value="15"/>
<property name="switchBlockAsSingleDecisionPoint" value="true"/>
</module>
<module name="NPathComplexity">
<property name="max" value="1024"/>
</module>
<!-- Miscellaneous -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="CommentsIndentation"/>
<!--<module name="FinalParameters"/>--> <!-- TODO: decide -->
<module name="OuterTypeFilename"/>
<module name="TodoComment">
<property name="severity" value="info"/>
<property name="format" value="(TODO)|(FIXME)"/>
</module>
<module name="UpperEll"/>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifier.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Naming Conventions -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName">
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|log)$"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Size Violations -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="LineLength">
<property name="max" value="240"/>
</module>
<module name="MethodLength">
<property name="tokens" value="CTOR_DEF"/>
<property name="max" value="30"/>
</module>
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF"/>
<property name="max" value="150"/>
<property name="countEmpty" value="false"/>
</module>
<module name="OuterTypeNumber"/>
<module name="ParameterNumber">
<property name="ignoreOverriddenMethods" value="true"/>
<property name="tokens" value="METHOD_DEF"/>
<property name="max" value="7"/>
</module>
<!-- Whitespace -->
<!-- http://checkstyle.sourceforge.net/config_whitespace.html -->
<module name="EmptyLineSeparator">
<property name="tokens" value="PACKAGE_DEF, IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF"/>
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
</module>
<module name="GenericWhitespace"/>
<module name="NoLineWrap"/> <!-- default: PACKAGE_DEF, IMPORT. -->
<module name="NoWhitespaceBefore"/>
<module name="SingleSpaceSeparator">
<property name="validateComments" value="true"/>
</module>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/> <!-- TODO: decide -->
<module name="ParenPad">
<!-- Whitespace forbiden around '(' and ')' -->
<property name="option" value="nospace"/>
</module>
</module>
</module>
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files=".*[\\/]src[\\/]test[\\/]java[\\/].*" id="VisibilityModifierCode"/>
<suppress files=".*[\\/]src[\\/]test[\\/]java[\\/].*" id="MagicNumberCode"/>
<suppress files=".*[\\/]src[\\/]main[\\/]java[\\/].*Request" id="VisibilityModifierCode"/>
<suppress files=".*[\\/]src[\\/]main[\\/]java[\\/].*ResponseFactory" id="VisibilityModifierCode"/>
</suppressions>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.