diff options
author | fmallet <freddy.mallet@gmail.com> | 2010-09-17 13:29:59 +0000 |
---|---|---|
committer | fmallet <freddy.mallet@gmail.com> | 2010-09-17 13:29:59 +0000 |
commit | 94cb8ef21d7425ca537a6dc0ad27c87706f28b97 (patch) | |
tree | 4a76c27a1b2d54931b12494a202618215c1658d5 | |
parent | 325aadeb23265541e1b9d54caa1c76b2d278970d (diff) | |
download | sonarqube-94cb8ef21d7425ca537a6dc0ad27c87706f28b97.tar.gz sonarqube-94cb8ef21d7425ca537a6dc0ad27c87706f28b97.zip |
fix integration test : SONAR-583-reuse-rules-config
-rw-r--r-- | plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java index 9cb7b06fb88..07741906041 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java @@ -11,6 +11,8 @@ import org.sonar.api.resources.JavaFile; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.rules.ActiveRule; +import org.sonar.api.rules.Rule; +import org.sonar.api.rules.RuleFinder; import org.sonar.api.rules.Violation; /** @@ -20,13 +22,13 @@ public class CheckstyleAuditListener implements AuditListener, BatchExtension { private final SensorContext context; private final Project project; - private final RulesProfile profile; + private final RuleFinder ruleFinder; private Resource currentResource = null; - public CheckstyleAuditListener(SensorContext context, Project project, RulesProfile profile) { + public CheckstyleAuditListener(SensorContext context, Project project, RuleFinder ruleFinder) { this.context = context; this.project = project; - this.profile = profile; + this.ruleFinder = ruleFinder; } public void auditStarted(AuditEvent event) { @@ -48,10 +50,10 @@ public class CheckstyleAuditListener implements AuditListener, BatchExtension { public void addError(AuditEvent event) { String ruleKey = getRuleKey(event); if (ruleKey != null) { - ActiveRule activeRule = profile.getActiveRule(CheckstyleConstants.REPOSITORY_KEY, ruleKey); - if (activeRule != null) { + Rule rule = ruleFinder.findByKey(CheckstyleConstants.REPOSITORY_KEY, ruleKey); + if (rule != null) { initResource(event); - Violation violation = new Violation(activeRule.getRule(), currentResource) + Violation violation = new Violation(rule, currentResource) .setLineId(getLineId(event)) .setMessage(getMessage(event)); context.saveViolation(violation); |