Skip to content

Commit

Permalink
Stop using legacy keys (#1925)
Browse files Browse the repository at this point in the history
  • Loading branch information
saberduck authored Jan 21, 2020
1 parent 4fd9105 commit 8b9c1eb
Show file tree
Hide file tree
Showing 210 changed files with 98 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
import org.sonar.plugins.javascript.api.tree.expression.IdentifierTree;
import org.sonar.plugins.javascript.api.tree.expression.NewExpressionTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "ArrayAndObjectConstructors")
@Rule(key = "S1528")
@DeprecatedRuleKey(ruleKey = "ArrayAndObjectConstructors")
public class ArrayConstructorsCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Use a literal instead of the Array constructor.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
import org.sonar.plugins.javascript.api.tree.lexical.SyntaxToken;
import org.sonar.plugins.javascript.api.tree.lexical.SyntaxTrivia;
import org.sonar.plugins.javascript.api.visitors.SubscriptionVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "ConditionalComment")
@Rule(key = "S1532")
@DeprecatedRuleKey(ruleKey = "ConditionalComment")
public class ConditionalCommentCheck extends SubscriptionVisitorCheck {

private static final String MESSAGE = "Refactor your code to avoid using Internet Explorer's conditional comments.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import org.sonar.javascript.checks.annotations.JavaScriptRule;
import org.sonar.plugins.javascript.api.tree.expression.ConditionalExpressionTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "ConditionalOperator")
@Rule(key = "S1774")
@DeprecatedRuleKey(ruleKey = "ConditionalOperator")
public class ConditionalOperatorCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Convert this usage of the ternary operator to an \"if\"/\"else\" structure.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import org.sonar.javascript.checks.annotations.JavaScriptRule;
import org.sonar.plugins.javascript.api.tree.statement.ContinueStatementTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "ContinueStatement")
@Rule(key = "S909")
@DeprecatedRuleKey(ruleKey = "ContinueStatement")
public class ContinueStatementCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Remove this \"continue\" statement.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
import org.sonar.plugins.javascript.api.tree.declaration.ParameterListTree;
import org.sonar.plugins.javascript.api.tree.expression.IdentifierTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "DuplicateFunctionArgument")
@Rule(key = "S1536")
@DeprecatedRuleKey(ruleKey = "DuplicateFunctionArgument")
public class DuplicateFunctionArgumentCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Rename the duplicated function parameter \"%s\".";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
import org.sonar.plugins.javascript.api.tree.flow.FlowSimplePropertyDefinitionKeyTree;
import org.sonar.plugins.javascript.api.tree.lexical.SyntaxToken;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "DuplicatePropertyName")
@Rule(key = "S1534")
@DeprecatedRuleKey(ruleKey = "DuplicatePropertyName")
public class DuplicatePropertyNameCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Rename or remove duplicate property name '%s'.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
import org.sonar.plugins.javascript.api.tree.statement.ForObjectStatementTree;
import org.sonar.plugins.javascript.api.tree.statement.StatementTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "ForIn")
@Rule(key = "S1535")
@DeprecatedRuleKey(ruleKey = "ForIn")
public class ForInCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Restrict what this loop acts on by testing each property.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
import org.sonar.plugins.javascript.api.tree.lexical.SyntaxToken;
import org.sonar.plugins.javascript.api.tree.lexical.SyntaxTrivia;
import org.sonar.plugins.javascript.api.visitors.SubscriptionVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "HtmlComments")
@Rule(key = "S1531")
@DeprecatedRuleKey(ruleKey = "HtmlComments")
public class HtmlCommentsCheck extends SubscriptionVisitorCheck {

private static final String MESSAGE = "Replace this HTML-style comment by a standard comment";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import org.sonar.javascript.checks.annotations.JavaScriptRule;
import org.sonar.plugins.javascript.api.tree.expression.FunctionExpressionTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "NamedFunctionExpression")
@Rule(key = "S1517")
@DeprecatedRuleKey(ruleKey = "NamedFunctionExpression")
public class NamedFunctionExpressionCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Make this function anonymous by removing its name: 'function() {...}'.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import org.sonar.plugins.javascript.api.tree.Tree;
import org.sonar.plugins.javascript.api.tree.expression.LiteralTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "OctalNumber")
@Rule(key = "S1314")
@DeprecatedRuleKey(ruleKey = "OctalNumber")
public class OctalNumberCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Replace the value of the octal number (%s) by its decimal equivalent (%s).";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
import org.sonar.javascript.checks.annotations.JavaScriptRule;
import org.sonar.javascript.checks.annotations.TypeScriptRule;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@TypeScriptRule
@Rule(key = "ParsingError")
@Rule(key = "S2260")
@DeprecatedRuleKey(ruleKey = "ParsingError")
public class ParsingErrorCheck extends DoubleDispatchVisitorCheck {

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
import org.sonar.plugins.javascript.api.tree.statement.SwitchClauseTree;
import org.sonar.plugins.javascript.api.tree.statement.SwitchStatementTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "SwitchWithoutDefault")
@Rule(key = "S131")
@DeprecatedRuleKey(ruleKey = "SwitchWithoutDefault")
public class SwitchWithoutDefaultCheck extends DoubleDispatchVisitorCheck {

private static final String ADD_DEFAULT_MESSAGE = "Add a \"default\" clause to this \"switch\" statement.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonar.plugins.javascript.api.visitors.IssueLocation;
import org.sonar.plugins.javascript.api.visitors.PreciseIssue;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "TooManyBreakOrContinueInLoop")
@Rule(key = "S135")
@DeprecatedRuleKey(ruleKey = "TooManyBreakOrContinueInLoop")
public class TooManyBreakOrContinueInLoopCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Reduce the total number of \"break\" and \"continue\" statements in this loop to use one at most.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import org.sonar.plugins.javascript.api.tree.expression.ArrayLiteralTree;
import org.sonar.plugins.javascript.api.tree.expression.ObjectLiteralTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

