-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved: Use ‘checkstyle’ linting tool
(OFBIZ-11251) Linting [1] is a software engineering practice which make the code more readable and maintainable by improving its consistency and avoiding potential programming mistakes. Gradle provides a core plugin for the ‘checkstyle’ tool [2][3] which implement a linting facility for the Java language. The check is done with the ‘gradlew check’ command. There are currently a lot reported errors that will need to be fixed incrementally in the future. We ensure that new errors will not be introduced by defining a global threshold of “allowed” errors corresponding to the sum of errors found in the framework and in the official plugins. [1] https://en.wikipedia.org/wiki/Lint_(software) [2] https://checkstyle.org/ [3] https://docs.gradle.org/current/userguide/checkstyle_plugin.html Thanks: Taher Alkhateeb and Jacques Le Roux for their feedback git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868597 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Showing
2 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE module PUBLIC | ||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" | ||
"https://checkstyle.org/dtds/configuration_1_3.dtd"> | ||
<!-- This configuration corresponds to the OFBiz coding conventions | ||
which are simply “Sun Coding Standards” + “120 characters line length” --> | ||
<module name="Checker"> | ||
<module name="BeforeExecutionExclusionFileFilter"> | ||
<property name="fileNamePattern" value="module\-info\.java$"/> | ||
</module> | ||
<property name="fileExtensions" value="java, properties, xml"/> | ||
|
||
<!-- General file conventions --> | ||
<module name="NewlineAtEndOfFile"/> | ||
<module name="FileTabCharacter"/> | ||
<module name="RegexpSingleline"> | ||
<property name="format" value="\s+$"/> | ||
<property name="minimum" value="0"/> | ||
<property name="maximum" value="0"/> | ||
<property name="message" value="Line has trailing spaces."/> | ||
</module> | ||
|
||
<module name="TreeWalker"> | ||
<!-- Naming conventions --> | ||
<module name="ConstantName"/> | ||
<module name="LocalFinalVariableName"/> | ||
<module name="LocalVariableName"/> | ||
<module name="MemberName"/> | ||
<module name="MethodName"/> | ||
<module name="PackageName"/> | ||
<module name="ParameterName"/> | ||
<module name="StaticVariableName"/> | ||
<module name="TypeName"/> | ||
|
||
<!-- Checks for imports --> | ||
<module name="AvoidStarImport"/> | ||
<module name="IllegalImport"/> | ||
<module name="RedundantImport"/> | ||
<module name="UnusedImports"> | ||
<property name="processJavadoc" value="false"/> | ||
</module> | ||
|
||
<!-- Checks for Size Violations --> | ||
<module name="LineLength"> | ||
<property name="max" value="120"/> | ||
</module> | ||
<module name="MethodLength"/> | ||
<module name="ParameterNumber"/> | ||
|
||
<!-- Checks for whitespace --> | ||
<module name="EmptyForIteratorPad"/> | ||
<module name="GenericWhitespace"/> | ||
<module name="MethodParamPad"/> | ||
<module name="NoWhitespaceAfter"/> | ||
<module name="NoWhitespaceBefore"/> | ||
<module name="OperatorWrap"/> | ||
<module name="SeparatorWrap"> | ||
<property name="tokens" | ||
value="COMMA,LPAREN,RPAREN,RBRACK,ARRAY_DECLARATOR"/> | ||
<property name="option" value="eol"/> | ||
</module> | ||
<module name="SeparatorWrap"> | ||
<property name="tokens" value="DOT,METHOD_REF,ELLIPSIS,AT"/> | ||
<property name="option" value="nl"/> | ||
</module> | ||
<module name="ParenPad"/> | ||
<module name="TypecastParenPad"/> | ||
<module name="WhitespaceAfter"/> | ||
<module name="WhitespaceAround"/> | ||
<module name="SingleSpaceSeparator"/> | ||
|
||
<!-- Modifier Checks --> | ||
<module name="ModifierOrder"/> | ||
<module name="RedundantModifier"/> | ||
|
||
<!-- Checks for blocks. You know, those {}'s --> | ||
<module name="AvoidNestedBlocks"/> | ||
<module name="EmptyBlock"/> | ||
<module name="LeftCurly"/> | ||
<module name="NeedBraces"/> | ||
<module name="RightCurly"/> | ||
|
||
<!-- Checks for common coding problems --> | ||
<module name="EmptyStatement"/> | ||
<module name="EqualsHashCode"/> | ||
<module name="IllegalInstantiation"/> | ||
<module name="InnerAssignment"/> | ||
<module name="MultipleVariableDeclarations"/> | ||
<module name="SimplifyBooleanExpression"/> | ||
<module name="SimplifyBooleanReturn"/> | ||
|
||
<!-- Checks for class design --> | ||
<module name="DesignForExtension"/> | ||
<module name="FinalClass"/> | ||
<module name="HideUtilityClassConstructor"/> | ||
<module name="InterfaceIsType"/> | ||
<module name="VisibilityModifier"/> | ||
|
||
<!-- Miscellaneous other checks --> | ||
<module name="ArrayTypeStyle"/> | ||
<module name="UpperEll"/> | ||
<module name="Indentation"> | ||
<property name="caseIndent" value="0"/> | ||
<property name="lineWrappingIndentation" value="8"/> | ||
</module> | ||
|
||
<!-- Checks for annotations --> | ||
<module name="MissingOverride"/> | ||
</module> | ||
</module> |