From 875be9f217ff37cdd6ccbd92ce8e426884a51544 Mon Sep 17 00:00:00 2001 From: jycr Date: Wed, 12 Apr 2023 05:05:41 +0200 Subject: [PATCH] green-code-initiative/ecoCode#63 - refactor: removes duplicate information about rules properties see: https://community.sonarsource.com/t/new-plugin-ecocode-requesting-inclusion-in-sonarqube-marketplace/85398/10 --- .../fr/greencodeinitiative/java/checks/ArrayCopyCheck.java | 6 +----- .../java/checks/AvoidConcatenateStringsInLoop.java | 7 +------ .../java/checks/AvoidFullSQLRequest.java | 7 +------ .../java/checks/AvoidGettingSizeCollectionInLoop.java | 6 +----- .../java/checks/AvoidMultipleIfElseStatement.java | 6 +----- .../java/checks/AvoidRegexPatternNotStatic.java | 7 +------ .../java/checks/AvoidSQLRequestInLoop.java | 3 +-- .../java/checks/AvoidSetConstantInBatchUpdate.java | 6 +----- .../java/checks/AvoidSpringRepositoryCallInLoopCheck.java | 6 +----- .../java/checks/AvoidUsageOfStaticCollections.java | 7 +------ .../java/checks/AvoidUsingGlobalVariablesCheck.java | 7 +------ .../java/checks/FreeResourcesOfAutoCloseableInterface.java | 7 +------ .../fr/greencodeinitiative/java/checks/IncrementCheck.java | 7 +------ .../java/checks/InitializeBufferWithAppropriateSize.java | 7 +------ .../java/checks/NoFunctionCallWhenDeclaringForLoop.java | 3 +-- .../java/checks/OptimizeReadFileExceptions.java | 7 +------ .../java/checks/UnnecessarilyAssignValuesToVariables.java | 3 +-- .../greencodeinitiative/java/checks/UseCorrectForLoop.java | 7 +------ .../php/checks/AvoidDoubleQuoteCheck.java | 7 +------ .../php/checks/AvoidFullSQLRequestCheck.java | 7 +------ .../php/checks/AvoidSQLRequestInLoopCheck.java | 7 +------ ...voidTryCatchFinallyCheck_NOK_failsAllTryStatements.java | 7 +------ .../php/checks/AvoidUsingGlobalVariablesCheck.java | 7 +------ .../fr/greencodeinitiative/php/checks/IncrementCheck.java | 7 +------ .../php/checks/NoFunctionCallWhenDeclaringForLoop.java | 7 +------ .../php/checks/UseOfMethodsForBasicOperations.java | 7 +------ .../python/checks/AvoidFullSQLRequest.java | 7 +------ .../python/checks/AvoidGettersAndSetters.java | 7 +------ .../python/checks/AvoidGlobalVariableInFunctionCheck.java | 7 +------ .../python/checks/AvoidSQLRequestInLoop.java | 7 +------ .../python/checks/AvoidTryCatchFinallyCheck.java | 7 +------ .../python/checks/NoFunctionCallWhenDeclaringForLoop.java | 7 +------ 32 files changed, 32 insertions(+), 175 deletions(-) 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 70cb2f6ac..bb530b722 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 @@ -36,11 +36,7 @@ * @author Aubay * @formatter:off */ -@Rule(key = "EC27", - name = "Developpement", - description = ArrayCopyCheck.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC27") public class ArrayCopyCheck extends IssuableSubscriptionVisitor { //@formatter:on 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 4e7956f5e..986136382 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 @@ -14,12 +14,7 @@ import org.sonar.plugins.java.api.tree.ExpressionTree; import org.sonar.plugins.java.api.tree.Tree; -@Rule( - key = "EC75", - name = "Developpement", - description = AvoidConcatenateStringsInLoop.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC75") public class AvoidConcatenateStringsInLoop extends IssuableSubscriptionVisitor { public static final String MESSAGE_RULE = "Don't concatenate Strings in loop, use StringBuilder instead."; 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 a870c0c4b..590d79305 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 @@ -13,12 +13,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonar.plugins.java.api.tree.Tree.Kind; -@Rule( - key = "EC74", - name = "Developpement", - description = AvoidFullSQLRequest.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC74") public class AvoidFullSQLRequest extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Don't use the query SELECT * FROM"; 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 347026806..99d02a748 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 @@ -17,11 +17,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonar.plugins.java.api.tree.WhileStatementTree; -@Rule(key = "EC3", - name = "Developpement", - description = AvoidGettingSizeCollectionInLoop.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC3") public class AvoidGettingSizeCollectionInLoop extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Avoid getting the size of the collection in the loop"; private static final MethodMatchers SIZE_METHOD = MethodMatchers.or( 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 9e724eba0..44a9af59e 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 @@ -11,11 +11,7 @@ import org.sonar.plugins.java.api.tree.StatementTree; import org.sonar.plugins.java.api.tree.Tree; -@Rule(key = "EC2", - name = "Developpement", - description = AvoidMultipleIfElseStatement.RULE_MESSAGE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC2") 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 e675e4cf1..bd0897471 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 @@ -15,12 +15,7 @@ import org.sonar.plugins.java.api.tree.MethodTree; import org.sonar.plugins.java.api.tree.Tree; -@Rule( - key = "EC77", - name = "Developpement", - description = AvoidRegexPatternNotStatic.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC77") public class AvoidRegexPatternNotStatic extends IssuableSubscriptionVisitor { public static final String MESSAGE_RULE = "Avoid using Pattern.compile() in a non-static context."; 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 d6e0ddb26..aa667bcc8 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 @@ -13,8 +13,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonar.plugins.java.api.tree.Tree.Kind; -@Rule(key = "EC72", name = "Developpement", description = AvoidSQLRequestInLoop.MESSAGERULE, priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC72") public class AvoidSQLRequestInLoop extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Avoid SQL request in loop"; 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 9b8c76086..cb0344241 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 @@ -19,11 +19,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") public class AvoidSetConstantInBatchUpdate extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Avoid setting constants in batch update"; 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 e2519cd6f..558df8e56 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 @@ -11,11 +11,7 @@ import org.sonar.plugins.java.api.tree.MethodInvocationTree; import org.sonar.plugins.java.api.tree.Tree; -@Rule(key = "EC1", - name = "Developpement", - description = AvoidSpringRepositoryCallInLoopCheck.RULE_MESSAGE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC1") public class AvoidSpringRepositoryCallInLoopCheck extends IssuableSubscriptionVisitor { protected static final String RULE_MESSAGE = "Avoid Spring repository call in loop"; 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 82592e214..399955964 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 @@ -13,12 +13,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonar.plugins.java.api.tree.VariableTree; -@Rule( - key = "EC76", - name = "Developpement", - description = AvoidUsageOfStaticCollections.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC76") public class AvoidUsageOfStaticCollections extends IssuableSubscriptionVisitor { protected static final String MESSAGE_RULE = "Avoid usage of static collections."; 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 eb064c894..0568f24ae 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 @@ -11,12 +11,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonar.plugins.java.api.tree.VariableTree; -@Rule( - key = "EC4", - name = "Developpement", - description = "

