Skip to content

Commit

Permalink
chore: add checkstyle configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
miurahr committed Mar 23, 2024
1 parent dd3aa7b commit e9dd3b7
Showing 1 changed file with 264 additions and 0 deletions.
264 changes: 264 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/index.html
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
Finally, it is worth reading the documentation.
-->

<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/5.x/config.html#Checker
<property name="basedir" value="${basedir}"/>
-->

<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<property name="severity" value="error"/>

<module name="SuppressionFilter">
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/checks/sizes/index.html -->
<module name="FileLength"/>

<!-- See docs_devel/docs/30.CodingStyles.md -->
<module name="LineLength">
<property name="severity" value="warning"/>
<property name="max" value="120"/>
<property name="ignorePattern" value="^ *\* *[^ ]+$"/>
</module>

<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
</module>

<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>

<!-- Checks that property files contain the same keys. -->
<!-- https://checkstyle.org/checks/misc/translation.html#Translation -->
<module name="Translation">
<property name="baseName" value="^Bundle.*"/>
</module>

<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/checks/whitespace/index.html -->
<module name="FileTabCharacter">
<property name="severity" value="error"/>
</module>

<!-- Whitespace in a single line comment end -->
<!-- See https://checkstyle.org/checks/regexp/regexpsingleline.html#RegexpSingleline -->
<module name="RegexpSingleline">
<property name="format" value="(?&lt;!\\)(?:\\{2}).*\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<module name="TreeWalker">

<!-- Support default CHECKSTYLE:ON/OFF comments -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE:OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE:ON"/>
</module>
<!-- Support CHECKSTYLE.ON/OFF: <RULE> comments -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>

<!-- Suppression on generated codes -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="GEN-FIRST:.*"/>
<property name="onCommentFormat" value="GEN-LAST:.*"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="^.*//GEN-BEGIN:.*"/>
<property name="onCommentFormat" value="^.*//GEN-END:.*"/>
</module>

<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod">
<property name="severity" value="ignore"/>
</module>
<module name="JavadocType">
<property name="severity" value="ignore"/>
</module>
<module name="JavadocVariable">
<property name="severity" value="ignore"/>
</module>
<module name="JavadocStyle">
<property name="severity" value="ignore"/>
</module>

<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName">
<property name="severity" value="warning"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName">
<property name="severity" value="warning"/>
</module>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName">
<property name="severity" value="warning"/>
</module>

<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->

<module name="MethodLength"/>
<module name="ParameterNumber"/>

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT"/>
<property name="tokens" value="DEC"/>
<property name="tokens" value="DOT"/>
<property name="tokens" value="INC"/>
<property name="tokens" value="LNOT"/>
<property name="tokens" value="UNARY_MINUS"/>
<property name="tokens" value="UNARY_PLUS"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="tokens" value="INDEX_OP"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap">
<property name="severity" value="warning"/>
</module>
<module name="ParenPad"/>
<module name="TypecastParenPad">
<property name="severity" value="error"/>
</module>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="severity" value="error"/>
</module>

<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder">
<property name="severity" value="error"/>
</module>
<module name="RedundantModifier">
<property name="severity" value="error"/>
</module>

<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks">
<property name="severity" value="warning"/>
</module>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>

<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="AvoidInlineConditionals">
<property name="severity" value="ignore"/>
</module>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="severity" value="warning"/>
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="setterCanReturnItsClass" value="true"/>
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingSwitchDefault">
<property name="severity" value="warning"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<module name="DesignForExtension"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="severity" value="ignore"/>
</module>

<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="FinalParameters">
<property name="severity" value="ignore"/>
</module>
<module name="TodoComment">
<property name="severity" value="warning"/>
</module>
<module name="UpperEll"/>

</module>

</module>

0 comments on commit e9dd3b7

Please sign in to comment.