This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 52a150e9 authored by Daniel Rainer's avatar Daniel Rainer
Browse files

Add PMD as java linter to pipeline

parent f582cbbb
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
......@@ -12,10 +12,27 @@ stages:
- package
- release
- deploy
before_script:
- export NG_CLI_ANALYTICS="false"
- export MAVEN_USER_HOME=`pwd`/.maven
pmd:
stage: lint
allow_failure: true
when: always
before_script:
- 'export VERSION="6.40.0"'
- 'wget "https://github.com/pmd/pmd/releases/download/pmd_releases%2F$VERSION/pmd-bin-$VERSION.zip"'
- 'unzip "pmd-bin-$VERSION.zip"'
script:
- '"pmd-bin-$VERSION/bin/run.sh" pmd -d src/main/java -f textcolor -R pmd_rules.xml 2>&1 | tee pmd.log'
needs: []
artifacts:
when: on_failure
paths:
- pmd.log
checkstyle:
stage: lint
script:
......
<?xml version="1.0"?>
<ruleset name="Custom Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
Rules for the PMD linter
</description>
<rule ref="category/java/bestpractices.xml">
<exclude name="GuardLogStatement"/>
<exclude name="UseVarargs"/>
</rule>
<rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/>
<exclude name="OnlyOneReturn"/>
<exclude name="ShortClassName"/>
<exclude name="UselessParentheses"/>
<!-- does not work properly with annotation imports -->
<exclude name="UnnecessaryImport"/>
<!-- should be included, removed to find other lints -->
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="FieldNamingConventions"/>
<exclude name="ShortVariable"/>
<exclude name="LongVariable"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="BooleanGetMethodName"/>
</rule>
<rule ref="category/java/design.xml">
<exclude name="LawOfDemeter"/>
<exclude name="DataClass"/>
<exclude name="ExcessiveImports"/>
<!-- seems to be broken in its default config -->
<exclude name="LoosePackageCoupling"/>
</rule>
<rule ref="category/java/documentation.xml">
<exclude name="CommentSize"/>
<exclude name="CommentRequired"/>
<exclude name="UncommentedEmptyConstructor"/>
</rule>
<rule ref="category/java/errorprone.xml">
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="AvoidLiteralsInIfCondition"/>
</rule>
<rule ref="category/java/multithreading.xml"></rule>
<rule ref="category/java/performance.xml">
<exclude name="RedundantFieldInitializer"/>
<exclude name="TooFewBranchesForASwitchStatement"/>
<exclude name="AvoidInstantiatingObjectsInLoops"/>
<exclude name="AvoidFileStream"/>
</rule>
<rule ref="category/java/security.xml"></rule>
</ruleset>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment