diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-02-29 10:11:27 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-02-29 10:11:27 +0100 |
commit | 74e26bd277d246d91a08cd7d51f11bff916ee221 (patch) | |
tree | af7c712b02e2834f98a5d473b5eb8878019b1762 /sonar-plugin-api/src/main | |
parent | 6efaff4f7669025ba44d53974be4e301512c3098 (diff) | |
download | sonarqube-74e26bd277d246d91a08cd7d51f11bff916ee221.tar.gz sonarqube-74e26bd277d246d91a08cd7d51f11bff916ee221.zip |
Fix quality flaws
Diffstat (limited to 'sonar-plugin-api/src/main')
4 files changed, 10 insertions, 13 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java index 09bb71d7f66..2778afe56e9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java @@ -141,7 +141,7 @@ public class Checks<C> { return this; } - private String annotatedEngineKey(Object annotatedClassOrObject) { + private static String annotatedEngineKey(Object annotatedClassOrObject) { String key = null; org.sonar.check.Rule ruleAnnotation = AnnotationUtils.getAnnotation(annotatedClassOrObject, org.sonar.check.Rule.class); if (ruleAnnotation != null) { @@ -185,7 +185,7 @@ public class Checks<C> { } @CheckForNull - private Field getField(Object check, String key) { + private static Field getField(Object check, String key) { List<Field> fields = FieldUtils2.getFields(check.getClass(), true); for (Field field : fields) { RuleProperty propertyAnnotation = field.getAnnotation(RuleProperty.class); @@ -196,7 +196,7 @@ public class Checks<C> { return null; } - private void configureField(Object check, Field field, String value) { + private static void configureField(Object check, Field field, String value) { try { field.setAccessible(true); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java index c5303b05c86..0bd6997a7dd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java @@ -102,7 +102,7 @@ public final class AnnotationCheckFactory extends CheckFactory { } - private void configureField(Object check, Field field, String value) { + private static void configureField(Object check, Field field, String value) { try { field.setAccessible(true); @@ -147,7 +147,7 @@ public final class AnnotationCheckFactory extends CheckFactory { } } - private Field getField(Object check, String key) { + private static Field getField(Object check, String key) { List<Field> fields = FieldUtils2.getFields(check.getClass(), true); for (Field field : fields) { RuleProperty propertyAnnotation = field.getAnnotation(RuleProperty.class); @@ -158,7 +158,7 @@ public final class AnnotationCheckFactory extends CheckFactory { return null; } - private String getRuleKey(Object annotatedClassOrObject) { + private static String getRuleKey(Object annotatedClassOrObject) { String key = null; Rule ruleAnnotation = AnnotationUtils.getAnnotation(annotatedClassOrObject, Rule.class); if (ruleAnnotation != null) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java index 8c5dec82e03..404da38046e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java @@ -82,7 +82,7 @@ public final class AnnotationRuleParser { return rule; } - private void addRuleProperty(Rule rule, Field field) { + private static void addRuleProperty(Rule rule, Field field) { org.sonar.check.RuleProperty propertyAnnotation = field.getAnnotation(org.sonar.check.RuleProperty.class); if (propertyAnnotation != null) { String fieldKey = StringUtils.defaultIfEmpty(propertyAnnotation.key(), field.getName()); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java index f767cb5e0a1..787c6f935aa 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java @@ -280,11 +280,8 @@ public class RulesDefinitionXmlLoader { } else if (equalsIgnoreCase("internalKey", nodeName)) { internalKey = nodeValue(cursor); - } else if (equalsIgnoreCase("priority", nodeName)) { - // deprecated field, replaced by severity - severity = nodeValue(cursor); - - } else if (equalsIgnoreCase("severity", nodeName)) { + } else if (equalsIgnoreCase("priority", nodeName) || equalsIgnoreCase("severity", nodeName)) { + // "priority" is deprecated field and has been replaced by "severity" severity = nodeValue(cursor); } else if (equalsIgnoreCase("cardinality", nodeName)) { @@ -380,7 +377,7 @@ public class RulesDefinitionXmlLoader { RuleParamType type = RuleParamType.STRING; } - private ParamStruct processParameter(SMInputCursor ruleC) throws XMLStreamException { + private static ParamStruct processParameter(SMInputCursor ruleC) throws XMLStreamException { ParamStruct param = new ParamStruct(); // BACKWARD COMPATIBILITY WITH DEPRECATED FORMAT |