]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2007: Remove IsoCategory from Squid rules
authorGodin <mandrikov@gmail.com>
Fri, 3 Dec 2010 10:56:26 +0000 (10:56 +0000)
committerGodin <mandrikov@gmail.com>
Fri, 3 Dec 2010 10:56:26 +0000 (10:56 +0000)
12 files changed:
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/ArchitectureCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/CallToDeprecatedMethodCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedPrivateMethodCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedProtectedMethodCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/NoSonarCheck.java
sonar-check-api/src/main/java/org/sonar/check/Rule.java

index 230936a8f2f1eb4a7688f681892774aede27bf63..dc3cd9a9b9ff6d55173591df446b4f5ad8469c05 100644 (file)
 
 package org.sonar.java.ast.check;
 
-import java.util.Arrays;
-import java.util.List;
-
-import org.sonar.check.IsoCategory;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.java.ast.visitor.AstUtils;
 import org.sonar.squid.api.CheckMessage;
 import org.sonar.squid.api.SourceFile;
 
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import java.util.Arrays;
+import java.util.List;
 
 @Rule(
     key = "AvoidBreakOutsideSwitch",
     name = "Avoid using 'break' branching statement outside a 'switch' statement",
-    isoCategory = IsoCategory.Maintainability,
     priority = Priority.MAJOR,
     description = "<p>The use of the 'break' branching statement increases the essential complexity of the source code and "
         + "so prevents any refactoring of this source code to replace all well structured control structures with a single statement.</p>"
-        + "<p>For instance, with the following java program fragment, it's not possible to apply the 'extract method' refactoring pattern :</p>"
+        + "<p>For instance, with the following java program fragment, it's not possible to apply "
+        + "the 'extract method' refactoring pattern :</p>"
         + "<pre>"
         + "mylabel : for (int i = 0 ; i< 3; i++) {\n"
         + "  for (int j = 0; j < 4 ; j++) {\n"
index e9088b5b384c60998cfd1117605aa58c4f6eea47..6249ada3a9584b088ac9ae2c9e8c4ac857af3f99 100644 (file)
 
 package org.sonar.java.ast.check;
 
-import java.util.Arrays;
-import java.util.List;
-
-import org.sonar.check.IsoCategory;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.squid.api.CheckMessage;
 import org.sonar.squid.api.SourceCode;
 import org.sonar.squid.api.SourceFile;
 
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import java.util.Arrays;
+import java.util.List;
 
-@Rule(key = "AvoidContinueStatement", name = "Avoid using 'continue' branching statement", isoCategory = IsoCategory.Maintainability,
+@Rule(key = "AvoidContinueStatement", name = "Avoid using 'continue' branching statement",
     priority = Priority.MAJOR, description = "<p>The use of the 'continue' branching statement increase the essential complexity "
         + "of the source code and so prevent any refactoring of this source code to replace all well structured control structures "
         + "with a single statement.</p><p>For instance, in the following java program fragment, it's not possible to apply "
index b1dbeb316a29e00181f79c7538a818cbb30eb6ef..845a222cf06ddb5710e4c706dfc9febc57dd803d 100644 (file)
 
 package org.sonar.java.ast.check;
 
-import java.util.List;
-
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
 import org.apache.commons.lang.StringUtils;
 import org.sonar.api.utils.WildcardPattern;
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.check.RuleProperty;
 import org.sonar.java.PatternUtils;
 import org.sonar.java.ast.visitor.PublicApiVisitor;
-import org.sonar.squid.api.CheckMessage;
-import org.sonar.squid.api.SourceClass;
-import org.sonar.squid.api.SourceCode;
-import org.sonar.squid.api.SourceFile;
-import org.sonar.squid.api.SourceMethod;
+import org.sonar.squid.api.*;
 
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import java.util.List;
 
-@Rule(key = "UndocumentedApi", name = "Undocumented API", isoCategory = IsoCategory.Usability, priority = Priority.MAJOR,
+@Rule(key = "UndocumentedApi", name = "Undocumented API", priority = Priority.MAJOR,
     description = "<p>Check that each public class, interface, method and constructor has a Javadoc comment. "
         + "The following public methods/constructors are not concerned by this rule :</p>" + "<ul><li>Getter / Setter</li>"
         + "<li>Method with @Override annotation</li>" + "<li>Empty constructor</li></ul>")
index 34ab7d466aee3661e29a6fe95408585e842c3ac0..87a1c883579fbea2f2a177f905ff1b4108d109ed 100644 (file)
@@ -23,7 +23,6 @@ import com.google.common.collect.Maps;
 import org.apache.commons.lang.StringUtils;
 import org.sonar.api.utils.WildcardPattern;
 import org.sonar.check.Cardinality;
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.check.RuleProperty;
@@ -38,7 +37,7 @@ import org.sonar.squid.api.SourceMethod;
 import java.util.Map;
 
 @Rule(key = "ArchitecturalConstraint", name = "Architectural constraint", cardinality = Cardinality.MULTIPLE,
-    isoCategory = IsoCategory.Portability, priority = Priority.MAJOR,
+    priority = Priority.MAJOR,
     description = "<p>A source code comply to an architectural model when it fully adheres to a set of architectural constraints. " +
         "A constraint allows to deny references between classes by pattern.</p>" +
         "<p>You can for instance use this rule to :</p>" +
@@ -99,7 +98,7 @@ public class ArchitectureCheck extends BytecodeCheck {
   public void visitEdge(AsmEdge edge) {
     if (asmClass != null && edge != null) {
       String internalNameTargetClass = edge.getTargetAsmClass().getInternalName();
-      if ( !internalNames.containsKey(internalNameTargetClass)) {
+      if (!internalNames.containsKey(internalNameTargetClass)) {
         if (WildcardPattern.match(getToPatterns(), internalNameTargetClass)) {
           int sourceLineNumber = getSourceLineNumber(edge);
           logMessage(asmClass.getInternalName(), internalNameTargetClass, sourceLineNumber);
index 7c6e414ad733c10d8f488b3a94b36e0c0cbd2655..0565ad574952912a2fc1c6bbcd282ef9a898b7af 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.java.bytecode.check;
 
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.java.bytecode.asm.AsmClass;
@@ -28,8 +27,8 @@ import org.sonar.java.bytecode.asm.AsmMethod;
 import org.sonar.squid.api.CheckMessage;
 import org.sonar.squid.api.SourceFile;
 
-@Rule(key = "CallToDeprecatedMethod", name = "Avoid use of deprecated method", isoCategory = IsoCategory.Portability,
-    priority = Priority.MINOR, description = "<p>Once deprecated, a method should no longer be used as it means that "
+@Rule(key = "CallToDeprecatedMethod", name = "Avoid use of deprecated method", priority = Priority.MINOR,
+    description = "<p>Once deprecated, a method should no longer be used as it means that "
         + "the method might be removed sooner or later.</p>")
 public class CallToDeprecatedMethodCheck extends BytecodeCheck {
 
index dea958ea0d08535bab3339260eddf1b342b6986f..63c498df775d554d609811fa22030311b8769d4d 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.java.bytecode.check;
 
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.java.bytecode.asm.AsmClass;
@@ -28,7 +27,7 @@ import org.sonar.squid.api.CheckMessage;
 import org.sonar.squid.api.SourceFile;
 import org.sonar.squid.api.SourceMethod;
 
-@Rule(key = "UnusedPrivateMethod", name = "Unused private method", isoCategory = IsoCategory.Maintainability,
+@Rule(key = "UnusedPrivateMethod", name = "Unused private method",
     priority = Priority.MAJOR, description = "<p>Private methods that are never executed are dead code. " +
         "Dead code means unnecessary, inoperative code that should be removed. " +
         "This helps in maintenance by decreasing the maintained code size, " +
@@ -48,7 +47,7 @@ public class UnusedPrivateMethodCheck extends BytecodeCheck {
 
   @Override
   public void visitMethod(AsmMethod asmMethod) {
-    if ( !asmMethod.isUsed() && asmMethod.isPrivate() && !asmMethod.isDefaultConstructor() && !SerializableContract.methodMatch(asmMethod)) {
+    if (!asmMethod.isUsed() && asmMethod.isPrivate() && !asmMethod.isDefaultConstructor() && !SerializableContract.methodMatch(asmMethod)) {
       CheckMessage message = new CheckMessage(this, "Private method '" + asmMethod.getName() + "(...)' is never used.");
       SourceMethod sourceMethod = getSourceMethod(asmMethod);
       if (sourceMethod != null) {
index b64457d5a96eeaf0afeeff2e9a59546197d59881..3974734ab23702a464135be190eb863f2d7caa38 100644 (file)
@@ -19,7 +19,6 @@ w * Sonar, open source software quality management tool.
  */
 package org.sonar.java.bytecode.check;
 
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.java.bytecode.asm.AsmClass;
@@ -28,7 +27,7 @@ import org.sonar.squid.api.CheckMessage;
 import org.sonar.squid.api.SourceFile;
 import org.sonar.squid.api.SourceMethod;
 
-@Rule(key = "UnusedProtectedMethod", name = "Unused protected method", isoCategory = IsoCategory.Maintainability,
+@Rule(key = "UnusedProtectedMethod", name = "Unused protected method",
     priority = Priority.MAJOR, description = "<p>Protected methods that are never used by any classes " +
         "in the same project are strongly suspected to be dead code. "
         + "Dead code means unnecessary, inoperative code that should be removed. "
@@ -48,7 +47,7 @@ public class UnusedProtectedMethodCheck extends BytecodeCheck {
 
   @Override
   public void visitMethod(AsmMethod asmMethod) {
-    if ( !asmMethod.isUsed() && asmMethod.isProtected() && !asmClass.isAbstract() && !SerializableContract.methodMatch(asmMethod)
+    if (!asmMethod.isUsed() && asmMethod.isProtected() && !asmClass.isAbstract() && !SerializableContract.methodMatch(asmMethod)
         && !asmMethod.isInherited()) {
       CheckMessage message = new CheckMessage(this, "Protected method '" + asmMethod.getName() + "(...)' is never used.");
       SourceMethod sourceMethod = getSourceMethod(asmMethod);
index de909df1e1150b82b5c00dff54be1393207f349a..f48f6f1d69200a6d667d8b33c614fa28d7a2543c 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.sonar.java.squid.check;
 
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.check.RuleProperty;
@@ -29,7 +28,7 @@ import org.sonar.squid.api.SourceClass;
 import org.sonar.squid.api.SourceFile;
 import org.sonar.squid.measures.Metric;
 
-@Rule(key = "ClassCyclomaticComplexity", name = "Avoid too complex class", isoCategory = IsoCategory.Maintainability,
+@Rule(key = "ClassCyclomaticComplexity", name = "Avoid too complex class",
     priority = Priority.MAJOR, description = "<p>The Cyclomatic Complexity is measured by the number of (&&, ||) operators "
         + "and (if, while, do, for, ?:, catch, switch, case, return, throw) statements in the body of a class plus one for "
         + "each constructor, method (but not getter/setter), static initializer, or instance initializer in the class. "
index 692a7d05852e5cb7b83bf2df69959058169242db..347b9b3bdfbbb37eb196cdcbe7d78cc295ab4d2b 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.sonar.java.squid.check;
 
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.check.RuleProperty;
@@ -29,7 +28,7 @@ import org.sonar.squid.api.SourceClass;
 import org.sonar.squid.api.SourceFile;
 import org.sonar.squid.measures.Metric;
 
-@Rule(key = "MaximumInheritanceDepth", name = "Avoid too deep inheritance tree", isoCategory = IsoCategory.Maintainability,
+@Rule(key = "MaximumInheritanceDepth", name = "Avoid too deep inheritance tree",
     priority = Priority.MAJOR, description = "<p>Inheritance is certainly one of the most valuable concept of object-oriented "
         + "programming. It's a way to compartmentalize and reuse code by creating collections of attributes and behaviors called "
         + "classes which can be based on previously created classes. But abusing of this concept by creating a deep inheritance tree "
index 45fa620d7caa54ce0d6309a304bf1fb1f4dfa2e5..84ffe5f0b956e588f205236559335a86afaae235 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.sonar.java.squid.check;
 
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.check.RuleProperty;
@@ -29,7 +28,7 @@ import org.sonar.squid.api.SourceFile;
 import org.sonar.squid.api.SourceMethod;
 import org.sonar.squid.measures.Metric;
 
-@Rule(key = "MethodCyclomaticComplexity", name = "Avoid too complex method", isoCategory = IsoCategory.Maintainability,
+@Rule(key = "MethodCyclomaticComplexity", name = "Avoid too complex method",
     priority = Priority.MAJOR, description = "<p>The Cyclomatic Complexity is measured by the number of (&&, ||) operators "
         + "and (if, while, do, for, ?:, catch, switch, case, return, throw) statements in the body of a constructor, "
         + "method, static initializer, or instance initializer. "
index d4f3d53da946b6f7c0ae713e762c0d4ac1730a8a..dff3f4dbac3870bffed7da705f786299bfd23bde 100644 (file)
 
 package org.sonar.java.squid.check;
 
-import org.sonar.check.IsoCategory;
 import org.sonar.check.Priority;
 import org.sonar.check.Rule;
 import org.sonar.squid.api.CheckMessage;
 import org.sonar.squid.api.SourceFile;
 
-@Rule(key = "NoSonar", name = "Avoid use of //NOSONAR marker", isoCategory = IsoCategory.Reliability, priority = Priority.INFO,
+@Rule(key = "NoSonar", name = "Avoid use of //NOSONAR marker", priority = Priority.INFO,
     description = "<p>Any violation to quality rule can be deactivated with the //NOSONAR marker. This marker is pretty useful to exclude "
         + "false-positive results but sometimes it can abusively be used to hide real quality flaws.</p>"
         + "<p>This rule allows to track and/or forbid use of this marker</p>")
index 5e7d1902104d2f3d14420cbed1008e408e089938..fe99c2e1c22b3c524c0f6ac30566468bd035c323 100644 (file)
@@ -53,6 +53,8 @@ public @interface Rule {
 
   /**
    * Will probably be deprecated and replaced by tags
+   * 
+   * @deprecated since 2.5. See http://jira.codehaus.org/browse/SONAR-2007
    */
   IsoCategory isoCategory() default IsoCategory.NONE;