Skip to content

Commit

Permalink
add @DeprecatedRuleKey for old rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Lmgrto committed Dec 16, 2024
1 parent 9c38044 commit 8183e2a
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "GCI66")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC66")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S66")
public class AvoidDoubleQuoteCheck extends PHPSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.regex.Pattern;

@Rule(key = "GCI74")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC74")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S74")
public class AvoidFullSQLRequestCheck extends PHPSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
import org.sonar.plugins.php.api.tree.statement.StatementTree;
import org.sonar.plugins.php.api.tree.statement.WhileStatementTree;
import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;

@Rule(key = "GCI3")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC3")
public class AvoidGettingSizeCollectionInLoopCheck extends PHPSubscriptionCheck {

public static final String ERROR_MESSAGE = "Avoid getting the size of the collection in the loop";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.sonar.plugins.php.api.tree.expression.VariableIdentifierTree;
import org.sonar.plugins.php.api.tree.statement.*;
import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

import java.util.HashMap;
import java.util.List;
Expand All @@ -41,6 +42,7 @@
* - IF and ELSEIF statements are considered as an IF statement
*/
@Rule(key = "GCI2")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC2")
public class AvoidMultipleIfElseStatementCheck extends PHPSubscriptionCheck {

public static final String ERROR_MESSAGE = "Use a switch statement instead of multiple if-else if possible";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "GCI72")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC72")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S72")
public class AvoidSQLRequestInLoopCheck extends PHPSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "GCI35")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC35")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S34")
@DeprecatedRuleKey(ruleKey = "EC34")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.regex.Pattern;

@Rule(key = "GCI4")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC4")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "D4")
public class AvoidUsingGlobalVariablesCheck extends PHPVisitorCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "GCI67")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC67")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S67")
public class IncrementCheck extends PHPSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "GCI69")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC69")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "S69")
public class NoFunctionCallWhenDeclaringForLoop extends PHPSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "GCI22")
@DeprecatedRuleKey(repositoryKey = "ecocode-php", ruleKey = "EC22")
@DeprecatedRuleKey(repositoryKey = "gci-php", ruleKey = "D2")
public class UseOfMethodsForBasicOperations extends PHPSubscriptionCheck {

Expand Down

0 comments on commit 8183e2a

Please sign in to comment.