aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-checkstyle-plugin/src/main
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-10-08 15:48:07 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-10-08 15:48:07 +0000
commitfc24fe199eb5968ab7adb26fd23f650e4a8f8a9e (patch)
tree59332c8e45a7b6184cc602756c6c193898e62d94 /plugins/sonar-checkstyle-plugin/src/main
parent7ca495d67492c6b3dbb653102e345f8fc43f09ae (diff)
downloadsonarqube-fc24fe199eb5968ab7adb26fd23f650e4a8f8a9e.tar.gz
sonarqube-fc24fe199eb5968ab7adb26fd23f650e4a8f8a9e.zip
API: apply the same pattern between rules and profiles API. The extension point to define rules is org.sonar.api.rules.RuleRepository. The classes AnnotationRuleParser and XMLRuleParser are components that can be used but not extended.
Diffstat (limited to 'plugins/sonar-checkstyle-plugin/src/main')
-rw-r--r--plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java
index ee533a1cffa..02dd0ad885c 100644
--- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java
+++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java
@@ -33,19 +33,21 @@ public final class CheckstyleRuleRepository extends RuleRepository {
// for user extensions
private ServerFileSystem fileSystem;
+ private XMLRuleParser xmlRuleParser;
- public CheckstyleRuleRepository(ServerFileSystem fileSystem) {
+ public CheckstyleRuleRepository(ServerFileSystem fileSystem, XMLRuleParser xmlRuleParser) {
super(CheckstyleConstants.REPOSITORY_KEY, Java.KEY);
setName(CheckstyleConstants.REPOSITORY_NAME);
this.fileSystem = fileSystem;
+ this.xmlRuleParser = xmlRuleParser;
}
@Override
public List<Rule> createRules() {
List<Rule> rules = new ArrayList<Rule>();
- rules.addAll(XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/plugins/checkstyle/rules.xml")));
+ rules.addAll(xmlRuleParser.parse(getClass().getResourceAsStream("/org/sonar/plugins/checkstyle/rules.xml")));
for (File userExtensionXml : fileSystem.getExtensions(CheckstyleConstants.REPOSITORY_KEY, "xml")) {
- rules.addAll(XMLRuleParser.parseXML(userExtensionXml));
+ rules.addAll(xmlRuleParser.parse(userExtensionXml));
}
return rules;
}