|
| 1 | +<?xml version="1.0" ?> |
| 2 | +<!-- |
| 3 | + ~ Copyright 2017 Patrick Favre-Bulle |
| 4 | + ~ |
| 5 | + ~ Licensed to the Apache Software Foundation (ASF) under one |
| 6 | + ~ or more contributor license agreements. See the NOTICE file |
| 7 | + ~ distributed with this work for additional information |
| 8 | + ~ regarding copyright ownership. The ASF licenses this file |
| 9 | + ~ to you under the Apache License, Version 2.0 (the |
| 10 | + ~ "License"); you may not use this file except in compliance |
| 11 | + ~ with the License. You may obtain a copy of the License at |
| 12 | + ~ |
| 13 | + ~ http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | + ~ |
| 15 | + ~ Unless required by applicable law or agreed to in writing, |
| 16 | + ~ software distributed under the License is distributed on an |
| 17 | + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 18 | + ~ KIND, either express or implied. See the License for the |
| 19 | + ~ specific language governing permissions and limitations |
| 20 | + ~ under the License. |
| 21 | + --> |
| 22 | + |
| 23 | +<!DOCTYPE module PUBLIC |
| 24 | + "-//Puppy Crawl//DTD Check Configuration 1.2//EN" |
| 25 | + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> |
| 26 | + |
| 27 | +<module name="Checker"> |
| 28 | + <module name="NewlineAtEndOfFile"/> <!-- force newline, important for git merge and POSIX compatibility: http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile --> |
| 29 | + <module name="FileTabCharacter"/> <!-- e.g. disallow tab character outside of strings --> |
| 30 | + <module name="UniqueProperties"><!-- must not have duplicate properties in .properties files: http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties --> |
| 31 | + <property name="fileExtensions" value="properties"/> |
| 32 | + </module> |
| 33 | + |
| 34 | + <module name="FileLength"><!-- max line length for single file: http://checkstyle.sourceforge.net/config_sizes.html#FileLength --> |
| 35 | + <property name="max" value="1500"/> |
| 36 | + </module> |
| 37 | + |
| 38 | + <module name="TreeWalker"> |
| 39 | + <module name="SuppressionCommentFilter"/> <!-- use //CHECKSTYLE:OFF (...) //CHECKSTYLE:ON to disable checkstyle: http://checkstyle.sourceforge.net/config_filters.html#SuppressionCommentFilter --> |
| 40 | + |
| 41 | + <!-- Annotations --> |
| 42 | + <module name="MissingDeprecated"> <!-- if @deprecated and javadoc is there, must be explained in javadoc: http://checkstyle.sourceforge.net/config_annotation.html#MissingDeprecated --> |
| 43 | + <property name="skipNoJavadoc" value="true"/> |
| 44 | + </module> |
| 45 | + <module name="MissingOverride"/> <!-- if has @inheritDoc in javadoc must have @Override http://checkstyle.sourceforge.net/config_annotation.html#MissingOverride --> |
| 46 | + <module name="PackageAnnotation"/> <!-- must only be in package-info: http://checkstyle.sourceforge.net/config_annotation.html#PackageAnnotation --> |
| 47 | + |
| 48 | + <!-- Blocks --> |
| 49 | + <module name="AvoidNestedBlocks"/> <!-- fails for useless {...} blocks: http://checkstyle.sourceforge.net/config_blocks.html#AvoidNestedBlocks --> |
| 50 | + <module name="EmptyCatchBlock"> <!-- empty catch blocks exception var name must be 'ignored' or must not be empty: http://checkstyle.sourceforge.net/config_blocks.html#EmptyCatchBlock --> |
| 51 | + <property name="exceptionVariableName" value="expected|ignore"/> |
| 52 | + </module> |
| 53 | + |
| 54 | + <!-- Misc --> |
| 55 | + <module name="ArrayTypeStyle"/> <!-- e.g. int[] array is ok int array[] not: http://checkstyle.sourceforge.net/config_misc.html#ArrayTypeStyle --> |
| 56 | + <module |
| 57 | + name="MutableException"/> <!-- e.g. int[] array is ok int array[] not: http://checkstyle.sourceforge.net/config_misc.html#ArrayTypeStyle --> |
| 58 | + <module name="UpperEll"/> <!-- long values must be postfixed with 'L' not 'l': http://checkstyle.sourceforge.net/config_misc.html#UpperEll --> |
| 59 | + <module name="Indentation"> <!-- Checks correct indentation of Java code: http://checkstyle.sourceforge.net/config_misc.html#Indentation --> |
| 60 | + <property name="basicOffset" value="4"/> |
| 61 | + <property name="arrayInitIndent" value="8"/> |
| 62 | + <property name="braceAdjustment" value="0"/> |
| 63 | + <property name="caseIndent" value="4"/> |
| 64 | + <property name="throwsIndent" value="4"/> |
| 65 | + <property name="lineWrappingIndentation" value="4"/> |
| 66 | + <property name="forceStrictCondition" value="false"/> |
| 67 | + </module> |
| 68 | + |
| 69 | + <!-- Modifier --> |
| 70 | + <module name="ModifierOrder"/> <!-- Checks that the order of modifiers conforms to the suggestions in the Java Language specification: http://checkstyle.sourceforge.net/config_modifier.html#ModifierOrder --> |
| 71 | + <module name="RedundantModifier"> <!-- Checks for redundant modifiers: http://checkstyle.sourceforge.net/config_modifier.html#RedundantModifier --> |
| 72 | + <property name="tokens" |
| 73 | + value="METHOD_DEF, VARIABLE_DEF, INTERFACE_DEF, ANNOTATION_FIELD_DEF, ENUM_DEF, CLASS_DEF"/> |
| 74 | + </module> |
| 75 | + |
| 76 | + <!-- Classes --> |
| 77 | + <module name="FinalClass"/> <!-- class with only private constructor must be final: http://checkstyle.sourceforge.net/config_design.html#FinalClass --> |
| 78 | + <module |
| 79 | + name="OneStatementPerLine"/> <!-- you cant write int i=1;int j=2; http://checkstyle.sourceforge.net/config_design.html#OneStatementPerLine --> |
| 80 | + <module |
| 81 | + name="SimplifyBooleanReturn"/> <!-- directly return boolean doe not check and return http://checkstyle.sourceforge.net/config_design.html#SimplifyBooleanReturn --> |
| 82 | + <module |
| 83 | + name="StringLiteralEquality"/> <!-- you cant write myString == "this" http://checkstyle.sourceforge.net/config_design.html#StringLiteralEquality --> |
| 84 | + <module name="OneTopLevelClass"/> <!-- only one root class per file http://checkstyle.sourceforge.net/config_design.html#OneTopLevelClass --> |
| 85 | + <module name="ThrowsCount"> <!-- max 5 throws definitions per method: http://checkstyle.sourceforge.net/config_design.html#ThrowsCount --> |
| 86 | + <property name="max" value="5"/> |
| 87 | + </module> |
| 88 | + <module name="InterfaceIsType"/> <!-- interface must contain methods, should not be used for const only: http://checkstyle.sourceforge.net/config_design.html#InterfaceIsType --> |
| 89 | + <module name="OuterTypeFilename"/> <!-- class Foo must be in Foo.java: http://checkstyle.sourceforge.net/config_misc.html#OuterTypeFilename --> |
| 90 | + |
| 91 | + <module name="HideUtilityClassConstructor"/> <!-- utility class constructor must be private: http://checkstyle.sourceforge.net/config_design.html#HideUtilityClassConstructor --> |
| 92 | + <module name="VisibilityModifier"> <!-- most members must be private http://checkstyle.sourceforge.net/config_design.html#VisibilityModifier --> |
| 93 | + <property name="protectedAllowed" value="true"/> |
| 94 | + <property name="packageAllowed" value="true"/> |
| 95 | + <property name="allowPublicImmutableFields" value="true"/> |
| 96 | + <property name="allowPublicFinalFields" value="true"/> |
| 97 | + <property name="publicMemberPattern" value="^TAG$|^CREATOR$"/> |
| 98 | + </module> |
| 99 | + |
| 100 | + <!-- Coding --> |
| 101 | + <module name="CovariantEquals"/> <!-- if you override equals with different type you must provide equals with same type: http://checkstyle.sourceforge.net/config_coding.html#CovariantEquals --> |
| 102 | + <module name="DefaultComesLast"/> <!-- in switch case default must be the last elem: http://checkstyle.sourceforge.net/config_coding.html#DefaultComesLast --> |
| 103 | + <module name="EmptyStatement"/> <!-- basically an empty semicolon: http://checkstyle.sourceforge.net/config_coding.html#EmptyStatement --> |
| 104 | + <module name="EqualsHashCode"/> <!-- if you implement equals, you must implement hashcode and vice versa: http://checkstyle.sourceforge.net/config_coding.html#EqualsHashCode --> |
| 105 | + <module name="NoFinalizer"/> <!-- Verifies there are no finalize() methods defined in a class: http://checkstyle.sourceforge.net/config_coding.html#NoFinalizer --> |
| 106 | + <module name="FallThrough"/> <!-- switch fallthrough with statement not allowed http://checkstyle.sourceforge.net/config_coding.html#FallThrough --> |
| 107 | + <module name="IllegalInstantiation"/> <!-- Must not use const of certain types (Activity, Fragment): http://checkstyle.sourceforge.net/config_coding.html#IllegalInstantiation --> |
| 108 | + |
| 109 | + <!-- Size Limitiations --> |
| 110 | + <module name="LineLength"><!-- max char length per line http://checkstyle.sourceforge.net/config_sizes.html#LineLength --> |
| 111 | + <property name="max" value="300"/> |
| 112 | + </module> |
| 113 | + <module name="MethodLength"><!-- max line length for single method http://checkstyle.sourceforge.net/config_sizes.html#MethodLength --> |
| 114 | + <property name="max" value="150"/> |
| 115 | + </module> |
| 116 | + <module name="AnonInnerLength"><!-- max line length for anon class http://checkstyle.sourceforge.net/config_sizes.html#AnonInnerLength --> |
| 117 | + <property name="max" value="85"/> |
| 118 | + </module> |
| 119 | + <module name="ParameterNumber"><!-- max params for method http://checkstyle.sourceforge.net/config_sizes.html#ParameterNumber --> |
| 120 | + <property name="max" value="10"/> |
| 121 | + <property name="ignoreOverriddenMethods" value="true"/> |
| 122 | + <property name="tokens" value="METHOD_DEF"/> |
| 123 | + </module> |
| 124 | + |
| 125 | + <!-- Naming Conventions --> |
| 126 | + <!--<module name="ConstantName" /> for possible futer use--> |
| 127 | + |
| 128 | + <!-- Whitespaces --> |
| 129 | + <module name="EmptyLineSeparator"> <!-- Checks for correct empty line placements, omit VAR token: http://checkstyle.sourceforge.net/config_whitespace.html#EmptyLineSeparator --> |
| 130 | + <property name="allowMultipleEmptyLines" value="false"/> |
| 131 | + <property name="tokens" |
| 132 | + value="PACKAGE_DEF, IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF"/> |
| 133 | + </module> |
| 134 | + <module name="SingleSpaceSeparator"/> <!-- Checks if a token is surrounded by whitespace: http://checkstyle.sourceforge.net/config_whitespace.html#SingleSpaceSeparator --> |
| 135 | + <module name="GenericWhitespace"/> <!-- Checks whitespaces with Java Generics <>: http://checkstyle.sourceforge.net/config_whitespace.html#GenericWhitespace --> |
| 136 | + <module name="WhitespaceAround"> <!-- Checks if a token is surrounded by whitespace: http://checkstyle.sourceforge.net/config_whitespace.html#WhitespaceAround --> |
| 137 | + <property name="allowEmptyConstructors" value="true"/> |
| 138 | + <property name="allowEmptyMethods" value="true"/> |
| 139 | + <property name="allowEmptyTypes" value="true"/> |
| 140 | + <property name="allowEmptyLambdas" value="true"/> |
| 141 | + <property name="allowEmptyCatches" value="true"/> |
| 142 | + </module> |
| 143 | + |
| 144 | + <!-- Imports --> |
| 145 | + <module name="RedundantImport"/> <!-- e.g. double import statements: http://checkstyle.sourceforge.net/config_imports.html#RedundantImport --> |
| 146 | + <module name="UnusedImports"/> <!-- http://checkstyle.sourceforge.net/config_imports.html#UnusedImports --> |
| 147 | + <module name="IllegalImport"/> <!-- checks if import sun.* is used http://checkstyle.sourceforge.net/config_imports.html#IllegalImport --> |
| 148 | + </module> |
| 149 | +</module> |
0 commit comments