Skip to content

Commit

Permalink
SOANRGROOV-40 Suffixed rules previously having null as default parame…
Browse files Browse the repository at this point in the history
…ters
  • Loading branch information
Wohops committed Aug 5, 2015
1 parent abae3bc commit 2be23e1
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ private void appendXmlFooter() throws IOException {
}

private void appendRule(ActiveRule activeRule) throws IOException {
writer.append("<rule class=\"")
.append(activeRule.getRuleKey());
String ruleKey = activeRule.getRuleKey();
// SOANRGROOV-40 : key of rule having null parameters have been suffixed with ".fixed"
if (ruleKey.endsWith(".fixed")) {
ruleKey = ruleKey.substring(0, ruleKey.length() - ".fixed".length());
}
writer.append("<rule class=\"").append(ruleKey);
if (activeRule.getActiveRuleParams().isEmpty()) {
writer.append(AUTO_CLOSING_TAG);
} else {
Expand Down
50 changes: 25 additions & 25 deletions src/main/resources/com/sonar/sqale/groovy-model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
<name>Readability</name>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.AbstractClassNameRule</rule-key>
<rule-key>org.codenarc.rule.naming.AbstractClassNameRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -1397,7 +1397,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.FieldNameRule</rule-key>
<rule-key>org.codenarc.rule.naming.FieldNameRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -1469,7 +1469,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.IllegalClassReferenceRule</rule-key>
<rule-key>org.codenarc.rule.generic.IllegalClassReferenceRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand All @@ -1487,7 +1487,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.IllegalClassMemberRule</rule-key>
<rule-key>org.codenarc.rule.generic.IllegalClassMemberRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand All @@ -1505,7 +1505,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.IllegalPackageReferenceRule</rule-key>
<rule-key>org.codenarc.rule.generic.IllegalPackageReferenceRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand All @@ -1523,7 +1523,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.IllegalRegexRule</rule-key>
<rule-key>org.codenarc.rule.generic.IllegalRegexRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand All @@ -1541,7 +1541,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.IllegalStringRule</rule-key>
<rule-key>org.codenarc.rule.generic.IllegalStringRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -1577,7 +1577,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.InterfaceNameRule</rule-key>
<rule-key>org.codenarc.rule.naming.InterfaceNameRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -1703,7 +1703,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.MethodNameRule</rule-key>
<rule-key>org.codenarc.rule.naming.MethodNameRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -1757,7 +1757,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.ParameterNameRule</rule-key>
<rule-key>org.codenarc.rule.naming.ParameterNameRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -1793,7 +1793,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.PropertyNameRule</rule-key>
<rule-key>org.codenarc.rule.naming.PropertyNameRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand All @@ -1811,7 +1811,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.RequiredRegexRule</rule-key>
<rule-key>org.codenarc.rule.generic.RequiredRegexRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand All @@ -1829,7 +1829,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.RequiredStringRule</rule-key>
<rule-key>org.codenarc.rule.generic.RequiredStringRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -2891,7 +2891,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.VariableNameRule</rule-key>
<rule-key>org.codenarc.rule.naming.VariableNameRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -3147,7 +3147,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.naming.PackageNameMatchesFilePathRule</rule-key>
<rule-key>org.codenarc.rule.naming.PackageNameMatchesFilePathRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -3201,7 +3201,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.size.AbcMetricRule</rule-key>
<rule-key>org.codenarc.rule.size.AbcMetricRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -3453,7 +3453,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.unused.UnusedVariableRule</rule-key>
<rule-key>org.codenarc.rule.unused.UnusedVariableRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -3821,7 +3821,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.design.PrivateFieldCouldBeFinalRule</rule-key>
<rule-key>org.codenarc.rule.design.PrivateFieldCouldBeFinalRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -3857,7 +3857,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.generic.StatelessClassRule</rule-key>
<rule-key>org.codenarc.rule.generic.StatelessClassRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -3915,7 +3915,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.size.CrapMetricRule</rule-key>
<rule-key>org.codenarc.rule.size.CrapMetricRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -3951,7 +3951,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.grails.GrailsPublicControllerMethodRule</rule-key>
<rule-key>org.codenarc.rule.grails.GrailsPublicControllerMethodRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -4023,7 +4023,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.size.MethodSizeRule</rule-key>
<rule-key>org.codenarc.rule.size.MethodSizeRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -5293,7 +5293,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.size.CyclomaticComplexityRule</rule-key>
<rule-key>org.codenarc.rule.size.CyclomaticComplexityRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -5653,7 +5653,7 @@
</chc>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.junit.SpockIgnoreRestUsedRule</rule-key>
<rule-key>org.codenarc.rule.junit.SpockIgnoreRestUsedRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down Expand Up @@ -6361,7 +6361,7 @@
<name>Unit level</name>
<chc>
<rule-repo>grvy</rule-repo>
<rule-key>org.codenarc.rule.junit.JUnitPublicPropertyRule</rule-key>
<rule-key>org.codenarc.rule.junit.JUnitPublicPropertyRule.fixed</rule-key>
<prop>
<key>remediationFunction</key>
<txt>linear</txt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</rule>
<rule>
<repositoryKey>grvy</repositoryKey>
<key>org.codenarc.rule.grails.GrailsPublicControllerMethodRule</key>
<key>org.codenarc.rule.grails.GrailsPublicControllerMethodRule.fixed</key>
<priority>MINOR</priority>
</rule>
<rule>
Expand Down Expand Up @@ -159,7 +159,7 @@
</rule>
<rule>
<repositoryKey>grvy</repositoryKey>
<key>org.codenarc.rule.unused.UnusedVariableRule</key>
<key>org.codenarc.rule.unused.UnusedVariableRule.fixed</key>
<priority>MAJOR</priority>
</rule>
<rule>
Expand Down
Loading

0 comments on commit 2be23e1

Please sign in to comment.