diff --git a/ecocode-rules-specifications/src/main/rules/EC34/EC34.json b/ecocode-rules-specifications/src/main/rules/EC34/EC34.json index 4191cbb71..00bc65320 100644 --- a/ecocode-rules-specifications/src/main/rules/EC34/EC34.json +++ b/ecocode-rules-specifications/src/main/rules/EC34/EC34.json @@ -1,5 +1,5 @@ { - "title": "Avoid using try-catch-finally statement", + "title": "Avoid using try-catch statement", "type": "CODE_SMELL", "status": "ready", "remediation": { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/ArrayCopyCheck.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/ArrayCopyCheck.java index 409303d70..835e39646 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/ArrayCopyCheck.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/ArrayCopyCheck.java @@ -37,11 +37,7 @@ * @author Aubay * @formatter:off */ -@Rule(key = "EC27", - name = "Developpement", - description = ArrayCopyCheck.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC27") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "GRPS0027") public class ArrayCopyCheck extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java index d95335862..6ea0cd3ba 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java @@ -15,12 +15,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC75", - name = "Developpement", - description = AvoidConcatenateStringsInLoop.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC75") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S75") public class AvoidConcatenateStringsInLoop extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidFullSQLRequest.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidFullSQLRequest.java index c73516662..de813dfde 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidFullSQLRequest.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidFullSQLRequest.java @@ -14,12 +14,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC74", - name = "Developpement", - description = AvoidFullSQLRequest.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC74") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S74") public class AvoidFullSQLRequest extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInLoop.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInLoop.java index 7317617c0..0e9806d57 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInLoop.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInLoop.java @@ -18,11 +18,7 @@ import org.sonar.plugins.java.api.tree.WhileStatementTree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule(key = "EC3", - name = "Developpement", - description = AvoidGettingSizeCollectionInLoop.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC3") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "GSCIL") public class AvoidGettingSizeCollectionInLoop extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Avoid getting the size of the collection in the loop"; diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidMultipleIfElseStatement.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidMultipleIfElseStatement.java index 5b584c342..380a059e6 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidMultipleIfElseStatement.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidMultipleIfElseStatement.java @@ -12,11 +12,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule(key = "EC2", - name = "Developpement", - description = AvoidMultipleIfElseStatement.RULE_MESSAGE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC2") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "AMIES") public class AvoidMultipleIfElseStatement extends IssuableSubscriptionVisitor { protected static final String RULE_MESSAGE = "Using a switch statement instead of multiple if-else if possible"; diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidRegexPatternNotStatic.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidRegexPatternNotStatic.java index 1020168d8..55a4299de 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidRegexPatternNotStatic.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidRegexPatternNotStatic.java @@ -16,12 +16,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC77", - name = "Developpement", - description = AvoidRegexPatternNotStatic.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC77") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S77") public class AvoidRegexPatternNotStatic extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSQLRequestInLoop.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSQLRequestInLoop.java index efea9cce8..3d3eab7a0 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSQLRequestInLoop.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSQLRequestInLoop.java @@ -14,8 +14,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule(key = "EC72", name = "Developpement", description = AvoidSQLRequestInLoop.MESSAGERULE, priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC72") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S72") public class AvoidSQLRequestInLoop extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSetConstantInBatchUpdate.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSetConstantInBatchUpdate.java index 21f332e27..49e15489d 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSetConstantInBatchUpdate.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSetConstantInBatchUpdate.java @@ -21,10 +21,7 @@ import static org.sonar.plugins.java.api.tree.Tree.Kind.MEMBER_SELECT; import static org.sonar.plugins.java.api.tree.Tree.Kind.METHOD_INVOCATION; -@Rule(key = "EC78", name = "Developpement", - description = AvoidSetConstantInBatchUpdate.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC78") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S78") public class AvoidSetConstantInBatchUpdate extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInLoopCheck.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInLoopCheck.java index 2322acfaf..b7061ab68 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInLoopCheck.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInLoopCheck.java @@ -12,11 +12,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule(key = "EC1", - name = "Developpement", - description = AvoidSpringRepositoryCallInLoopCheck.RULE_MESSAGE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC1") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "GRC1") public class AvoidSpringRepositoryCallInLoopCheck extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsageOfStaticCollections.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsageOfStaticCollections.java index 0dc3ce960..25629fc62 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsageOfStaticCollections.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsageOfStaticCollections.java @@ -14,12 +14,7 @@ import org.sonar.plugins.java.api.tree.VariableTree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC76", - name = "Developpement", - description = AvoidUsageOfStaticCollections.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC76") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S76") public class AvoidUsageOfStaticCollections extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java index 1e86ba874..9acf20922 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java @@ -12,12 +12,7 @@ import org.sonar.plugins.java.api.tree.VariableTree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC4", - name = "Developpement", - description = "

