]> source.dussan.org Git - sonarqube.git/commitdiff
Revert hacks related to sprint on removal of Decorator
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 24 Jul 2015 14:49:07 +0000 (16:49 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 24 Jul 2015 14:49:42 +0000 (16:49 +0200)
* forbid negative effort to fix on issues
* enable VB in plugin tests

it/it-tests/src/test/java/plugins/PluginsTest.java
sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java

index 499c3b638c574970901d99007bf4d3f2fc466c06..ef69102ecb3ef194445860b22c6804217dfde65e 100644 (file)
@@ -34,6 +34,7 @@ import plugins.checks.PythonCheck;
 import plugins.checks.RpgCheck;
 import plugins.checks.SwiftCheck;
 import plugins.checks.Validation;
+import plugins.checks.VbCheck;
 import plugins.checks.WebCheck;
 
 /**
@@ -45,11 +46,8 @@ public class PluginsTest {
   /**
    * Temporarily disabled plugins. To be re-enabled.
    */
-  static final Set<String> DISABLED_PLUGINS = Sets.newHashSet("devcockpit", "views", /* FIXME */"vb");
+  static final Set<String> DISABLED_PLUGINS = Sets.newHashSet("devcockpit", "views");
 
-  /**
-   * See http://license.internal.sonarsource.com/it/
-   */
   static final Set<String> LICENSED_PLUGINS = Sets.newHashSet(
     "abap", "cobol", "cpp", "devcockpit", "objc", "pli", "plsql", "report", "rpg",
     "sqale", "swift", "vb", "vbnet", "views");
@@ -63,7 +61,7 @@ public class PluginsTest {
   // TODO new PliCheck() is temporarily disabled as PLI plugin does not support multi-language feature. See sonar-project.properties
   static final List<Check> CHECKS = Arrays.asList((Check) new AbapCheck(), new CobolCheck(), new CCheck(), new CppCheck(), new CssCheck(),
     new FlexCheck(), new GroovyCheck(), new JavaCheck(), new JavascriptCheck(), new PhpCheck(), new RpgCheck(),
-    new PythonCheck(), new SwiftCheck(), /* FIXME new VbCheck(), */ new WebCheck());
+    new PythonCheck(), new SwiftCheck(), new VbCheck(), new WebCheck());
 
   static Orchestrator orchestrator;
 
index 5cc063aba2dbe2b1fff2e93f7ca6aecd3a56ff51..f16e8d3c2e226fa09b8ca2847dc592a7b021f2b5 100644 (file)
@@ -49,6 +49,8 @@ import org.sonar.api.rule.Severity;
 import org.sonar.api.utils.Duration;
 import org.sonar.core.issue.tracking.Trackable;
 
+import static java.lang.String.format;
+
 /**
  * PLUGINS MUST NOT BE USED THIS CLASS, EXCEPT FOR UNIT TESTING.
  *
@@ -253,7 +255,7 @@ public class DefaultIssue implements Issue, Trackable {
   }
 
   public DefaultIssue setLine(@Nullable Integer l) {
-    Preconditions.checkArgument(l == null || l > 0, "Line must be null or greater than zero (got " + l + ")");
+    Preconditions.checkArgument(l == null || l > 0, format("Line must be null or greater than zero (got %d)", l));
     this.line = l;
     return this;
   }
@@ -265,14 +267,8 @@ public class DefaultIssue implements Issue, Trackable {
   }
 
   public DefaultIssue setEffortToFix(@Nullable Double d) {
-    //Preconditions.checkArgument(d == null || d >= 0, "Effort to fix must be greater than or equal 0 (got " + d + ")");
-    if (d != null) {
-      // FIXME this is temp hack while Decorator are not dropped (Comment Density common-rule is buggy as
-      // the measure comment_line_density is compute by CE)
-      this.effortToFix = Math.max(d, 0.0);
-    } else {
-      this.effortToFix = null;
-    }
+    Preconditions.checkArgument(d == null || d >= 0, format("Effort to fix must be greater than or equal 0 (got %s)", d));
+    this.effortToFix = d;
     return this;
   }