Adapted the ruleset.xml

This commit is contained in:
David Renz
2016-04-15 15:14:38 +02:00
parent b0773c8614
commit 1f563c4841
2 changed files with 113 additions and 16 deletions

View File

@@ -30,7 +30,6 @@ public class NcssConstructorCountRule extends AbstractNcssCountRule {
@Override
public Object[] getViolationParameters(DataPoint point) {
// TODO need to put class name or constructor ID in string
return new String[] { String.valueOf(((ASTMethod) point.getNode()).getNode().getMethodInfo().getName()),
String.valueOf((int) point.getScore()) };
return new String[] { String.valueOf((int) point.getScore()) };
}
}

View File

@@ -1,19 +1,117 @@
<?xml version="1.0"?>
<ruleset name="Default ruleset used by the CodeClimate Engine for Salesforce.com Apex"
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 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
Default ruleset used by the Code Climate Engine for Salesforce.com Apex
</description>
<!-- Learn more about PMD configuration here: http://pmd.sourceforge.net/pmd-5.1.1/howtomakearuleset.html -->
<description>
Default ruleset used by the CodeClimate Engine for Salesforce.com Apex
</description>
<!-- We'll use the entire 'strings' ruleset -->
<rule ref="rulesets/apex/basic.xml"/>
<rule ref="rulesets/apex/codesize.xml"/>
<rule ref="rulesets/apex/design.xml"/>
<rule ref="rulesets/apex/naming.xml"/>
<rule ref="rulesets/apex/basic.xml/AvoidSoqlInLoops"
message="Avoid Soql queries inside loops">
<priority>3</priority>
</rule>
<rule ref="rulesets/apex/basic.xml/AvoidLogicInTrigger"
message="Avoid logic in triggers">
<priority>3</priority>
</rule>
<rule ref="rulesets/apex/basic.xml/AvoidGlobalModifier"
message="Avoid using global modifier">
<priority>3</priority>
</rule>
<rule ref="rulesets/apex/codesize.xml/ExcessiveClassLength"
message="Avoid really long classes (lines of code)">
<priority>3</priority>
<properties>
<property name="minimum" value="1000"/>
</properties>
</rule>
<rule ref="rulesets/apex/codesize.xml/ExcessiveParameterList"
message="Avoid long parameter lists">
<priority>3</priority>
<properties>
<property name="minimum" value="4"/>
</properties>
</rule>
<rule ref="rulesets/apex/codesize.xml/ExcessivePublicCount"
message="This class has too many public methods and attributes">
<priority>3</priority>
<properties>
<property name="minimum" value="20"/>
</properties>
</rule>
<rule ref="rulesets/apex/codesize.xml/NcssConstructorCount"
message="The constructor has an NCSS line count of {0}">
<priority>3</priority>
<properties>
<property name="minimum" value="20"/>
</properties>
</rule>
<rule ref="rulesets/apex/codesize.xml/NcssMethodCount"
message="The method {0}() has an NCSS line count of {1}">
<priority>3</priority>
<properties>
<property name="minimum" value="40"/>
</properties>
</rule>
<rule ref="rulesets/apex/codesize.xml/NcssTypeCount"
message="The type has an NCSS line count of {0}">
<priority>3</priority>
<properties>
<property name="minimum" value="500"/>
</properties>
</rule>
<rule ref="rulesets/apex/codesize.xml/StdCyclomaticComplexity"
message="The {0} ''{1}'' has a Standard Cyclomatic Complexity of {2}.">
<priority>3</priority>
<properties>
<property name="reportLevel" value="10"/>
</properties>
</rule>
<rule ref="rulesets/apex/codesize.xml/TooManyFields"
message="Too many fields">
<priority>3</priority>
<properties>
<property name="maxfields" value="15"/>
</properties>
</rule>
<rule ref="rulesets/apex/design.xml/AvoidDeeplyNestedIfStmts"
message="Deeply nested if..then statements are hard to read">
<priority>3</priority>
<properties>
<property name="problemDepth" value="3"/>
</properties>
</rule>
<rule ref="rulesets/apex/naming.xml/ClassNamingConventions"
message="Class names should begin with an uppercase character">
<priority>3</priority>
</rule>
<rule ref="rulesets/apex/naming.xml/MethodNamingConventions"
message="Method name does not begin with a lower case character.">
<priority>3</priority>
</rule>
<rule ref="rulesets/apex/naming.xml/MethodWithSameNameAsEnclosingClass"
message="Classes should not have non-constructor methods with the same name as the class">
<priority>3</priority>
</rule>
<rule ref="rulesets/apex/naming.xml/VariableNamingConventions"
message="{0} variable {1} should begin with {2}">
<priority>3</priority>
</rule>
</ruleset>