Prefer local variables to globals

", - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC4") public class AvoidUsingGlobalVariablesCheck extends IssuableSubscriptionVisitor { private static final String ERROR_MESSAGE = "Avoid using global variables"; 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 5d7509d13..353b9a170 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 @@ -18,12 +18,7 @@ import org.sonar.plugins.java.api.tree.TryStatementTree; -@Rule( - key = "EC79", - name = "Developpement", - description = FreeResourcesOfAutoCloseableInterface.MESSAGE_RULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC79") public class FreeResourcesOfAutoCloseableInterface extends IssuableSubscriptionVisitor { private final Deque withinTry = new LinkedList<>(); private final Deque> toReport = 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 8739dcaba..dd7a88a45 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 @@ -9,12 +9,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonar.plugins.java.api.tree.Tree.Kind; -@Rule( - key = "EC67", - name = "Developpement", - description = IncrementCheck.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC67") public class IncrementCheck extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Use ++i instead of i++"; 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 d9a82fc02..4a54c5c11 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 @@ -10,12 +10,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonar.plugins.java.api.tree.Tree.Kind; -@Rule( - key = "EC32", - name = "Developpement", - description = InitializeBufferWithAppropriateSize.RULE_MESSAGE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC32") public class InitializeBufferWithAppropriateSize extends IssuableSubscriptionVisitor { protected static final String RULE_MESSAGE = "Initialize StringBuilder or StringBuffer with appropriate size"; 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 fd8ec192b..c46e34ec8 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 @@ -20,8 +20,7 @@ import org.sonar.plugins.java.api.tree.PackageDeclarationTree; import org.sonar.plugins.java.api.tree.Tree; -@Rule(key = "EC69", name = "Developpement", description = NoFunctionCallWhenDeclaringForLoop.MESSAGERULE, priority = Priority.MINOR, tags = { - "bug"}) +@Rule(key = "EC69") public class NoFunctionCallWhenDeclaringForLoop extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Do not call a function when declaring a for-type loop"; 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 fa71afc46..8c6822169 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 @@ -15,12 +15,7 @@ import org.sonar.plugins.java.api.tree.Tree.Kind; import org.sonar.plugins.java.api.tree.TryStatementTree; -@Rule( - key = "EC28", - name = "Developpement", - description = OptimizeReadFileExceptions.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC28") public class OptimizeReadFileExceptions extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Optimize Read File Exceptions"; 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 70c24c8b8..cc81c01f6 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 @@ -33,8 +33,7 @@ import org.sonar.plugins.java.api.tree.UnaryExpressionTree; import org.sonar.plugins.java.api.tree.VariableTree; -@Rule(key = "EC63", name = "Developpement", description = "Do not unnecessarily assign values to variables", priority = Priority.MINOR, tags = { - "bug"}) +@Rule(key = "EC63") public class UnnecessarilyAssignValuesToVariables extends BaseTreeVisitor implements JavaFileScanner { protected static final String MESSAGERULE1 = "The variable is not assigned"; 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 46e7ad4a3..a4c6b82cb 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 @@ -10,12 +10,7 @@ import org.sonar.plugins.java.api.tree.Tree; import org.sonar.plugins.java.api.tree.Tree.Kind; -@Rule( - key = "EC53", - name = "Developpement", - description = UseCorrectForLoop.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug"}) +@Rule(key = "EC53") public class UseCorrectForLoop extends IssuableSubscriptionVisitor { protected static final String MESSAGERULE = "Avoid the use of Foreach with Arrays"; 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 e5a81ec48..81262160d 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 @@ -13,12 +13,7 @@ import org.sonar.plugins.php.api.tree.expression.LiteralTree; import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; -@Rule( - key = AvoidDoubleQuoteCheck.RULE_KEY, - name = AvoidDoubleQuoteCheck.ERROR_MESSAGE, - description = AvoidDoubleQuoteCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = AvoidDoubleQuoteCheck.RULE_KEY) public class AvoidDoubleQuoteCheck extends PHPSubscriptionCheck { public static final String RULE_KEY = "EC66"; 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 5edd93df0..bd9f7620c 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 @@ -11,12 +11,7 @@ import org.sonar.plugins.php.api.tree.expression.LiteralTree; import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; -@Rule( - key = AvoidFullSQLRequestCheck.RULE_KEY, - name = AvoidFullSQLRequestCheck.ERROR_MESSAGE, - description = AvoidFullSQLRequestCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = AvoidFullSQLRequestCheck.RULE_KEY) public class AvoidFullSQLRequestCheck extends PHPSubscriptionCheck { public static final String RULE_KEY = "EC74"; 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 91a4afad9..683a25536 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 @@ -17,12 +17,7 @@ import org.sonar.plugins.php.api.tree.statement.StatementTree; import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; -@Rule( - key = AvoidSQLRequestInLoopCheck.RULE_KEY, - name = AvoidSQLRequestInLoopCheck.ERROR_MESSAGE, - description = AvoidSQLRequestInLoopCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = AvoidSQLRequestInLoopCheck.RULE_KEY) public class AvoidSQLRequestInLoopCheck extends PHPSubscriptionCheck { public static final String RULE_KEY = "EC72"; 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 f1e340785..ab59c5eb5 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 @@ -8,12 +8,7 @@ import org.sonar.plugins.php.api.tree.Tree; import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; -@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 = AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.RULE_KEY) public class AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements extends PHPSubscriptionCheck { public static final String RULE_KEY = "EC34"; 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 53ab26716..180c8b66e 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 @@ -7,12 +7,7 @@ import org.sonar.plugins.php.api.tree.declaration.FunctionDeclarationTree; import org.sonar.plugins.php.api.visitors.PHPVisitorCheck; -@Rule( - key = AvoidUsingGlobalVariablesCheck.RULE_KEY, - name = AvoidUsingGlobalVariablesCheck.ERROR_MESSAGE, - description = AvoidUsingGlobalVariablesCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = AvoidUsingGlobalVariablesCheck.RULE_KEY) public class AvoidUsingGlobalVariablesCheck extends PHPVisitorCheck { public static final String RULE_KEY = "EC4"; 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 d89e97424..1f8a6af36 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 @@ -28,12 +28,7 @@ import org.sonar.plugins.php.api.tree.Tree.Kind; import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; -@Rule( - key = IncrementCheck.RULE_KEY, - name = IncrementCheck.ERROR_MESSAGE, - description = IncrementCheck.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = IncrementCheck.RULE_KEY) public class IncrementCheck extends PHPSubscriptionCheck { public static final String RULE_KEY = "EC67"; 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 9b75867d4..4a022e84c 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 @@ -13,12 +13,7 @@ import org.sonar.plugins.php.api.tree.statement.ForStatementTree; import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; -@Rule( - key = NoFunctionCallWhenDeclaringForLoop.RULE_KEY, - name = NoFunctionCallWhenDeclaringForLoop.ERROR_MESSAGE, - description = NoFunctionCallWhenDeclaringForLoop.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = NoFunctionCallWhenDeclaringForLoop.RULE_KEY) public class NoFunctionCallWhenDeclaringForLoop extends PHPSubscriptionCheck { public static final String RULE_KEY = "EC69"; 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 d59af2230..ab0729ece 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 @@ -17,12 +17,7 @@ import org.sonar.plugins.php.api.tree.statement.StatementTree; import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; -@Rule( - key = UseOfMethodsForBasicOperations.RULE_KEY, - name = UseOfMethodsForBasicOperations.ERROR_MESSAGE, - description = UseOfMethodsForBasicOperations.ERROR_MESSAGE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = UseOfMethodsForBasicOperations.RULE_KEY) public class UseOfMethodsForBasicOperations extends PHPSubscriptionCheck { public static final String RULE_KEY = "EC22"; 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 ba0235e6b..ab7ffb51c 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 @@ -15,12 +15,7 @@ import org.sonar.plugins.python.api.tree.StringLiteral; import org.sonar.plugins.python.api.tree.Tree; -@Rule( - key = AvoidFullSQLRequest.RULE_KEY, - name = AvoidFullSQLRequest.MESSAGERULE, - description = AvoidFullSQLRequest.MESSAGERULE, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = AvoidFullSQLRequest.RULE_KEY) public class AvoidFullSQLRequest extends PythonSubscriptionCheck { public static final String RULE_KEY = "EC74"; 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 a33565e80..37d3784b2 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 @@ -17,12 +17,7 @@ import org.sonar.plugins.python.api.tree.StatementList; import org.sonar.plugins.python.api.tree.Tree; -@Rule( - key = AvoidGettersAndSetters.RULE_KEY, - name = AvoidGettersAndSetters.DESCRIPTION, - description = AvoidGettersAndSetters.DESCRIPTION, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = AvoidGettersAndSetters.RULE_KEY) public class AvoidGettersAndSetters extends PythonSubscriptionCheck { public static final String RULE_KEY = "EC7"; 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 8203a69d3..63a457dd5 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 @@ -61,12 +61,7 @@ import org.sonar.plugins.python.api.tree.YieldExpression; import org.sonar.plugins.python.api.tree.YieldStatement; -@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 = AvoidGlobalVariableInFunctionCheck.RULE_KEY) public class AvoidGlobalVariableInFunctionCheck extends PythonSubscriptionCheck { public static final String RULE_KEY = "EC4"; 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 cd1b6e5c1..23685f9bc 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 @@ -19,12 +19,7 @@ import org.sonar.plugins.python.api.tree.QualifiedExpression; import org.sonar.plugins.python.api.tree.Tree; -@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 = AvoidSQLRequestInLoop.RULE_KEY) public class AvoidSQLRequestInLoop extends PythonSubscriptionCheck { public static final String RULE_KEY = "EC72"; 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 179650e7d..04b0e63a5 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 @@ -7,12 +7,7 @@ import org.sonar.plugins.python.api.tree.Tree; import org.sonar.plugins.python.api.tree.TryStatement; -@Rule( - key = AvoidTryCatchFinallyCheck.RULE_KEY, - name = "Avoid using try-catch-finally statement", - description = AvoidTryCatchFinallyCheck.DESCRIPTION, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = AvoidTryCatchFinallyCheck.RULE_KEY) public class AvoidTryCatchFinallyCheck extends PythonSubscriptionCheck { public static final String RULE_KEY = "EC34"; 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 d1fc56594..a24f735ef 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 @@ -6,12 +6,7 @@ import org.sonar.plugins.python.api.tree.CallExpression; import org.sonar.plugins.python.api.tree.Tree; -@Rule( - key = NoFunctionCallWhenDeclaringForLoop.RULE_KEY, - name = NoFunctionCallWhenDeclaringForLoop.DESCRIPTION, - description = NoFunctionCallWhenDeclaringForLoop.DESCRIPTION, - priority = Priority.MINOR, - tags = {"bug", "eco-design", "ecocode"}) +@Rule(key = NoFunctionCallWhenDeclaringForLoop.RULE_KEY) public class NoFunctionCallWhenDeclaringForLoop extends PythonSubscriptionCheck { public static final String RULE_KEY = "EC69";