Prefer local variables to globals

", - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC4") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "D4") public class AvoidUsingGlobalVariablesCheck extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/FreeResourcesOfAutoCloseableInterface.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/FreeResourcesOfAutoCloseableInterface.java index d36cc9805..20fedf4f5 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/FreeResourcesOfAutoCloseableInterface.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/FreeResourcesOfAutoCloseableInterface.java @@ -19,12 +19,7 @@ import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC79", - name = "Developpement", - description = FreeResourcesOfAutoCloseableInterface.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC79") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S79") public class FreeResourcesOfAutoCloseableInterface extends IssuableSubscriptionVisitor { private final Deque withinTry = new LinkedList<>(); diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/IncrementCheck.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/IncrementCheck.java index 41a54c1ca..257e634b3 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/IncrementCheck.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/IncrementCheck.java @@ -10,12 +10,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC67", - name = "Developpement", - description = IncrementCheck.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC67") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S67") public class IncrementCheck extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/InitializeBufferWithAppropriateSize.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/InitializeBufferWithAppropriateSize.java index d5ee088b3..a747ba735 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/InitializeBufferWithAppropriateSize.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/InitializeBufferWithAppropriateSize.java @@ -11,12 +11,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC32", - name = "Developpement", - description = InitializeBufferWithAppropriateSize.RULE_MESSAGE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC32") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "GRSP0032") public class InitializeBufferWithAppropriateSize extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/NoFunctionCallWhenDeclaringForLoop.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/NoFunctionCallWhenDeclaringForLoop.java index 91c88106c..297941827 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/NoFunctionCallWhenDeclaringForLoop.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/NoFunctionCallWhenDeclaringForLoop.java @@ -21,8 +21,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule(key = "EC69", name = "Developpement", description = NoFunctionCallWhenDeclaringForLoop.MESSAGERULE, priority = Priority.MINOR, tags = { - "bug"}) +@Rule(key = "EC69") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S69") public class NoFunctionCallWhenDeclaringForLoop extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/OptimizeReadFileExceptions.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/OptimizeReadFileExceptions.java index d94f57676..48217a322 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/OptimizeReadFileExceptions.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/OptimizeReadFileExceptions.java @@ -16,12 +16,7 @@ import org.sonar.plugins.java.api.tree.TryStatementTree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC28", - name = "Developpement", - description = OptimizeReadFileExceptions.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC28") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "GRSP0028") public class OptimizeReadFileExceptions extends IssuableSubscriptionVisitor { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java index 3069393db..c1172b98b 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java @@ -34,8 +34,7 @@ import org.sonar.plugins.java.api.tree.VariableTree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule(key = "EC63", name = "Developpement", description = "Do not unnecessarily assign values to variables", priority = Priority.MINOR, tags = { - "bug"}) +@Rule(key = "EC63") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S63") public class UnnecessarilyAssignValuesToVariables extends BaseTreeVisitor implements JavaFileScanner { diff --git a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java index 767f3449b..aa4c056b7 100644 --- a/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java +++ b/java-plugin/src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java @@ -11,12 +11,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = "EC53", - name = "Developpement", - description = UseCorrectForLoop.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC53") @DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S53") public class UseCorrectForLoop extends IssuableSubscriptionVisitor { diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidDoubleQuoteCheck.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidDoubleQuoteCheck.java index 2fe45079c..5fc3f3f5d 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidDoubleQuoteCheck.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidDoubleQuoteCheck.java @@ -14,16 +14,10 @@ import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidDoubleQuoteCheck.RULE_KEY, - name = AvoidDoubleQuoteCheck.ERROR_MESSAGE, - description = AvoidDoubleQuoteCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC66") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S66") public class AvoidDoubleQuoteCheck extends PHPSubscriptionCheck { - public static final String RULE_KEY = "EC66"; public static final String ERROR_MESSAGE = "Avoid using double quote (\"), prefer using simple quote (')"; private static final Map> linesWithIssuesByFile = new HashMap<>(); diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidFullSQLRequestCheck.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidFullSQLRequestCheck.java index fdc016916..fc4de3429 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidFullSQLRequestCheck.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidFullSQLRequestCheck.java @@ -12,17 +12,10 @@ import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidFullSQLRequestCheck.RULE_KEY, - name = AvoidFullSQLRequestCheck.ERROR_MESSAGE, - description = AvoidFullSQLRequestCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC74") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S74") public class AvoidFullSQLRequestCheck extends PHPSubscriptionCheck { - public static final String RULE_KEY = "EC74"; - public static final String ERROR_MESSAGE = "Don't use the query SELECT * FROM"; private static final Pattern PATTERN = Pattern.compile("(?i).*select.*\\*.*from.*"); diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidSQLRequestInLoopCheck.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidSQLRequestInLoopCheck.java index 358f43008..b7ee1b2db 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidSQLRequestInLoopCheck.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidSQLRequestInLoopCheck.java @@ -18,16 +18,10 @@ import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidSQLRequestInLoopCheck.RULE_KEY, - name = AvoidSQLRequestInLoopCheck.ERROR_MESSAGE, - description = AvoidSQLRequestInLoopCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC72") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S72") public class AvoidSQLRequestInLoopCheck extends PHPSubscriptionCheck { - public static final String RULE_KEY = "EC72"; public static final String ERROR_MESSAGE = "Avoid SQL request in loop"; private static final Pattern PATTERN = Pattern.compile("(mysql(i::|_)query\\s*\\(.*)|(oci_execute\\(.*)"); diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.java index bced0aa40..8537513b0 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.java @@ -9,16 +9,10 @@ import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.RULE_KEY, - name = AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.ERROR_MESSAGE, - description = AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC34") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S34") public class AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements extends PHPSubscriptionCheck { - public static final String RULE_KEY = "EC34"; public static final String ERROR_MESSAGE = "Avoid using try-catch"; @Override diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidUsingGlobalVariablesCheck.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidUsingGlobalVariablesCheck.java index 76607760d..87b09d7b7 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidUsingGlobalVariablesCheck.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/AvoidUsingGlobalVariablesCheck.java @@ -8,16 +8,10 @@ import org.sonar.plugins.php.api.visitors.PHPVisitorCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidUsingGlobalVariablesCheck.RULE_KEY, - name = AvoidUsingGlobalVariablesCheck.ERROR_MESSAGE, - description = AvoidUsingGlobalVariablesCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC4") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "D4") public class AvoidUsingGlobalVariablesCheck extends PHPVisitorCheck { - public static final String RULE_KEY = "EC4"; public static final String ERROR_MESSAGE = "Prefer local variables to globals"; private static final Pattern PATTERN = Pattern.compile("^.*(global \\$|\\$GLOBALS).*$", Pattern.CASE_INSENSITIVE); diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/IncrementCheck.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/IncrementCheck.java index ba2c09e57..e42ace324 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/IncrementCheck.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/IncrementCheck.java @@ -29,16 +29,10 @@ import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = IncrementCheck.RULE_KEY, - name = IncrementCheck.ERROR_MESSAGE, - description = IncrementCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC67") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S67") public class IncrementCheck extends PHPSubscriptionCheck { - public static final String RULE_KEY = "EC67"; public static final String ERROR_MESSAGE = "Remove the usage of $i++. prefer ++$i"; @Override diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/NoFunctionCallWhenDeclaringForLoop.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/NoFunctionCallWhenDeclaringForLoop.java index 4381c8a12..af1282b0e 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/NoFunctionCallWhenDeclaringForLoop.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/NoFunctionCallWhenDeclaringForLoop.java @@ -14,16 +14,10 @@ import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = NoFunctionCallWhenDeclaringForLoop.RULE_KEY, - name = NoFunctionCallWhenDeclaringForLoop.ERROR_MESSAGE, - description = NoFunctionCallWhenDeclaringForLoop.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC69") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S69") public class NoFunctionCallWhenDeclaringForLoop extends PHPSubscriptionCheck { - public static final String RULE_KEY = "EC69"; public static final String ERROR_MESSAGE = "Do not call a function in for-type loop declaration"; @Override diff --git a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/UseOfMethodsForBasicOperations.java b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/UseOfMethodsForBasicOperations.java index 4af8d8d9e..8fc62ec64 100644 --- a/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/UseOfMethodsForBasicOperations.java +++ b/php-plugin/src/main/java/fr/greencodeinitiative/php/checks/UseOfMethodsForBasicOperations.java @@ -18,16 +18,10 @@ import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = UseOfMethodsForBasicOperations.RULE_KEY, - name = UseOfMethodsForBasicOperations.ERROR_MESSAGE, - description = UseOfMethodsForBasicOperations.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC22") @DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "D2") public class UseOfMethodsForBasicOperations extends PHPSubscriptionCheck { - public static final String RULE_KEY = "EC22"; protected static final String ERROR_MESSAGE = "Use of methods for basic operations"; @Override diff --git a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidFullSQLRequest.java b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidFullSQLRequest.java index 39e700245..442d1901d 100644 --- a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidFullSQLRequest.java +++ b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidFullSQLRequest.java @@ -16,17 +16,10 @@ import org.sonar.plugins.python.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidFullSQLRequest.RULE_KEY, - name = AvoidFullSQLRequest.MESSAGERULE, - description = AvoidFullSQLRequest.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC74") @DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "S74") public class AvoidFullSQLRequest extends PythonSubscriptionCheck { - public static final String RULE_KEY = "EC74"; - protected static final String MESSAGERULE = "Don't use the query SELECT * FROM"; // TODO DDC : create support to add in deployment th dependency com.google.re2j:re2j diff --git a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGettersAndSetters.java b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGettersAndSetters.java index b3aeccde1..682ac631b 100644 --- a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGettersAndSetters.java +++ b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGettersAndSetters.java @@ -18,16 +18,10 @@ import org.sonar.plugins.python.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidGettersAndSetters.RULE_KEY, - name = AvoidGettersAndSetters.DESCRIPTION, - description = AvoidGettersAndSetters.DESCRIPTION, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC7") @DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "D7") public class AvoidGettersAndSetters extends PythonSubscriptionCheck { - public static final String RULE_KEY = "EC7"; public static final String DESCRIPTION = "Avoid creating getter and setter methods in classes"; @Override diff --git a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGlobalVariableInFunctionCheck.java b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGlobalVariableInFunctionCheck.java index ef712ec35..e3e4dd8c1 100644 --- a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGlobalVariableInFunctionCheck.java +++ b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidGlobalVariableInFunctionCheck.java @@ -62,16 +62,10 @@ import org.sonar.plugins.python.api.tree.YieldStatement; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidGlobalVariableInFunctionCheck.RULE_KEY, - name = "Do not call global variables directly inside functions", - description = AvoidGlobalVariableInFunctionCheck.DESCRIPTION, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC4") @DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "D4") public class AvoidGlobalVariableInFunctionCheck extends PythonSubscriptionCheck { - public static final String RULE_KEY = "EC4"; public static final String DESCRIPTION = "Use local variable (function/class scope) instead of global variable (application scope)"; private List globalVariables; diff --git a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidSQLRequestInLoop.java b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidSQLRequestInLoop.java index 97877cf22..7e356562a 100644 --- a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidSQLRequestInLoop.java +++ b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidSQLRequestInLoop.java @@ -20,17 +20,10 @@ import org.sonar.plugins.python.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidSQLRequestInLoop.RULE_KEY, - name = "Avoid SQL request in loop", - description = AvoidSQLRequestInLoop.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC72") @DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "S72") public class AvoidSQLRequestInLoop extends PythonSubscriptionCheck { - public static final String RULE_KEY = "EC72"; - // TODO: Handle ORM lib private static final List SQL_LIBS = Arrays.asList("cx_Oracle", "mysql.connector", "psycopg2", "pymssql", "pyodbc", "sqlite3"); diff --git a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidTryCatchFinallyCheck.java b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidTryCatchFinallyCheck.java index 70197a1e3..581391b75 100644 --- a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidTryCatchFinallyCheck.java +++ b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/AvoidTryCatchFinallyCheck.java @@ -8,16 +8,10 @@ import org.sonar.plugins.python.api.tree.TryStatement; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = AvoidTryCatchFinallyCheck.RULE_KEY, - name = "Avoid using try-catch statement", - description = AvoidTryCatchFinallyCheck.DESCRIPTION, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC34") @DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "S34") public class AvoidTryCatchFinallyCheck extends PythonSubscriptionCheck { - public static final String RULE_KEY = "EC34"; public static final String DESCRIPTION = "Avoid the use of try-catch"; @Override diff --git a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/NoFunctionCallWhenDeclaringForLoop.java b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/NoFunctionCallWhenDeclaringForLoop.java index 906a43253..6a0574997 100644 --- a/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/NoFunctionCallWhenDeclaringForLoop.java +++ b/python-plugin/src/main/java/fr/greencodeinitiative/python/checks/NoFunctionCallWhenDeclaringForLoop.java @@ -7,16 +7,10 @@ import org.sonar.plugins.python.api.tree.Tree; import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; -@Rule( - key = NoFunctionCallWhenDeclaringForLoop.RULE_KEY, - name = NoFunctionCallWhenDeclaringForLoop.DESCRIPTION, - description = NoFunctionCallWhenDeclaringForLoop.DESCRIPTION, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = "EC69") @DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "S69") public class NoFunctionCallWhenDeclaringForLoop extends PythonSubscriptionCheck { - public static final String RULE_KEY = "EC69"; public static final String DESCRIPTION = "Do not call a function when declaring a for-type loop"; @Override