/**
* http://stackoverflow.com/questions/7246618/trailing-commas-in-javascript
*/
@JavaScriptRule
@Rule(key = "TrailingComma")
@Rule(key = "S1537")
@DeprecatedRuleKey(ruleKey = "TrailingComma")
public class TrailingCommaCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Remove this trailing comma.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
import org.sonar.plugins.javascript.api.tree.lexical.SyntaxToken;
import org.sonar.plugins.javascript.api.tree.lexical.SyntaxTrivia;
import org.sonar.plugins.javascript.api.visitors.SubscriptionVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "TrailingComment")
@Rule(key = "S139")
@DeprecatedRuleKey(ruleKey = "TrailingComment")
public class TrailingCommentCheck extends SubscriptionVisitorCheck {

private static final String MESSAGE = "Move this trailing comment on the previous empty line.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
import org.sonar.plugins.javascript.api.visitors.JavaScriptFile;
import org.sonar.plugins.javascript.api.visitors.LineIssue;
import org.sonar.plugins.javascript.api.visitors.SubscriptionVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "TrailingWhitespace")
@Rule(key = "S1131")
@DeprecatedRuleKey(ruleKey = "TrailingWhitespace")
public class TrailingWhitespaceCheck extends SubscriptionVisitorCheck {

private static final String MESSAGE = "Remove the useless trailing whitespaces at the end of this line.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
import org.sonar.plugins.javascript.api.tree.statement.VariableDeclarationTree;
import org.sonar.plugins.javascript.api.visitors.PreciseIssue;
import org.sonar.plugins.javascript.api.visitors.SubscriptionVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "UnreachableCode")
@Rule(key = "S1736")
@DeprecatedRuleKey(ruleKey = "UnreachableCode")
public class UnreachableCodeCheck extends SubscriptionVisitorCheck {

private static final String MESSAGE = "Remove this code after the \"%s\" statement.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import org.sonar.javascript.checks.annotations.JavaScriptRule;
import org.sonar.plugins.javascript.api.tree.statement.WithStatementTree;
import org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@JavaScriptRule
@Rule(key = "WithStatement")
@Rule(key = "S1321")
@DeprecatedRuleKey(ruleKey = "WithStatement")
public class WithStatementCheck extends DoubleDispatchVisitorCheck {

private static final String MESSAGE = "Remove this use of \"with\".";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1131",
"sqKey": "TrailingWhitespace",
"sqKey": "S1131",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Critical",
"ruleSpecification": "RSPEC-131",
"sqKey": "SwitchWithoutDefault",
"sqKey": "S131",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1314",
"sqKey": "OctalNumber",
"sqKey": "S1314",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1321",
"sqKey": "WithStatement",
"sqKey": "S1321",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-135",
"sqKey": "TooManyBreakOrContinueInLoop",
"sqKey": "S135",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-139",
"sqKey": "TrailingComment",
"sqKey": "S139",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1517",
"sqKey": "NamedFunctionExpression",
"sqKey": "S1517",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1528",
"sqKey": "ArrayAndObjectConstructors",
"sqKey": "S1528",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1531",
"sqKey": "HtmlComments",
"sqKey": "S1531",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Critical",
"ruleSpecification": "RSPEC-1532",
"sqKey": "ConditionalComment",
"sqKey": "S1532",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1534",
"sqKey": "DuplicatePropertyName",
"sqKey": "S1534",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1535",
"sqKey": "ForIn",
"sqKey": "S1535",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1536",
"sqKey": "DuplicateFunctionArgument",
"sqKey": "S1536",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1537",
"sqKey": "TrailingComma",
"sqKey": "S1537",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1763",
"sqKey": "UnreachableCode",
"sqKey": "S1736",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1774",
"sqKey": "ConditionalOperator",
"sqKey": "S1774",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-2260",
"sqKey": "ParsingError",
"sqKey": "S2260",
"compatibleLanguages": [
"JAVASCRIPT",
"TYPESCRIPT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-909",
"sqKey": "ContinueStatement",
"sqKey": "S909",
"compatibleLanguages": [
"JAVASCRIPT"
],
Expand Down
Loading

0 comments on commit 8b9c1eb

Please sign in to comment.