summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-07-26 09:28:53 +0200
committerFabrice Bellingard <bellingard@gmail.com>2012-07-26 09:28:53 +0200
commitd33e0b2fb918d5a9ffd680eb826bd0b54b601c05 (patch)
tree0747748f5e9264a93db9c22c8a252226f4e81433 /plugins
parenta6d7c92a6aad53489211d394315f5b33c929b00a (diff)
downloadsonarqube-d33e0b2fb918d5a9ffd680eb826bd0b54b601c05.tar.gz
sonarqube-d33e0b2fb918d5a9ffd680eb826bd0b54b601c05.zip
Update to latest Sonar Common Rules 1.0.1
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-java-plugin/pom.xml2
-rw-r--r--plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java23
-rw-r--r--plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java3
3 files changed, 19 insertions, 9 deletions
diff --git a/plugins/sonar-java-plugin/pom.xml b/plugins/sonar-java-plugin/pom.xml
index a4c61b9c94f..a72252f6f6e 100644
--- a/plugins/sonar-java-plugin/pom.xml
+++ b/plugins/sonar-java-plugin/pom.xml
@@ -22,7 +22,7 @@
<dependency>
<groupId>org.codehaus.sonar.common-rules</groupId>
<artifactId>sonar-common-rules</artifactId>
- <version>1.0</version>
+ <version>1.0.1</version>
</dependency>
<!-- unit tests -->
diff --git a/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java b/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java
index e72d78ec3ae..0fdd3cd15ba 100644
--- a/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java
+++ b/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java
@@ -19,25 +19,32 @@
*/
package org.sonar.plugins.java;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ExtensionProvider;
-import org.sonar.api.ServerExtension;
import org.sonar.api.resources.Java;
+import org.sonar.api.resources.Project;
import org.sonar.commonrules.api.CommonRulesEngine;
+import org.sonar.commonrules.api.CommonRulesEngineProvider;
-import java.util.List;
+public class JavaCommonRulesEngineProvider extends CommonRulesEngineProvider {
-public class JavaCommonRulesEngineProvider extends ExtensionProvider implements ServerExtension, BatchExtension {
+ public JavaCommonRulesEngineProvider() {
+ super();
+ }
+
+ public JavaCommonRulesEngineProvider(Project project) {
+ super(project);
+ }
@Override
- public List provide() {
- CommonRulesEngine engine = new CommonRulesEngine(Java.KEY);
+ protected void doActivation(CommonRulesEngine engine) {
engine.activateRule("InsufficientBranchCoverage");
engine.activateRule("InsufficientCommentDensity");
engine.activateRule("DuplicatedBlocks");
engine.activateRule("InsufficientLineCoverage");
+ }
- return engine.getExtensions();
+ @Override
+ protected String getLanguageKey() {
+ return Java.KEY;
}
}
diff --git a/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java b/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java
index a82d1debfd0..b43e8eabb22 100644
--- a/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java
+++ b/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java
@@ -29,6 +29,9 @@ public class JavaCommonRulesEngineProviderTest {
public void shouldProvideExpectedExtensions() {
JavaCommonRulesEngineProvider provider = new JavaCommonRulesEngineProvider();
assertThat(provider.provide().size()).isGreaterThan(1);
+
+ provider = new JavaCommonRulesEngineProvider(null);
+ assertThat(provider.provide().size()).isGreaterThan(1);
}
}