diff options
author | Godin <mandrikov@gmail.com> | 2010-12-07 16:12:03 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-07 16:12:03 +0000 |
commit | c1cfffea2098a53ab078deb9bebe47b627c389cf (patch) | |
tree | 7333070e02e4504ed48e8d550a6ae8de86b5de6a /plugins | |
parent | b09f170fa5cd8980019d6cf91251ab11970b1cc6 (diff) | |
download | sonarqube-c1cfffea2098a53ab078deb9bebe47b627c389cf.tar.gz sonarqube-c1cfffea2098a53ab078deb9bebe47b627c389cf.zip |
SONAR-1829: Use severity instead of priority
Diffstat (limited to 'plugins')
5 files changed, 9 insertions, 9 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java index 3be00022106..a44b578c769 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java @@ -139,7 +139,7 @@ public class CheckstyleProfileExporter extends ProfileExporter { if (activeRule.getRule().getParent() != null) { appendModuleProperty(writer, "id", activeRule.getRuleKey()); } - appendModuleProperty(writer, "severity", CheckstyleSeverityUtils.toSeverity(activeRule.getPriority())); + appendModuleProperty(writer, "severity", CheckstyleSeverityUtils.toSeverity(activeRule.getSeverity())); appendRuleParameters(writer, activeRule); writer.append("</module>"); } @@ -163,5 +163,4 @@ public class CheckstyleProfileExporter extends ProfileExporter { } } - } diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java index 1766e0fb79e..0fef160a0f2 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java @@ -36,6 +36,7 @@ import org.sonar.api.utils.ValidationMessages; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; + import java.io.Reader; import java.util.Map; @@ -147,7 +148,7 @@ public class CheckstyleProfileImporter extends ProfileImporter { private void activateProperties(ActiveRule activeRule, Map<String, String> properties) { for (Map.Entry<String, String> property : properties.entrySet()) { if (StringUtils.equals("severity", property.getKey())) { - activeRule.setPriority(CheckstyleSeverityUtils.fromSeverity(property.getValue())); + activeRule.setSeverity(CheckstyleSeverityUtils.fromSeverity(property.getValue())); } else if (!StringUtils.equals("id", property.getKey())) { activeRule.setParameter(property.getKey(), property.getValue()); diff --git a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporterTest.java b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporterTest.java index 330698acc3a..f3d4a41c1ff 100644 --- a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporterTest.java +++ b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporterTest.java @@ -88,7 +88,7 @@ public class CheckstyleProfileImporterTest { RulesProfile profile = importer.importProfile(reader, messages); ActiveRule javadocCheck = profile.getActiveRuleByConfigKey("checkstyle", "Checker/JavadocPackage"); - assertThat(javadocCheck.getPriority(), is(RulePriority.BLOCKER)); + assertThat(javadocCheck.getSeverity(), is(RulePriority.BLOCKER)); } @Test @@ -97,7 +97,7 @@ public class CheckstyleProfileImporterTest { RulesProfile profile = importer.importProfile(reader, messages); ActiveRule activeRule = profile.getActiveRuleByConfigKey("checkstyle", "Checker/TreeWalker/EqualsHashCode"); - assertThat(activeRule.getPriority(), is(RulePriority.BLOCKER)); // reuse the rule default priority + assertThat(activeRule.getSeverity(), is(RulePriority.BLOCKER)); // reuse the rule default priority } @Test diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java index b2dc55984a6..dd72f846a1c 100644 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java +++ b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java @@ -65,7 +65,7 @@ public class PmdProfileExporter extends ProfileExporter { for (ActiveRule activeRule : activeRules) { if (activeRule.getRule().getPluginName().equals(CoreProperties.PMD_PLUGIN)) { String configKey = activeRule.getRule().getConfigKey(); - PmdRule rule = new PmdRule(configKey, PmdLevelUtils.toLevel(activeRule.getPriority())); + PmdRule rule = new PmdRule(configKey, PmdLevelUtils.toLevel(activeRule.getSeverity())); if (activeRule.getActiveRuleParams() != null && !activeRule.getActiveRuleParams().isEmpty()) { List<PmdProperty> properties = new ArrayList<PmdProperty>(); for (ActiveRuleParam activeRuleParam : activeRule.getActiveRuleParams()) { diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java index 41064bec012..5a73f501448 100644 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java +++ b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java @@ -95,7 +95,7 @@ public class PmdProfileImporterTest { RulesProfile profile = importer.importProfile(reader, messages); ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/coupling.xml/ExcessiveImports"); - assertThat(activeRule.getPriority(), is(RulePriority.BLOCKER)); // reuse the rule default priority + assertThat(activeRule.getSeverity(), is(RulePriority.BLOCKER)); // reuse the rule default priority } @Test @@ -104,10 +104,10 @@ public class PmdProfileImporterTest { RulesProfile profile = importer.importProfile(reader, messages); ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/design.xml/UseNotifyAllInsteadOfNotify"); - assertThat(activeRule.getPriority(), is(RulePriority.MINOR)); + assertThat(activeRule.getSeverity(), is(RulePriority.MINOR)); activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/coupling.xml/CouplingBetweenObjects"); - assertThat(activeRule.getPriority(), is(RulePriority.CRITICAL)); + assertThat(activeRule.getSeverity(), is(RulePriority.CRITICAL)); } @Test |