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 | |
parent | b09f170fa5cd8980019d6cf91251ab11970b1cc6 (diff) | |
download | sonarqube-c1cfffea2098a53ab078deb9bebe47b627c389cf.tar.gz sonarqube-c1cfffea2098a53ab078deb9bebe47b627c389cf.zip |
SONAR-1829: Use severity instead of priority
19 files changed, 50 insertions, 55 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 diff --git a/sonar-batch/src/main/java/org/sonar/batch/CheckProfileProvider.java b/sonar-batch/src/main/java/org/sonar/batch/CheckProfileProvider.java index 3ec7d8b522b..3046aa96eb4 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/CheckProfileProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/CheckProfileProvider.java @@ -47,7 +47,7 @@ public class CheckProfileProvider extends ProviderAdapter { private Check toCheck(ActiveRule activeRule) { Check check = new Check(activeRule.getPluginName(), activeRule.getRuleKey()); - check.setPriority(activeRule.getPriority().toCheckPriority()); + check.setPriority(activeRule.getSeverity().toCheckPriority()); check.setProperties(toParameters(activeRule.getActiveRuleParams())); return check; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index ce98655f023..324f8f0f01b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -404,7 +404,7 @@ public final class DefaultIndex extends SonarIndex { } } else { - violation.setPriority(activeRule.getPriority()); + violation.setPriority(activeRule.getSeverity()); doAddViolation(violation, bucket); } } diff --git a/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java index 2f20bd096ca..586961d0dca 100644 --- a/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java +++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java @@ -20,9 +20,6 @@ package org.sonar.api.rules; import org.apache.commons.io.IOUtils; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.*; - import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; @@ -37,6 +34,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + public class StandardProfileXmlParserTest { @Test @@ -136,7 +139,6 @@ public class StandardProfileXmlParserTest { return rules; } - private List<ActiveRule> buildActiveRulesFixture(List<Rule> rules) { List<ActiveRule> activeRules = new ArrayList<ActiveRule>(); @@ -157,7 +159,7 @@ public class StandardProfileXmlParserTest { for (int i = 0; i < activeRules1.size(); i++) { ActiveRule activeRule1 = activeRules1.get(i); ActiveRule activeRule2 = activeRules2.get(i); - assertTrue(activeRule1.getRule().equals(activeRule2.getRule()) && activeRule1.getPriority().equals(activeRule2.getPriority())); + assertTrue(activeRule1.getRule().equals(activeRule2.getRule()) && activeRule1.getSeverity().equals(activeRule2.getSeverity())); Assert.assertEquals(activeRule1.getActiveRuleParams().size(), (activeRule2.getActiveRuleParams().size())); for (int j = 0; j < activeRule1.getActiveRuleParams().size(); j++) { @@ -169,4 +171,4 @@ public class StandardProfileXmlParserTest { } } -}
\ No newline at end of file +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java index 3ed3125a2c1..01d91243bbb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java @@ -224,7 +224,7 @@ public class RulesProfile implements Cloneable { public List<ActiveRule> getActiveRules(RulePriority priority) { List<ActiveRule> result = new ArrayList<ActiveRule>(); for (ActiveRule activeRule : getActiveRules()) { - if (activeRule.getPriority().equals(priority)) { + if (activeRule.getSeverity().equals(priority)) { result.add(activeRule); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java index e670002e968..263c8171f01 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java @@ -71,9 +71,9 @@ public final class XMLProfileSerializer implements ServerComponent { writer.append("</repositoryKey><key>"); StringEscapeUtils.escapeXml(writer, activeRule.getRuleKey()); writer.append("</key>"); - if (activeRule.getPriority() != null) { + if (activeRule.getSeverity() != null) { writer.append("<priority>"); - writer.append(activeRule.getPriority().name()); + writer.append(activeRule.getSeverity().name()); writer.append("</priority>"); } appendRuleParameters(activeRule, writer); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java index c30131645f2..f80beac42c7 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java @@ -31,7 +31,9 @@ import org.sonar.check.BelongsToProfile; import org.sonar.check.Priority; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -48,11 +50,11 @@ public class AnnotationProfileParserTest { }); ValidationMessages messages = ValidationMessages.create(); - RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.<Class>newArrayList(FakeRule.class), messages); + RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.<Class> newArrayList(FakeRule.class), messages); assertThat(profile.getName(), is("Foo way")); assertThat(profile.getLanguage(), is("java")); - assertThat(profile.getActiveRule("squid", "fake").getPriority(), is(RulePriority.BLOCKER)); + assertThat(profile.getActiveRule("squid", "fake").getSeverity(), is(RulePriority.BLOCKER)); assertThat(messages.hasErrors(), is(false)); } @@ -66,7 +68,7 @@ public class AnnotationProfileParserTest { }); ValidationMessages messages = ValidationMessages.create(); - RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.<Class>newArrayList(FakeRule.class, RuleOnOtherProfile.class), messages); + RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.<Class> newArrayList(FakeRule.class, RuleOnOtherProfile.class), messages); assertNotNull(profile.getActiveRule("squid", "fake")); assertNull(profile.getActiveRule("squid", "other")); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java index 3167cb941b4..6c31b9d2688 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java @@ -51,7 +51,7 @@ public class XMLProfileParserTest { assertThat(profile.getName(), is("sonar way")); assertThat(validation.hasErrors(), is(false)); assertNotNull(profile); - assertThat(profile.getActiveRule("checkstyle", "IllegalRegexp").getPriority(), is(RulePriority.CRITICAL)); + assertThat(profile.getActiveRule("checkstyle", "IllegalRegexp").getSeverity(), is(RulePriority.CRITICAL)); } @Test @@ -101,4 +101,4 @@ public class XMLProfileParserTest { }); return ruleFinder; } -}
\ No newline at end of file +} diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java index 4eb135493a3..16f84aad306 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java @@ -28,12 +28,12 @@ import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import org.apache.commons.collections.CollectionUtils; import org.slf4j.LoggerFactory; import org.sonar.api.database.DatabaseSession; -import org.sonar.jpa.dao.RulesDao; -import org.sonar.jpa.dao.ProfilesDao; import org.sonar.api.measures.Metric; import org.sonar.api.profiles.Alert; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.rules.*; +import org.sonar.jpa.dao.ProfilesDao; +import org.sonar.jpa.dao.RulesDao; import java.util.*; @@ -164,7 +164,7 @@ public class ProfilesBackup implements Backupable { ActiveRule rule = (ActiveRule) source; writeNode(writer, "key", rule.getRule().getKey()); writeNode(writer, "plugin", rule.getRule().getPluginName()); - writeNode(writer, "level", rule.getPriority().name()); + writeNode(writer, "level", rule.getSeverity().name()); if (!rule.getActiveRuleParams().isEmpty()) { writer.startNode("params"); diff --git a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java index 90cf7cb0651..ee0628f76dc 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java @@ -72,7 +72,7 @@ public final class DeprecatedProfiles { this.deprecatedCheckProfiles = new CheckProfile[0]; this.deprecatedCheckProfileProviders = new CheckProfileProvider[0]; } - + public DeprecatedProfiles(Plugins plugins, RuleFinder ruleFinder) { this.deprecatedRepositories = new RulesRepository[0]; this.plugins = plugins; @@ -110,7 +110,7 @@ public final class DeprecatedProfiles { } Rule rule = ruleFinder.findByKey(repositoryKey, deprecatedActiveRule.getRuleKey()); if (rule != null) { - ActiveRule activeRule = providedProfile.activateRule(rule, deprecatedActiveRule.getPriority()); + ActiveRule activeRule = providedProfile.activateRule(rule, deprecatedActiveRule.getSeverity()); for (ActiveRuleParam arp : deprecatedActiveRule.getActiveRuleParams()) { activeRule.setParameter(arp.getKey(), arp.getValue()); } @@ -164,7 +164,6 @@ public final class DeprecatedProfiles { return profile.getActiveRules(); } - public List<ActiveRule> getRulesByRepositoryKey(String repositoryKey) { return profile.getActiveRulesByRepository(repositoryKey); } diff --git a/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java b/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java index 20b9605c863..8217194761a 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java @@ -26,7 +26,6 @@ import org.sonar.api.database.DatabaseSession; import org.sonar.api.profiles.*; import org.sonar.api.rules.ActiveRule; import org.sonar.api.rules.ActiveRuleParam; -import org.sonar.api.rules.RuleFinder; import org.sonar.api.utils.ValidationMessages; import org.sonar.jpa.session.DatabaseSessionFactory; @@ -143,7 +142,7 @@ public final class ProfilesConsole implements ServerComponent { DatabaseSession session = sessionFactory.getSession(); RulesProfile persistedProfile = session.getSingleResult(RulesProfile.class, "name", profileName, "language", language); for (ActiveRule activeRule : profile.getActiveRules()) { - ActiveRule persistedActiveRule = persistedProfile.activateRule(activeRule.getRule(), activeRule.getPriority()); + ActiveRule persistedActiveRule = persistedProfile.activateRule(activeRule.getRule(), activeRule.getSeverity()); for (ActiveRuleParam activeRuleParam : activeRule.getActiveRuleParams()) { persistedActiveRule.setParameter(activeRuleParam.getKey(), activeRuleParam.getValue()); } diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java index 4e9ea3d96ca..769371519e6 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java @@ -19,27 +19,23 @@ */
package org.sonar.server.startup;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Metric;
import org.sonar.api.measures.Metrics;
-import org.sonar.api.platform.PluginRepository;
import org.sonar.api.profiles.Alert;
import org.sonar.api.utils.Logs;
import org.sonar.api.utils.TimeProfiler;
import org.sonar.jpa.dao.MeasuresDao;
import org.sonar.server.platform.ServerStartException;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
+import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.persistence.Query;
-
public class RegisterMetrics {
private MeasuresDao measuresDao;
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java index 82f0c94de88..144e813f370 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java @@ -113,7 +113,6 @@ public final class RegisterProvidedProfiles { profiler.stop(); } - void saveProvidedProfiles(List<RulesProfile> profiles, DatabaseSession session) { for (RulesProfile profile : profiles) { TimeProfiler profiler = new TimeProfiler().start("Save profile " + profile); @@ -121,7 +120,7 @@ public final class RegisterProvidedProfiles { for (ActiveRule activeRule : profile.getActiveRules()) { Rule rule = getPersistedRule(activeRule); - ActiveRule persistedRule = persistedProfile.activateRule(rule, activeRule.getPriority()); + ActiveRule persistedRule = persistedProfile.activateRule(rule, activeRule.getSeverity()); for (RuleParam param : rule.getParams()) { String value = StringUtils.defaultString(activeRule.getParameter(param.getKey()), param.getDefaultValue()); if (value != null) { @@ -139,11 +138,11 @@ public final class RegisterProvidedProfiles { Rule getPersistedRule(ActiveRule activeRule) { Rule rule = activeRule.getRule(); - if (rule!=null && rule.getId()==null) { - if (rule.getKey()!=null) { + if (rule != null && rule.getId() == null) { + if (rule.getKey() != null) { rule = ruleFinder.findByKey(rule.getRepositoryKey(), rule.getKey()); - } else if (rule.getConfigKey()!=null) { + } else if (rule.getConfigKey() != null) { rule = ruleFinder.find(RuleQuery.create().withRepositoryKey(rule.getRepositoryKey()).withConfigKey(rule.getConfigKey())); } } diff --git a/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java b/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java index cb43e13accb..87e5ca667ce 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java @@ -19,22 +19,20 @@ */ package org.sonar.server.ui; -import java.io.StringReader; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.apache.commons.lang.StringUtils; import org.sonar.api.ServerExtension; import org.sonar.api.utils.Logs; import org.sonar.api.web.CodeColorizerFormat; -import org.sonar.channel.Channel; import org.sonar.colorizer.CodeColorizer; -import org.sonar.colorizer.HtmlCodeBuilder; import org.sonar.colorizer.HtmlOptions; import org.sonar.colorizer.Tokenizer; +import java.io.StringReader; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class CodeColorizers implements ServerExtension { private Map<String, CodeColorizerFormat> formatPerLanguage; diff --git a/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java b/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java index 4bcc6d92584..0a9029e2334 100644 --- a/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java +++ b/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java @@ -118,7 +118,7 @@ public class BackupTest { assertEquals(1, testProfile.getActiveRules().size()); ActiveRule testActiveRule = testProfile.getActiveRules().get(0); - assertEquals(RulePriority.MAJOR, testActiveRule.getPriority()); + assertEquals(RulePriority.MAJOR, testActiveRule.getSeverity()); assertNotNull(testActiveRule.getRule()); assertEquals("test key", testActiveRule.getRule().getKey()); assertEquals("test plugin", testActiveRule.getRule().getPluginName()); |