Skip to content

Commit

Permalink
Configure checkstyle, remove code-assert (#1803)
Browse files Browse the repository at this point in the history
* Configure checkstyle, remove code-assert

* Merge sun, google, and custom rules

* Import control rules, checkstyle fixes

* Codacy says I can do better at bash
  • Loading branch information
dbwiddis committed Nov 29, 2021
1 parent 643e8d4 commit 8c12323
Show file tree
Hide file tree
Showing 28 changed files with 1,454 additions and 185 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkstyle
if: contains(matrix.os, 'ubuntu') && contains(matrix.java, '8')
run: ./mvnw checkstyle:check
- name: Test with Maven
run: ./mvnw test -B
- name: Report Coverage to Coveralls
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkstyle
if: contains(matrix.os, 'ubuntu')
run: ./mvnw checkstyle:check
- name: Test with Maven
run: ./mvnw test -B
- name: Report Coverage to Coveralls for Pull Requests
Expand Down
File renamed without changes.
527 changes: 527 additions & 0 deletions config/checkstyle-merged.xml

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions config/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.0//EN"
"https://checkstyle.org/dtds/suppressions_1_0.dtd">

<suppressions>
<suppress checks=".*" files="\.properties"/>
<suppress checks=".*" files="\.xml"/>
<suppress checks=".*" files="[\\/]demo[\\/].*"/>

<!-- Sun checks -->
<suppress checks="DesignForExtension" files="\.java"/>
<suppress checks="FinalParameters" files="\.java"/>
<suppress checks="HiddenField" files="\.java"/>
<suppress checks="InnerAssignment" files="\.java"/>
<suppress checks="JavadocStyle" files="\.java"/>
<suppress checks="JavadocVariable" files="\.java"/>
<suppress checks="LineLength" files="\.java"/>
<suppress checks="MagicNumber" files="\.java"/>
<suppress checks="MethodLength" files="\.java"/>
<suppress checks="MissingJavadocMethod" files="\.java"/>
<suppress checks="NewlineAtEndOfFile" files="\.java"/>
<suppress checks="NoWhitespaceAfter" files="\.java"/>
<suppress checks="OperatorWrap" files="\.java"/>
<suppress checks="ParameterNumber" files="\.java"/>

<!-- Intentional style breaks -->
<suppress checks="ConstantName" files="ParseUtil\.java" lines="115-135"/>
<suppress checks="VisibilityModifier" files="SmcUtil\.java"/>
<suppress checks="VisibilityModifier" files="WmiQueryHandler\.*" lines="63,66"/>
<suppress checks="VisibilityModifier" files="Memoizer\.*" lines="76-78"/>

<!-- JNA convention -->
<suppress checks="InterfaceIsType" files="[\\/]jna[\\/].*"/>
<suppress checks="VisibilityModifier" files="[\\/]jna[\\/].*"/>

<suppress checks="ConstantName" files="[\\/]jna[\\/].*"/>
<suppress checks="MemberName" files="[\\/]jna[\\/].*"/>
<suppress checks="MethodName" files="[\\/]jna[\\/].*"/>
<suppress checks="ParameterName" files="[\\/]jna[\\/].*"/>
<suppress checks="TypeName" files="[\\/]jna[\\/].*"/>

<!-- Imports for classes linked in javadocs -->
<suppress checks="UnusedImports" files="(CentralProcessor|OSDesktopWindow|OSProcess)\.java"/>

<!-- Google checks -->
<suppress checks="AbbreviationAsWordInName" files="\.java"/>
<suppress checks="CustomImportOrder" files="\.java"/>
<suppress checks="EmptyLineSeparator" files="\.java"/>
<suppress checks="Indentation" files="\.java"/>
<suppress checks="JavadocParagraph" files="\.java"/>
<suppress checks="LocalVariableName" files="\.java"/>
<suppress checks="MissingJavadocType" files="\.java"/>
<suppress checks="SummaryJavadoc" files="\.java"/>
<suppress checks="VariableDeclarationUsageDistance" files="\.java"/>

<suppress checks="(Member|Parameter)Name" files="[\\/]tuples[\\/].*"/>
<suppress checks="(Member|Parameter)Name" files="(WindowsPowerSource|SmcUtil|NetStat|ThreadInfo|EnumWindows).*"/>

<!-- Test files -->
<suppress checks="(JavadocPackage|MemberName|ConstantName|StaticVariableName)" files="(.*Test|TestConstants)\.java"/>
<suppress checks="(ConstantName|VisibilityModifier)" files="SystemInfoTest\.java"/>
</suppressions>
19 changes: 19 additions & 0 deletions config/custom_checks.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<!-- add custom rules below this line -->
<module name="ImportControl">
<property name="id" value="ImportControlMain" />
<property name="file" value="config/import-control.xml" />
<property name="path" value="^.*[\\/]src[\\/]main[\\/].*$" />
</module>
<module name="ImportControl">
<property name="id" value="ImportControlTest" />
<property name="file" value="config/import-control-test.xml" />
<property name="path" value="^.*[\\/]src[\\/]test[\\/].*$" />
</module>
</module>
</module>

0 comments on commit 8c12323

Please sign in to comment.