aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-deprecated/src/main/java
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-07 16:02:48 +0000
committerGodin <mandrikov@gmail.com>2010-12-07 16:02:48 +0000
commitb09f170fa5cd8980019d6cf91251ab11970b1cc6 (patch)
tree4fbf596dfeb13b56fec587d49c404de977264642 /sonar-deprecated/src/main/java
parent8e9d7ff89a66bf987d7fcb7c298a53a992625375 (diff)
downloadsonarqube-b09f170fa5cd8980019d6cf91251ab11970b1cc6.tar.gz
sonarqube-b09f170fa5cd8980019d6cf91251ab11970b1cc6.zip
SONAR-1829: Use severity instead of priority
Diffstat (limited to 'sonar-deprecated/src/main/java')
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java14
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java5
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java12
3 files changed, 13 insertions, 18 deletions
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java
index 3ebc5a99c0f..eade8969a01 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java
@@ -42,7 +42,6 @@ public class CheckTemplateRepository implements RulesRepository {
private List<CheckTemplate> templates;
private Map<String, CheckTemplate> templatesByKey;
-
public CheckTemplateRepository() {
}
@@ -112,7 +111,6 @@ public class CheckTemplateRepository implements RulesRepository {
return key.hashCode();
}
-
public static CheckTemplateRepository createFromXml(String repositoryKey, Language language, String pathToXml) {
InputStream input = CheckTemplateRepository.class.getResourceAsStream(pathToXml);
try {
@@ -135,14 +133,10 @@ public class CheckTemplateRepository implements RulesRepository {
return repository;
}
-
/*
-
- CODE FOR BACKWARD COMPATIBLITY
- This class should not extend RulesRepository in next versions
-
- */
-
+ * CODE FOR BACKWARD COMPATIBLITY
+ * This class should not extend RulesRepository in next versions
+ */
public List<Rule> getInitialReferential() {
List<Rule> rules = new ArrayList<Rule>();
@@ -156,7 +150,7 @@ public class CheckTemplateRepository implements RulesRepository {
Rule rule = new Rule(getKey(), checkTemplate.getKey());
rule.setDescription(checkTemplate.getDescription(Locale.ENGLISH));
rule.setName(checkTemplate.getTitle(Locale.ENGLISH));
- rule.setPriority(RulePriority.fromCheckPriority(checkTemplate.getPriority()));
+ rule.setSeverity(RulePriority.fromCheckPriority(checkTemplate.getPriority()));
for (CheckTemplateProperty checkTemplateProperty : checkTemplate.getProperties()) {
RuleParam param = rule.createParameter(checkTemplateProperty.getKey());
param.setDescription(checkTemplateProperty.getDescription(Locale.ENGLISH));
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java
index 1de8a616a0c..b08b584c3c5 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java
@@ -34,6 +34,7 @@ import java.util.List;
/**
* EXPERIMENTAL - will be used in version 2.2
+ *
* @since 2.1
*/
public class XmlCheckTemplateFactory {
@@ -75,7 +76,7 @@ public class XmlCheckTemplateFactory {
template.setConfigKey(rule.getConfigKey());
template.setDescription(rule.getDescription());
- template.setPriority(rule.getPriority().toCheckPriority());
+ template.setPriority(rule.getSeverity().toCheckPriority());
template.setTitle(rule.getName());
if (rule.getParams() != null) {
@@ -96,4 +97,4 @@ public class XmlCheckTemplateFactory {
return property;
}
-} \ No newline at end of file
+}
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
index 58b8c69abbc..82889c80c66 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
@@ -44,7 +44,7 @@ public class StandardRulesXmlParser {
InputStream inputStream = null;
try {
inputStream = IOUtils.toInputStream(xml, CharEncoding.UTF_8);
- return setDefaultRulePriorities((List<Rule>) getXStream().fromXML(inputStream));
+ return setDefaultRuleSeverities((List<Rule>) getXStream().fromXML(inputStream));
} catch (IOException e) {
throw new SonarException("Can't parse xml file", e);
@@ -55,22 +55,22 @@ public class StandardRulesXmlParser {
}
public List<Rule> parse(Reader reader) {
- return setDefaultRulePriorities((List<Rule>) getXStream().fromXML(reader));
+ return setDefaultRuleSeverities((List<Rule>) getXStream().fromXML(reader));
}
public List<Rule> parse(InputStream input) {
try {
- return setDefaultRulePriorities((List<Rule>) getXStream().fromXML(new InputStreamReader(input, CharEncoding.UTF_8)));
+ return setDefaultRuleSeverities((List<Rule>) getXStream().fromXML(new InputStreamReader(input, CharEncoding.UTF_8)));
} catch (UnsupportedEncodingException e) {
throw new SonarException("Can't parse xml file", e);
}
}
- private List<Rule> setDefaultRulePriorities(List<Rule> rules) {
+ private List<Rule> setDefaultRuleSeverities(List<Rule> rules) {
for (Rule rule : rules) {
- if (rule.getPriority() == null) {
- rule.setPriority(RulePriority.MAJOR);
+ if (rule.getSeverity() == null) {
+ rule.setSeverity(RulePriority.MAJOR);
}
}
return rules;