diff --git a/README.md b/README.md index 3d1e3062..87f75659 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,3 @@ -> [!WARNING] -> Deprecation Notice -> -> We are deprecating the SonarQube Flex analyzer. -> -> Our plan is to eventually stop maintaining it ourselves, while leaving it available in Open Source, in case the community wants to take it over. -> -> Timeline: -> * August 2024: All rules are now deprecated to let users know of the change -> * January 2025: SonarQube v11 will be the last version to include the Flex analyzer -> * First half of 2025: Flex analysis will no longer be available in SonarCloud -> * First half of 2025: This repository will be archived and remain available online -> -> You'll continue to be able to build the plugin and use it in your SonarQube instance as long as it remains functional. You can also fork the repository and make changes as you see fit. -> -> Thanks to everyone for their involvement! - Code Quality and Security for Flex [![Build Status](https://travis-ci.org/SonarSource/sonar-flex.svg?branch=master)](https://travis-ci.org/SonarSource/sonar-flex) ========== @@ -26,4 +9,4 @@ Copyright 2010-2024 SonarSource. SonarQube analyzers released after November 29, 2024, including patch fixes for prior versions, are published under the [Sonar Source-Available License Version 1 (SSALv1)](LICENSE.txt). -See individual files for details that specify the license applicable to each file. Files subject to the SSALv1 will be noted in their headers. +See individual files for details that specify the license applicable to each file. Files subject to the SSALv1 will be noted in their headers. \ No newline at end of file diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.html index 07238f80..84bd395e 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Usage of statements, operators and keywords specific to ActionScript 2 does not allow to migrate to ActionScript 3. This includes "intrinsic" keyword, set variable statement and following list of operators:

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.json index 8612ef0e..6e51aa1f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ActionScript2.json @@ -7,12 +7,14 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "obsolete" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1320", "sqKey": "ActionScript2", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.html index f7f0be77..5dd91c8f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

This rule template can be used to create rules which will be triggered when a comment matches a given regular expression.

For example, one can create a rule with the regular expression .*REVIEW.* to match all comment containing "REVIEW".

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.json index 067e73be..6d3d1007 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentRegularExpression.json @@ -7,7 +7,7 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "0min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.html index 5adcb184..86475f08 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.html @@ -1,6 +1,4 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

Commented-out code distracts the focus from the actual executed code. It creates a noise that increases maintenance code. And because it is never -executed, it quickly becomes out of date and invalid.

-

Commented-out code should be deleted and can be retrieved from source control history if required.

+

Programmers should not comment out code as it bloats programs and reduces readability.

+

Unused code should be deleted and can be retrieved from source control history if required.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.json index 2ba3f183..2aa85653 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/CommentedCode.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "unused" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-125", "sqKey": "S125", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.html index 18f7939a..4313aeb4 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

The Cyclomatic Complexity of functions should not exceed a defined threshold. Complex code may perform poorly and can be difficult to test thoroughly.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.json index b03874b2..bd34cc29 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionComplexity.json @@ -7,14 +7,16 @@ }, "attribute": "FOCUSED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Linear with offset", "linearDesc": "per complexity point above the threshold", "linearOffset": "10min", "linearFactor": "1min" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1541", "sqKey": "S1541", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.html index 5c400279..c6611ef6 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

This is required by IEC 61508, under good programming style.

Noncompliant code example

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.json index 5a143fca..6b2f97cb 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/FunctionSinglePointOfExit.json @@ -7,12 +7,14 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1005", "sqKey": "S1005", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.html index 40414851..013131f8 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Scrolling horizontally to see a full line of code lowers the code readability.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.json index d58e5eaa..d9faeb16 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/LineLength.json @@ -7,12 +7,14 @@ }, "attribute": "FORMATTED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "1min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-103", "sqKey": "S103", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.html index 7771b9e4..e6d0c2f5 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

When the execution is not explicitly terminated at the end of a switch case, it continues to execute the statements of the following case. While this is sometimes intentional, it often is a mistake which leads to unexpected behavior.

@@ -49,6 +48,6 @@

Exceptions

Resources

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.json index 387e8e00..0d3c0b36 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/NonEmptyCaseWithoutBreak.json @@ -7,12 +7,15 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" }, - "tags": [], + "tags": [ + "cwe", + "suspicious" + ], "defaultSeverity": "Blocker", "ruleSpecification": "RSPEC-128", "sqKey": "S128", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.html index c977e701..ab8ed84b 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Putting multiple statements on a single line lowers the code readability and makes debugging the code more complex.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.json
index e9ab636d..b71d61b5 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/OneStatementPerLine.json
@@ -7,12 +7,14 @@
     },
     "attribute": "FORMATTED"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "1min"
   },
-  "tags": [],
+  "tags": [
+    "convention"
+  ],
   "defaultSeverity": "Major",
   "ruleSpecification": "RSPEC-122",
   "sqKey": "S122",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.html
index 77e07db0..375503a8 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

When the Flex parser fails, it is possible to record the failure as a violation on the file. This way, not only it is possible to track the number of files that do not parse but also to easily find out why they do not parse.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.json index 9369a5e4..5d4e1926 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/ParsingError.json @@ -1,12 +1,14 @@ { "title": "Flex parser failure", "type": "CODE_SMELL", - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "30min" }, - "tags": [], + "tags": [ + "suspicious" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-2260", "sqKey": "S2260", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.html index d459eeea..6352617a 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Shared naming conventions allow teams to collaborate efficiently.

This rule raises an issue when a function name does not match a provided regular expression.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.json index 773eba35..eb3460d3 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S100.json @@ -7,12 +7,14 @@ }, "attribute": "IDENTIFIABLE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-100", "sqKey": "S100", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.html index 3838808a..1fcd68bf 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Shared naming conventions allow teams to collaborate efficiently.

This rule raises an issue when a class name does not match a provided regular expression.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.json index 38d5aa46..cdca89a4 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S101.json @@ -7,12 +7,14 @@ }, "attribute": "IDENTIFIABLE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-101", "sqKey": "S101", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.html index d29a6fa0..dbe8f150 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.html @@ -1,17 +1,14 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

Nested code - blocks of code inside blocks of code - is eventually necessary, but increases complexity. This is why keeping the code as flat as -possible, by avoiding unnecessary nesting, is considered a good practice.

-

Merging if statements when possible will decrease the nesting of the code and improve its readability.

-

Code like

+

Merging collapsible if statements increases the code’s readability.

+

Noncompliant code example

 if (condition1) {
-  if (condition2) {             // Noncompliant
+  if (condition2) {             // NonCompliant
     ...
   }
 }
 
-

Is more readable as

+

Compliant solution

 if (condition1 && condition2) {
   ...
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.json
index fa3dfbfa..f6857be3 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1066.json
@@ -1,5 +1,5 @@
 {
-  "title": "Mergeable \"if\" statements should be combined",
+  "title": "Collapsible \"if\" statements should be merged",
   "type": "CODE_SMELL",
   "code": {
     "impacts": {
@@ -7,12 +7,14 @@
     },
     "attribute": "CLEAR"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "5min"
   },
-  "tags": [],
+  "tags": [
+    "clumsy"
+  ],
   "defaultSeverity": "Major",
   "ruleSpecification": "RSPEC-1066",
   "sqKey": "S1066",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.html
index 87c948b3..a50f6ed9 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.html
@@ -1,11 +1,19 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

If a private field is declared but not used locally, its limited visibility makes it dead code.

-

This is either a sign that some logic is missing or that the code should be cleaned.

-

Cleaning out dead code decreases the size of the maintained codebase, making it easier to understand and preventing bugs from being introduced.

+

If a private field is declared but not used in the program, it can be considered dead code and should therefore be removed. This will +improve maintainability because developers will not wonder what the variable is used for.

+

Noncompliant code example

+
+public class MyClass {
+  private var foo:int = 4;                       //foo is unused
+
+  public function compute(a:int):int{
+    return a * 4;
+  }
+}
+
+

Compliant solution

 public class MyClass {
-  private var foo:int = 4;  // Noncompliant: foo is unused and should be removed
 
   public function compute(a:int):int{
     return a * 4;
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.json
index 152520d6..177ec8dc 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1068.json
@@ -7,12 +7,14 @@
     },
     "attribute": "CLEAR"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "5min"
   },
-  "tags": [],
+  "tags": [
+    "unused"
+  ],
   "defaultSeverity": "Major",
   "ruleSpecification": "RSPEC-1068",
   "sqKey": "S1068",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.html
index cf3a3ed8..f7ae5242 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.html
@@ -1,6 +1,5 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

Functions with a long parameter list are difficult to use because maintainers must figure out the role of each parameter and keep track of their +

Functions with a long parameter list are difficult to use, as maintainers must figure out the role of each parameter and keep track of their position.

 function setCoordinates(var x1, var y1, var z1, var x2, var y2, var z2) { // Noncompliant
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.json
index 178e9be3..712a500c 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.json
@@ -7,12 +7,14 @@
     },
     "attribute": "FOCUSED"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "20min"
   },
-  "tags": [],
+  "tags": [
+    "brain-overload"
+  ],
   "defaultSeverity": "Major",
   "ruleSpecification": "RSPEC-107",
   "sqKey": "S107",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.html
index f0a06700..30db69f1 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

An empty code block is confusing. It will require some effort from maintainers to determine if it is intentional or indicates the implementation is incomplete.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.json index c58d7d93..a56dd449 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S108.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "suspicious" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-108", "sqKey": "S108", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.html index 09e8f809..3f2abd20 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.html @@ -1,8 +1,9 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

Empty statements represented by a semicolon ; are statements that do not perform any operation. They are often the result of a typo or -a misunderstanding of the language syntax. It is a good practice to remove empty statements since they don’t add value and lead to confusion and -errors.

+

Empty statements, i.e. ;, are usually introduced by mistake, for example because:

+
    +
  • It was meant to be replaced by an actual statement, but this was forgotten.
  • +
  • There was a typo which lead the semicolon to be doubled, i.e. ;;.
  • +

Noncompliant code example

 function doSomething():void {
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.json
index 82f0f34c..43743ed3 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.json
@@ -7,12 +7,14 @@
     },
     "attribute": "CLEAR"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "2min"
   },
-  "tags": [],
+  "tags": [
+    "unused"
+  ],
   "defaultSeverity": "Minor",
   "ruleSpecification": "RSPEC-1116",
   "sqKey": "S1116",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.html
index 6edaf852..2dff5850 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.html
@@ -1,24 +1,13 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

Shadowing occurs when a local variable has the same name as a variable or a field in an outer scope.

-

This can lead to three main problems:

-
    -
  • Confusion: The same name can refer to different variables in different parts of the scope, making the code hard to read and understand.
  • -
  • Unintended Behavior: You might accidentally use the wrong variable, leading to hard-to-detect bugs.
  • -
  • Maintenance Issues: If the inner variable is removed or renamed, the code’s behavior might change unexpectedly because the outer variable is - now being used.
  • -
-

To avoid these problems, rename the shadowing, shadowed, or both identifiers to accurately represent their purpose with unique and meaningful -names.

-

This rule focuses on variables in methods that shadow a field.

-

Noncompliant code example

+

Overriding or shadowing a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of +code. Further, it could lead maintainers to introduce bugs because they think they’re using one variable but are really using another.

 class Foo {
   public var myField:int;
 
   public function doSomething():String {
-    var myField:int = 0; // Noncompliant
-    //...
+    var myField:int = 0; /* Noncompliant */
+    ...
   }
 }
 
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.json index a785fe3d..f25aa897 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1117.json @@ -1,4 +1,5 @@ { + "title": "Local variables should not shadow class fields", "type": "CODE_SMELL", "code": { "impacts": { @@ -6,16 +7,18 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "suspicious", + "pitfall" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1117", "sqKey": "S1117", "scope": "All", - "quickfix": "unknown", - "title": "Local variables should not shadow class fields" + "quickfix": "unknown" } diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.html index 1f8d056b..e530943a 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.html @@ -1,15 +1,7 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

A boolean literal can be represented in two different ways: true or false. They can be combined with logical operators -(!, &&, ||, ==, !=) to produce logical expressions that represent truth values. However, comparing a boolean literal to a -variable or expression that evaluates to a boolean value is unnecessary and can make the code harder to read and understand. The more complex a -boolean expression is, the harder it will be for developers to understand its meaning and expected behavior, and it will favour the introduction of -new bugs.

-

How to fix it

-

Remove redundant boolean literals from expressions to improve readability and make the code more maintainable.

-

Code examples

-

Noncompliant code example

-
+

Redundant Boolean literals should be removed from expressions to improve readability.

+

Noncompliant code example

+
 if (booleanMethod() == true) { /* ... */ }
 if (booleanMethod() == false) { /* ... */ }
 if (booleanMethod() || false) { /* ... */ }
@@ -22,8 +14,8 @@ 

Noncompliant code example

booleanVariable = booleanMethod() ? exp : true; booleanVariable = booleanMethod() ? exp : false;
-

Compliant solution

-
+

Compliant solution

+
 if (booleanMethod()) { /* ... */ }
 if (!booleanMethod()) { /* ... */ }
 if (booleanMethod()) { /* ... */ }
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.json
index 474024a7..0ceb7d6b 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1125.json
@@ -7,12 +7,14 @@
     },
     "attribute": "CONVENTIONAL"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "5min"
   },
-  "tags": [],
+  "tags": [
+    "clumsy"
+  ],
   "defaultSeverity": "Minor",
   "ruleSpecification": "RSPEC-1125",
   "sqKey": "S1125",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.html
index 192358b7..88727c8e 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Having too many return statements in a function increases the function’s essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.json index 43165ff9..73238251 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1142.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1142", "sqKey": "S1142", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.html index e0167e58..dd147b72 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.html @@ -1,28 +1,25 @@ -

This rule is deprecated, and will eventually be removed.

-

This rule raises an issue when a private function is never referenced in the code.

Why is this an issue?

-

A function that is never called is dead code, and should be removed. Cleaning out dead code decreases the size of the maintained codebase, making -it easier to understand the program and preventing bugs from being introduced.

-

This rule detects functions that are never referenced from inside a translation unit, and cannot be referenced from the outside.

-

Code examples

-

Noncompliant code example

-
+

Private functions that are never executed are dead code: unnecessary, inoperative code that should be removed. Cleaning out dead code decreases the +size of the maintained codebase, making it easier to understand the program and preventing bugs from being introduced.

+

Noncompliant code example

+
 public class Foo
 {
-  public static function doSomething(): void  // Compliant - public function
+  private function Foo(){}   //Compliant, private empty constructor intentionally used to prevent any direct instantiation of a class.
+  public static function doSomething():void
   {
     var foo:Foo = new Foo();
     ...
   }
-
-  private function unusedPrivateFunction(): void {...}  // Noncompliant
+  private function unusedPrivateFunction():void {...}
 }
 
-

Compliant solution

-
+

Compliant solution

+
 public class Foo
 {
-  public static function doSomething(): void  // Compliant - public function
+  private function Foo(){}   //Compliant, private empty constructor intentionally used to prevent any direct instantiation of a class.
+  public static function doSomething():void
   {
     var foo:Foo = new Foo();
     ...
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.json
index 81100798..41e06ecc 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.json
@@ -7,12 +7,14 @@
     },
     "attribute": "CLEAR"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
-    "constantCost": "2min"
+    "constantCost": "5min"
   },
-  "tags": [],
+  "tags": [
+    "unused"
+  ],
   "defaultSeverity": "Major",
   "ruleSpecification": "RSPEC-1144",
   "sqKey": "S1144",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.html
index eb149f3c..33ba3a98 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

if statements with conditions that are always false have the effect of making blocks of code non-functional. if statements with conditions that are always true are completely redundant, and make the code less readable.

@@ -26,8 +25,8 @@

Compliant solution

Resources

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.json index c3527d48..df01dd45 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1145.json @@ -1,12 +1,14 @@ { "title": "Useless \"if(true) {...}\" and \"if(false){...}\" blocks should be removed", "type": "BUG", - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "cwe" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1145", "sqKey": "S1145", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.html index 8fe19b9a..5ce2ed8f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.html @@ -1,27 +1,12 @@ -

This rule is deprecated, and will eventually be removed.

-

Constants should be named consistently to communicate intent and improve maintainability. Rename your constants to follow your project’s naming -convention to address this issue.

Why is this an issue?

-

Constants are variables whose value does not change during the runtime of a program after initialization. Oftentimes, constants are used in -multiple locations across different subroutines.

-

It is important that the names of constants follow a consistent and easily recognizable pattern. This way, readers immediately understand that the -referenced value does not change, which simplifies debugging.

-

This rule checks that all constant names match a given regular expression.

-

What is the potential impact?

-

Ignoring the naming convention for constants makes the code less readable since constants and variables are harder to tell apart. Code that is hard -to understand is also difficult to maintain between different team members.

-

How to fix it

-

First, familiarize yourself with the particular naming convention of the project in question. Then, update the name of the constant to match the -convention, as well as all usages of the name. For many IDEs, you can use built-in renaming and refactoring features to update all usages of a -constant at once.

-

Code examples

-

Noncompliant code example

-

The following example assumes that constant names should match the default regular expression ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$:

-
+

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all constant names match a provided regular expression.

+

Noncompliant code example

+

With the default regular expression ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$:

+
 public static const first:String = "first";
 
-

Compliant solution

-
+

Compliant solution

+
 public static const FIRST:String = "first";
 
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.json index dda08bb5..e0ad5cbf 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S115.json @@ -7,12 +7,14 @@ }, "attribute": "IDENTIFIABLE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-115", "sqKey": "S115", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.html index 7a538dc5..b15e7946 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

The switch statement should be used only to clearly define some new branches in the control flow. As soon as a case clause contains too many statements this highly decreases the readability of the overall control flow statement. In such case, the content of the diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.json index ed96e5b8..93a17408 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1151.json @@ -7,12 +7,14 @@ }, "attribute": "FOCUSED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1151", "sqKey": "S1151", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.html index 02437f1c..530fc6e0 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.html @@ -1,24 +1,17 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

A naming convention in software development is a set of guidelines for naming code elements like variables, functions, and classes.

-

The goal of a naming convention is to make the code more readable and understandable, which makes it easier to maintain and debug. It also ensures -consistency in the code, especially when multiple developers are working on the same project.

-

This rule checks that field names match a provided regular expression.

-

Using the regular expression ^[_a-z][a-zA-Z0-9]*$, the noncompliant code below:

-
+

Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule allows to check that field +names match a provided regular expression.

+

Noncompliant code example

+

With the default regular expression ^[_a-z][a-zA-Z0-9]*$:

+
 class MyClass {
   public var my_field:int;
 }
 
-

Should be replaced with:

-
+

Compliant solution

+
 public class MyClass {
    public var myField:int;
 }
 
-

Resources

-

Documentation

- diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.json index 7e85ff67..df491e9f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.json @@ -7,12 +7,14 @@ }, "attribute": "IDENTIFIABLE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-116", "sqKey": "S116", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.html index aa5f25cd..12130ce7 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.html @@ -1,62 +1,21 @@ -

This rule is deprecated, and will eventually be removed.

-

Local variables and function parameters should be named consistently to communicate intent and improve maintainability. Rename your local variable -or function parameter to follow your project’s naming convention to address this issue.

Why is this an issue?

-

A naming convention in software development is a set of guidelines for naming code elements like variables, functions, and classes.
Local -variables and function parameters hold the meaning of the written code. Their names should be meaningful and follow a consistent and easily -recognizable pattern.
Adhering to a consistent naming convention helps to make the code more readable and understandable, which makes it easier to -maintain and debug. It also ensures consistency in the code, especially when multiple developers are working on the same project.

-

This rule checks that local variable and function parameter names match a provided regular expression.

-

What is the potential impact?

-

Inconsistent naming of local variables and function parameters can lead to several issues in your code:

-
    -
  • Reduced Readability: Inconsistent local variable and function parameter names make the code harder to read and understand; - consequently, it is more difficult to identify the purpose of each variable, spot errors, or comprehend the logic.
  • -
  • Difficulty in Identifying Variables: The local variables and function parameters that don’t adhere to a standard naming - convention are challenging to identify; thus, the coding process slows down, especially when dealing with a large codebase.
  • -
  • Increased Risk of Errors: Inconsistent or unclear local variable and function parameter names lead to misunderstandings about - what the variable represents. This ambiguity leads to incorrect assumptions and, consequently, bugs in the code.
  • -
  • Collaboration Difficulties: In a team setting, inconsistent naming conventions lead to confusion and miscommunication among - team members.
  • -
  • Difficulty in Code Maintenance: Inconsistent naming leads to an inconsistent codebase. The code is difficult to understand, - and making changes feels like refactoring constantly, as you face different naming methods. Ultimately, it makes the codebase harder to maintain. -
  • -
-

In summary, not adhering to a naming convention for local variables and function parameters can lead to confusion, errors, and inefficiencies, -making the code harder to read, understand, and maintain.

-

How to fix it

-

First, familiarize yourself with the particular naming convention of the project in question. Then, update the name to match the convention, as -well as all usages of the name. For many IDEs, you can use built-in renaming and refactoring features to update all usages at once.

-

Code examples

-

Noncompliant code example

+

Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when a local variable or function parameter name does +not match the provided regular expression.

+

Noncompliant code example

With the default regular expression ^[_a-z][a-zA-Z0-9]*$:

-
+
 public function doSomething(my_param:int):void
 {
   var LOCAL:int;
   ...
 }
 
-

Compliant solution

-
+

Compliant solution

+
 public function doSomething(myParam):void
 {
   var local;
   ...
 }
 
-

Resources

-

Documentation

- -

Related rules

-
    -
  • {rule:flex:S100} - Function names should comply with a naming convention
  • -
  • {rule:flex:S101} - Class names should comply with a naming convention
  • -
  • {rule:flex:S115} - Constant names should comply with a naming convention
  • -
  • {rule:flex:S116} - Field names should comply with a naming convention
  • -
  • {rule:flex:S120} - Package names should comply with a naming convention
  • -
  • {rule:flex:S1312} - Loggers should be "private static const" and should share naming convention
  • -
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.json index 5ad92771..07441e13 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S117.json @@ -7,12 +7,14 @@ }, "attribute": "IDENTIFIABLE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-117", "sqKey": "S117", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.html index 5e04b46d..cb620b12 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Making a public constant just const as opposed to static const leads to duplicating its value for every instance of the class, uselessly increasing the amount of memory required to execute the application.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.json index 34c323de..f89c1a10 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1170.json @@ -7,12 +7,14 @@ }, "attribute": "EFFICIENT" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1170", "sqKey": "S1170", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.html index 345fa086..c66751e8 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.html @@ -1,17 +1,27 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

A typical code smell known as unused function parameters refers to parameters declared in a function but not used anywhere within the function’s -body. While this might seem harmless at first glance, it can lead to confusion and potential errors in your code. Disregarding the values passed to -such parameters, the function’s behavior will be the same, but the programmer’s intention won’t be clearly expressed anymore. Therefore, removing -function parameters that are not being utilized is considered best practice.

+

Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

+

Noncompliant code example

+
+function doSomething(a:int, b:int):void      // "b" is unused
+{
+  compute(a);
+}
+
+

Compliant solution

+
+function doSomething(a:int):void
+{
+  compute(a);
+}
+

Exceptions

-

The rule ignores the following cases:

+

The following cases are ignored

  • event handlers.
  • overriding methods.
  • all methods in classes implementing one or more interfaces.
  • -
  • empty methods or methods where the body consists of a single comment or a single throw statement (i.e. where the intention is to - simulate an abstract class).
  • +
  • methods which are empty or where the body consists of a single comment or a single throw statement (i.e. where the intention is + apparently to simulate an abstract class).
 override function doSomething(a:int):void {    // ignored
@@ -41,22 +51,4 @@ 

Exceptions

trace("click"); }
-

How to fix it

-

Having unused function parameters in your code can lead to confusion and misunderstanding of a developer’s intention. They reduce code readability -and introduce the potential for errors. To avoid these problems, developers should remove unused parameters from function declarations.

-

Code examples

-

Noncompliant code example

-
-function doSomething(a:int, b:int):void      // "b" is unused
-{
-  compute(a);
-}
-
-

Compliant solution

-
-function doSomething(a:int):void
-{
-  compute(a);
-}
-
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.json index 858f6b18..f77d78eb 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "unused" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1172", "sqKey": "S1172", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.html index b3826dda..2007fe3a 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.html @@ -1,55 +1,17 @@ -

This rule is deprecated, and will eventually be removed.

-

A good API documentation is a key factor in the usability and success of a software API. It ensures that developers can effectively use, maintain, -and collaborate on the API.

Why is this an issue?

-

Undocumented APIs pose significant challenges in software development for several reasons:

-
    -
  • Lack of Clarity: developers struggling to understand how to use the API correctly. This can lead to misuse and unexpected - results.
  • -
  • Increased Development Time: developers spending extra time reading and understanding the source code, which slows down the - development process.
  • -
  • Error Prone: developers are more likely to make mistakes that lead to bugs or system crashes when the intent or the error - handling of an API is not clear.
  • -
  • Difficult Maintenance and Updates: developers may not understand the existing functionality well enough to add new features - without breaking the existing ones.
  • -
  • Poor Collaboration: collaboration, when there is lack of documentation, leads to confusion and inconsistencies.
  • -
-

It is recommended to document the API using ASDoc to clarify what is the contract of the API. This is especially important for -public APIs, as they are used by other developers.

-

Exceptions

-

Classes or class elements with an ASDoc @private comment are ignored by this rule.

+

Try to imagine using the standard Flex API without ASDoc. It would be a nightmare, because ASDoc is the only way to understand of the contract of +the API.

+

Documenting an API with ASDoc increases the productivity of the developers use it.

+

Noncompliant code example

-/**
- * @private  // This class and all its elements are ignored
- */
-public class MyClass {  // Compliant
-
-  public var myLabel:String;   // Compliant
-}
-
-public class AnotherClass {  // Noncompliant; class not @private and not documented
-
-  /**
-   * @private
-   */
-  public var name:String;  // Compliant
-}
-
-

How to fix it

-

Add the missing ASDoc for the public classes, methods, properties and metadata.

-

Code examples

-

Noncompliant code example

-
 public class MyClass {
   public var myLabel:String;
 
-  public function myMethod(param1:String):Boolean {
-    // ...
-  }
+  public function myMethod(param1:String):Boolean {...}
 }
 
-

Compliant solution

-
+

Compliant solution

+
 /**
  * my doc
  */
@@ -64,17 +26,26 @@ 

Compliant solution

* @param param1 my doc * @return my doc */ - public function myMethod(param1:String):Boolean { - // ... - } + public function myMethod(param1:String):Boolean {...} +} +
+

Exceptions

+

Classes or class elements with an ASDoc @private comment are ignored by this rule.

+
+/**
+ * @private  // This class and all its elements are ignored
+ */
+public class MyClass {  // Compliant
+
+  public var myLabel:String;   // Compliant
+}
+
+public class AnotherClass {  // Noncompliant; class not @private and not documented
+
+  /**
+   * @private
+   */
+  public var name:String;  // Compliant
 }
 
-

Resources

-

Articles & blog posts

- diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.json index c63993de..dd79dbde 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1176", "sqKey": "S1176", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.html index 09d4df8a..341dfed5 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Overriding a method just to call the same method from the super class without performing any other actions is useless and misleading.

Noncompliant code example

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.json index 9f9d7987..bb71b24e 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1185.json @@ -7,12 +7,15 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "redundant", + "clumsy" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1185", "sqKey": "S1185", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.html index 697ff806..65f4b341 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.html @@ -1,38 +1,26 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

An empty function is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty functions bring no -functionality and are misleading to others as they might think the function implementation fulfills a specific and identified requirement.

-

There are several reasons for a function not to have a body:

+

There are several reasons for a method not to have a method body:

  • It is an unintentional omission, and should be fixed to prevent an unexpected behavior in production.
  • -
  • It is not yet, or never will be, supported. In this case an exception should be thrown.
  • +
  • It is not yet, or never will be, supported. In this case an NotSupportedException should be thrown.
  • The method is an intentionally-blank override. In this case a nested comment should explain the reason for the blank override.
-

How to fix it

-

Code examples

-

Noncompliant code example

-
-public function shouldNotBeEmpty():void {  // Noncompliant - method is empty
+

Noncompliant code example

+
+public override function doSomething():void {
 }
 
-public function notImplemented():void {  // Noncompliant - method is empty
-}
-
-public override function emptyOnPurpose():void {  // Noncompliant - method is empty
+public function doSomethingElse():void {
 }
 
-

Compliant solution

-
-public function shouldNotBeEmpty():void {
-  doSomething();
-}
-
-public function notImplemented():void {
-  throw new Error("notImplemented() cannot be performed because ...");
+

Compliant solution

+
+public override function doSomething():void {
+  throw new IllegalOperationError("doSomething cannot be performed because ...");
 }
 
-public override function emptyOnPurpose():void {
-  // comment explaining why the method is empty
+public function doSomethingElse():void {
+  //This method is empty because ...
 }
 
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.json index 5e53a54b..42c07f99 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1186.json @@ -7,12 +7,14 @@ }, "attribute": "COMPLETE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "suspicious" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1186", "sqKey": "S1186", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.html index 9212c831..09358dab 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.html @@ -1,19 +1,14 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

Shared naming conventions improve readability and allow teams to collaborate efficiently. This rule checks that all package names match a provided -regular expression.

-

How to fix it

-

Rename packages with the expected naming convention

-

Code examples

-

Noncompliant code example

+

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all package names match a provided regular expression.

+

Noncompliant code example

With the default regular expression ^[a-z]+(\.[a-z][a-z0-9]*)*$:

-
+
 package org.Example {  // Noncompliant
 ...
 }
 
-

Compliant solution

-
+

Compliant solution

+
 package org.example {
 ...
 }
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.json
index 8c9eac1b..c02f4fa9 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S120.json
@@ -7,12 +7,14 @@
     },
     "attribute": "IDENTIFIABLE"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "10min"
   },
-  "tags": [],
+  "tags": [
+    "convention"
+  ],
   "defaultSeverity": "Minor",
   "ruleSpecification": "RSPEC-120",
   "sqKey": "S120",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.html
index ef2f399d..4d7d6ecf 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

A for loop stop condition should test the loop counter against an invariant value (i.e. one that is true at both the beginning and ending of every loop iteration). Ideally, this means that the stop condition is set to a local variable just before the loop begins.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.json index 4389e347..bf238f56 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S127.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" }, - "tags": [], + "tags": [ + "pitfall" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-127", "sqKey": "S127", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.html index f0591732..e8fa0fca 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

switch statements are useful when there are many different cases depending on the value of the same expression.

For just one or two cases, however, the code will be more readable with if statements.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.json index 08d0c394..86e32ef2 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1301.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "bad-practice" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1301", "sqKey": "S1301", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.html index 2ac24d77..edc9fc21 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Loggers should be:

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.json index e83b030d..f54144f7 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.json @@ -7,12 +7,14 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1312", "sqKey": "S1312", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.html index 38fe5ff6..21b8328f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.html @@ -1,4 +1,3 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    Integer literals starting with a zero are octal rather than decimal values. While using octal values is fully supported, most developers do not have experience with them. They may not recognize octal values as such, mistaking them instead for decimal values.

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.json index 62f1a676..66bbaf09 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1314.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "pitfall" + ], "defaultSeverity": "Blocker", "ruleSpecification": "RSPEC-1314", "sqKey": "S1314", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.html index 65e08c10..3f0a5013 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.html @@ -1,14 +1,9 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    -

    Nested control flow statements if, for, while, do while and switch are often key -ingredients in creating what’s known as "Spaghetti code". This code smell can make your program difficult to understand and maintain.

    -

    When numerous control structures are placed inside one another, the code becomes a tangled, complex web. This significantly reduces the code’s -readability and maintainability, and it also complicates the testing process.

    -

    How to fix it

    -

    Code examples

    -

    The following example demonstrates the behavior of the rule with the default threshold of 3 levels of nesting and one of the potential ways to fix -the code smell by introducing guard clauses:

    -

    Noncompliant code example

    +

    Nested if, for, while, do while and switch statements is a key ingredient for +making what’s known as "Spaghetti code".

    +

    Such code is hard to read, refactor and therefore maintain.

    +

    Noncompliant code example

    +

    With the default threshold of 3:

       if (condition1) {                  // Compliant - depth = 1
         /* ... */
    @@ -26,9 +21,4 @@ 

    Noncompliant code example

    } }
    -

    Resources

    - diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.json index 69b7c5a7..1497df85 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S134.json @@ -7,12 +7,14 @@ }, "attribute": "FOCUSED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-134", "sqKey": "S134", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.html index 3f84f6ce..9658520e 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.html @@ -1,4 +1,3 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    A function that grows too large tends to aggregate too many responsibilities.

    Such functions inevitably become harder to understand and therefore harder to maintain.

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.json index baec7519..5a84879c 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S138.json @@ -7,12 +7,14 @@ }, "attribute": "FOCUSED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-138", "sqKey": "S138", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.html index b1606ac8..4133785d 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.html @@ -1,4 +1,3 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    Creating a new variable with the type "Object" means that it may be used to store any kind of object. This feature may be required in some specific contexts, but it leaves the compiler unable to do any kind of type checking, and is therefore a hazardous practice.

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.json index e1c6e354..aae18fa7 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1434.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, - "tags": [], + "tags": [ + "suspicious" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1434", "sqKey": "S1434", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.html index ec7cad76..b50d2445 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.html @@ -1,4 +1,3 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    According to the ActionScript language reference, the star type:

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.json index b8415751..abe1b700 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1435.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" }, - "tags": [], + "tags": [ + "unpredictable" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1435", "sqKey": "S1435", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.html index e15f514c..8ccd1275 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.html @@ -1,4 +1,3 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    In Flex, the semicolon is optional as a statement separator, but omitting semicolons can be confusing.

    Noncompliant code example

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.json index fe82e075..5dabedda 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1438.json @@ -7,12 +7,14 @@ }, "attribute": "FORMATTED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "1min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1438", "sqKey": "S1438", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.html index 9e8d213e..eeeac44d 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.html @@ -1,4 +1,3 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    Any statement or block of statements can be identified by a label, but those labels should be used only on while, do-while and for statements. Using labels in any other context leads to unstructured, confusing code.

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.json index e38f1473..9e4f3bc9 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1439.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, - "tags": [], + "tags": [ + "pitfall" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1439", "sqKey": "S1439", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.html index 813dbd95..95403f71 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.html @@ -1,4 +1,3 @@ -

    This rule is deprecated, and will eventually be removed.

    Why is this an issue?

    The == and != operators do type coercion before comparing values. This is bad because it can mask type errors. For example, it evaluates ' \t\r\n' == 0 as true.

    diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.json index 9cedbf17..aec6d280 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1440.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "suspicious" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1440", "sqKey": "S1440", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1442.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1442.html index 3848d003..5d70db45 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1442.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1442.html @@ -11,8 +11,8 @@

    Noncompliant code example

Resources

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.html index ef89a001..6471eed4 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

There is no good reason to declare a field "public" and "static" without also declaring it "const". Most of the time this is a kludge to share a state among several objects. But with this approach, any object can do whatever it wants with the shared state, such as setting it to @@ -19,6 +18,6 @@

Compliant solution

Resources

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.json index 734c273d..9f1eed88 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1444.json @@ -7,12 +7,14 @@ }, "attribute": "MODULAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, - "tags": [], + "tags": [ + "cwe" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1444", "sqKey": "S1444", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.html index e654b88c..4d4cca15 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Even though this is syntactically correct, the void return type should not be used in the signature of a constructor. Indeed some developers might be confused by this syntax, believing that the constructor is in fact a standard function.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.json index 5de45407..757d7228 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1445.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "confusing" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1445", "sqKey": "S1445", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.html index a0e70439..12796684 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

A dynamic class defines an object that can be altered at run time by adding or changing properties and methods. This extremely powerful mechanism should be used very carefully, and only in very limited use cases.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.json index c2afa5e6..0a47e8d6 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1446.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "30min" }, - "tags": [], + "tags": [ + "pitfall" + ], "defaultSeverity": "Blocker", "ruleSpecification": "RSPEC-1446", "sqKey": "S1446", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.html index a47c2b0e..08cb4fa7 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

In ActionScript 3, constructor code is always interpreted rather than compiled by the JIT at runtime, which is why the body of a constructor should be as lightweight as possible. As soon as a constructor contains branches ("if", "for", "switch", …​) an issue is logged.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.json index e6d8398c..2433d6a2 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1447.json @@ -7,12 +7,14 @@ }, "attribute": "EFFICIENT" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "performance" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1447", "sqKey": "S1447", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.html index 73287970..94dbdbad 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.json index 2d6c32f9..fab83268 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1448.json @@ -7,12 +7,14 @@ }, "attribute": "FOCUSED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "1h" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1448", "sqKey": "S1448", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.html index 701db3ba..470269a4 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Each source file should start with a header stating file ownership and the license which must be used to distribute the application.

This rule must be fed with the header text that is expected at the beginning of every file.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.json index aedfb18c..b6b4082f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1451.json @@ -7,7 +7,7 @@ }, "attribute": "LAWFUL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.html index d864be56..b0561d41 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Using several "--" or "++" unary operators in the same arithmetic expression can quickly make the expression unreadable.

Noncompliant code example

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.json index bb18b68e..e12cafc3 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1454.json @@ -1,7 +1,7 @@ { "title": "Multiple \"++\" or \"--\" unary operators should not be used in a single arithmetic expression", "type": "BUG", - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.html index 1ec175b9..659b7a86 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Declaring the package and class together has been deprecated since ActionScript 3. The package definition should be declared outside of the class definition even if the old syntax is still supported.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.json index a3bc7548..55114c9b 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1455.json @@ -7,12 +7,14 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "obsolete" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1455", "sqKey": "S1455", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.html index 2ef8ef0c..6784971d 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Using plain string event names in even listeners is an anti-pattern; if the event is renamed, the application can start behaving unexpectedly. A constant variable should be used instead.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.json index 13885628..055634ca 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1462.json @@ -7,12 +7,14 @@ }, "attribute": "MODULAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "design" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1462", "sqKey": "S1462", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.html index 5d6285d7..6a173a10 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

According to the Flex documentation :

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.json index a442fc1c..ac6c2c3a 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1463.json @@ -7,12 +7,14 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "design" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1463", "sqKey": "S1463", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.html index 68284d9c..a9a6baac 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

The "ManagedEvents" metadata tag allows you to flag an event as being managed. By definition this "ManagedEvents" metadata tag should be used in pair with an "Event" metadata tag.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.json index e413731b..423e53ed 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1464.json @@ -7,7 +7,7 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.html index d3c18506..a608f08d 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

A LocalConnection object is used to invoke a method in another LocalConnection object, either within a single SWF file or between multiple SWF files. This kind of local connection should be authorized only when the origin (domain) of the other Flex applications is diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.json index d41b3666..aa7b4c71 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1465.json @@ -7,7 +7,7 @@ }, "attribute": "COMPLETE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.html index 026a6aa3..533b03fc 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

The Security.exactSettings value should remain set at the default value of true. Setting this value to false could make the SWF vulnerable to cross-domain attacks.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.json index 03c0a658..336ce001 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1466.json @@ -7,7 +7,7 @@ }, "attribute": "COMPLETE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.html index 30cf11f4..a10507f9 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

A listener can be attached to an object only after it has been constructed. So dispatching an event in a constructor is useless and error prone.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.json index acdd638b..8e1dc9f1 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1467.json @@ -7,7 +7,7 @@ }, "attribute": "LOGICAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.html index b84152f6..acc8ccb6 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Calling Security.allowDomain("*") lets any domain cross-script into the domain of this SWF and exercise its functionality.

Noncompliant code example

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.json index 5c65b26b..2776271f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1468.json @@ -7,7 +7,7 @@ }, "attribute": "COMPLETE" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.html index d341fb28..4fb32646 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Quoted from the Flex documentation :

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.json index 28de116b..fe4e84c2 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1469.json @@ -7,12 +7,14 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "pitfall" + ], "defaultSeverity": "Blocker", "ruleSpecification": "RSPEC-1469", "sqKey": "S1469", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.html index 4a0d94b5..9b5a357b 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Overriding Event.clone() is a required part of the API contract:

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.json index b8e4f089..c1d7df30 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1470.json @@ -7,7 +7,7 @@ }, "attribute": "LOGICAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.html index 575c1ad2..fcdefe0d 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.html @@ -1,38 +1,16 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

An unused local variable is a variable that has been declared but is not used anywhere in the block of code where it is defined. It is dead code, -contributing to unnecessary complexity and leading to confusion when reading the code. Therefore, it should be removed from your code to maintain -clarity and efficiency.

-

What is the potential impact?

-

Having unused local variables in your code can lead to several issues:

-
    -
  • Decreased Readability: Unused variables can make your code more difficult to read. They add extra lines and complexity, which - can distract from the main logic of the code.
  • -
  • Misunderstanding: When other developers read your code, they may wonder why a variable is declared but not used. This can lead - to confusion and misinterpretation of the code’s intent.
  • -
  • Potential for Bugs: If a variable is declared but not used, it might indicate a bug or incomplete code. For example, if you - declared a variable intending to use it in a calculation, but then forgot to do so, your program might not work as expected.
  • -
  • Maintenance Issues: Unused variables can make code maintenance more difficult. If a programmer sees an unused variable, they - might think it is a mistake and try to 'fix' the code, potentially introducing new bugs.
  • -
  • Memory Usage: Although modern compilers are smart enough to ignore unused variables, not all compilers do this. In such cases, - unused variables take up memory space, leading to inefficient use of resources.
  • -
-

In summary, unused local variables can make your code less readable, more confusing, and harder to maintain, and they can potentially lead to bugs -or inefficient memory use. Therefore, it is best to remove them.

-

How to fix it

-

The fix for this issue is straightforward. Once you ensure the unused variable is not part of an incomplete implementation leading to bugs, you -just need to remove it.

-

Code examples

-

Noncompliant code example

-
+

If a local variable is declared but not used, it is dead code and should be removed. Doing so will improve maintainability because developers will +not wonder what the variable is used for.

+

Noncompliant code example

+
 public function numberOfMinutes(hours:int):int
 {
-  var seconds:int = 0;  // Noncompliant - seconds is unused
+  var seconds:int = 0;  // seconds is never used
   return hours * 60;
 }
 
-

Compliant solution

-
+

Compliant solution

+
 public function numberOfMinutes(hours:int):int
 {
   return hours * 60;
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.json
index 724927fb..40449eaa 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1481.json
@@ -7,12 +7,14 @@
     },
     "attribute": "CLEAR"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "5min"
   },
-  "tags": [],
+  "tags": [
+    "unused"
+  ],
   "defaultSeverity": "Minor",
   "ruleSpecification": "RSPEC-1481",
   "sqKey": "S1481",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.html
index 89227c80..d1f41288 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Access modifiers define which classes can access properties, variables, methods, and other classes. If an access modifier is not specified, the access level defaults to internal, which grants access to all classes in the same package. This may be what is intended, but it should be diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.json index 9c067e0d..1862d30f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1784.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "2min" }, - "tags": [], + "tags": [ + "convention" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1784", "sqKey": "S1784", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.html index 37cdcc23..3e1c438a 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain, and having a lot of fields is an indication that a class has grown too large.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.json index 606ac080..b66e71c6 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.json @@ -7,12 +7,14 @@ }, "attribute": "FOCUSED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "1h" }, - "tags": [], + "tags": [ + "brain-overload" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1820", "sqKey": "S1820", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.html index 61907e1f..9b8e61cc 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Nested switch structures are difficult to understand because you can easily confuse the cases of an inner switch as belonging to an outer statement. Therefore nested switch statements should be avoided.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.json index 84dae1a2..1111a6ff 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1821.json @@ -7,12 +7,14 @@ }, "attribute": "FOCUSED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" }, - "tags": [], + "tags": [ + "pitfall" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1821", "sqKey": "S1821", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.html index 8de251d2..f8c6d786 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.html @@ -1,26 +1,7 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

-

When the same code is duplicated in two or more separate branches of a conditional, it can make the code harder to understand, maintain, and can -potentially introduce bugs if one instance of the code is changed but others are not.

Having two cases in a switch statement or two branches in an if chain with the same implementation is at best duplicate code, and at worst a coding error.

-if (a >= 0 && a < 10) {
-  doFirstThing();
-  doTheThing();
-}
-else if (a >= 10 && a < 20) {
-  doTheOtherThing();
-}
-else if (a >= 20 && a < 50) {
-  doFirstThing();
-  doTheThing();  // Noncompliant; duplicates first condition
-}
-else {
-  doTheRest();
-}
-
-
 switch (i) {
   case 1:
     doFirstThing();
@@ -37,11 +18,27 @@ 

Why is this an issue?

doTheRest(); }
+
+if (a >= 0 && a < 10) {
+  doFirstThing();
+  doTheThing();
+}
+else if (a >= 10 && a < 20) {
+  doTheOtherThing();
+}
+else if (a >= 20 && a < 50) {
+  doFirstThing();
+  doTheThing();  // Noncompliant; duplicates first condition
+}
+else {
+  doTheRest();
+}
+

If the same logic is truly needed for both instances, then:

  • in an if chain they should be combined
-
+
 if ((a >= 0 && a < 10) || (a >= 20 && a < 50)) { // Compliant
   doFirstThing();
   doTheThing();
@@ -54,9 +51,9 @@ 

Why is this an issue?

}
    -
  • for a switch, one should fall through to the other
  • +
  • for a switch, one should fall through to the other.
-
+
 switch (i) {
   case 1:
   case 3: // Compliant
@@ -77,7 +74,7 @@ 

Exceptions

switch statement that contains a single line of code with or without a following break.

 if (a == 1) {
-  doSomething();  // Compliant, usually this is done on purpose to increase the readability
+  doSomething();  //no issue, usually this is done on purpose to increase the readability
 } else if (a == 2) {
   doSomethingElse();
 } else {
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.json
index bb486ad0..94130e8b 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1871.json
@@ -7,12 +7,15 @@
     },
     "attribute": "DISTINCT"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "10min"
   },
-  "tags": [],
+  "tags": [
+    "design",
+    "suspicious"
+  ],
   "defaultSeverity": "Major",
   "ruleSpecification": "RSPEC-1871",
   "sqKey": "S1871",
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.html
index 289d8f5d..16b4bcaf 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Having multiple cases in a switch with the same condition is confusing at best. At worst, it’s a bug that is likely to induce further bugs as the code is maintained.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.json index c73735fe..249a585b 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1950.json @@ -1,7 +1,7 @@ { "title": "Cases in a \"switch\" should not have the same condition", "type": "BUG", - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "15min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1951.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1951.html index 4005119b..59df2c6b 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1951.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1951.html @@ -13,8 +13,8 @@

Compliant solution

Resources

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.html index c69c4273..2021c4cf 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

It can be expensive to instantiate a new object, and doing so inside a loop is typically an error. Instead, create the object once, before the loop.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.json index ebad26db..99ba5276 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1952.json @@ -7,12 +7,14 @@ }, "attribute": "EFFICIENT" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "performance" + ], "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1952", "sqKey": "S1952", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.html index 6b0e51a2..28974071 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

The onEnterFrame event handler is continually invoked at the frame rate of the SWF file, regardless of which individual movie frame it is set for. Having too many onEnterFrame handlers can seriously degrade performance.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.json index fecfe5ff..a59a4c47 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1982.json @@ -7,12 +7,14 @@ }, "attribute": "EFFICIENT" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, - "tags": [], + "tags": [ + "performance" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-1982", "sqKey": "S1982", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.html index 7dfd33c3..e8f55ac6 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Having all branches of a switch or if chain with the same implementation indicates a problem.

In the following code:

@@ -25,7 +24,7 @@

Why is this an issue?

doSomething(); }
-

Either there is a copy-paste error that needs fixing or an unnecessary switch or if chain that should be removed.

+

Either there is a copy-paste error that needs fixing or an unnecessary switch or if chain that needs removing.

Exceptions

This rule does not apply to if chains without else, nor to switch without a default clause.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.json
index 89361c7d..d66c5980 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.json
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.json
@@ -7,7 +7,7 @@
     },
     "attribute": "CLEAR"
   },
-  "status": "deprecated",
+  "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
     "constantCost": "15min"
diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.html
index 39f51327..456d4a09 100644
--- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.html
+++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.html
@@ -1,4 +1,3 @@
-

This rule is deprecated, and will eventually be removed.

Development tools and frameworks usually have options to make debugging easier for developers. Although these features are useful during development, they should never be enabled for applications deployed in production. Debug instructions or error messages can leak detailed information about the system, like the application’s path or file names.

@@ -24,10 +23,10 @@

Sensitive Code Example

See

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.json index 33ef0651..00308a03 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.json @@ -7,12 +7,17 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "1min" }, - "tags": [], + "tags": [ + "cwe", + "error-handling", + "debug", + "user-experience" + ], "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-4507", "sqKey": "S4507", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.html index 5e98acf5..0380b7a7 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

switch can contain a default clause for various reasons: to handle unexpected values, to show that all the cases were properly considered, etc.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.json index 4341686d..4d239071 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4524.json @@ -7,7 +7,7 @@ }, "attribute": "FORMATTED" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/Sonar_way_profile.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/Sonar_way_profile.json index a3f56ab3..c88253f4 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/Sonar_way_profile.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/Sonar_way_profile.json @@ -1,4 +1,52 @@ { "name": "Sonar way", - "ruleKeys": [] + "ruleKeys": [ + "ActionScript2", + "CommentedCode", + "NonEmptyCaseWithoutBreak", + "S100", + "S101", + "S107", + "S108", + "S115", + "S116", + "S117", + "S120", + "S127", + "S1066", + "S1068", + "S1116", + "S1117", + "S1125", + "S1144", + "S1170", + "S1172", + "S1185", + "S1186", + "S1301", + "S1434", + "S1435", + "S1439", + "S1444", + "S1445", + "S1446", + "S1447", + "S1455", + "S1462", + "S1463", + "S1464", + "S1465", + "S1466", + "S1467", + "S1468", + "S1470", + "S1481", + "S1871", + "S1952", + "S3923", + "S4507", + "S4524", + "SwitchWithoutDefault", + "WithStatement" + ] } diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.html index 105abc50..09d8e21a 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken.

@@ -35,6 +34,6 @@

Compliant solution

Resources

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.json index 10875fb7..3081f263 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/SwitchWithoutDefault.json @@ -7,12 +7,14 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [], + "tags": [ + "cwe" + ], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-131", "sqKey": "S131", diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.html index 5555de20..3f69aa95 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Never use with statements, since they decrease readability. When you do not specify a variable’s scope, you do not always know where you are setting properties, so your code can be confusing.

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.json index 3bdc15b3..893100a7 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/WithStatement.json @@ -7,7 +7,7 @@ }, "attribute": "CLEAR" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.html index 6feb2a11..6313d27d 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.html +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.html @@ -1,4 +1,3 @@ -

This rule is deprecated, and will eventually be removed.

Why is this an issue?

This rule allows the definition of custom rules using XPath expressions.

Issues are created depending on the return value of the XPath expression. If the XPath expression returns:

diff --git a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.json index 084a9a07..954a527f 100644 --- a/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.json +++ b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/XPath.json @@ -7,7 +7,7 @@ }, "attribute": "CONVENTIONAL" }, - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" diff --git a/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/AnalysisWarningsWrapper.java b/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/AnalysisWarningsWrapper.java deleted file mode 100644 index 2802af16..00000000 --- a/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/AnalysisWarningsWrapper.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube Flex Plugin - * Copyright (C) 2010-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Sonar Source-Available License for more details. - * - * You should have received a copy of the Sonar Source-Available License - * along with this program; if not, see https://sonarsource.com/license/ssal/ - */ -package org.sonar.plugins.flex; - -import javax.annotation.Nullable; -import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.scanner.ScannerSide; -import org.sonarsource.api.sonarlint.SonarLintSide; - -@ScannerSide -@SonarLintSide(lifespan = SonarLintSide.INSTANCE) -public class AnalysisWarningsWrapper { - - private final AnalysisWarnings analysisWarnings; - - /** - * This constructor is used when {@link AnalysisWarnings} is not available, e.g. SonarLint - */ - public AnalysisWarningsWrapper() { - this.analysisWarnings = null; - } - - public AnalysisWarningsWrapper(@Nullable AnalysisWarnings analysisWarnings) { - this.analysisWarnings = analysisWarnings; - } - - public void addUnique(String text) { - if (analysisWarnings != null) { - analysisWarnings.addUnique(text); - } - } -} diff --git a/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexPlugin.java b/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexPlugin.java index b9eb0520..443255f4 100644 --- a/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexPlugin.java +++ b/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexPlugin.java @@ -38,8 +38,6 @@ public void define(Context context) { FlexRulesDefinition.class, FlexProfile.class, - AnalysisWarningsWrapper.class, - PropertyDefinition.builder(FILE_SUFFIXES_KEY) .defaultValue(Flex.DEFAULT_FILE_SUFFIXES) .name("File suffixes") diff --git a/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexSquidSensor.java b/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexSquidSensor.java index 90f935f3..078e2a45 100644 --- a/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexSquidSensor.java +++ b/sonar-flex-plugin/src/main/java/org/sonar/plugins/flex/FlexSquidSensor.java @@ -67,15 +67,13 @@ public class FlexSquidSensor implements Sensor { private final SonarRuntime sonarRuntime; private final Checks checks; private final FileLinesContextFactory fileLinesContextFactory; - private final AnalysisWarningsWrapper analysisWarnings; - public FlexSquidSensor(SonarRuntime sonarRuntime, CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory, AnalysisWarningsWrapper analysisWarnings) { + public FlexSquidSensor(SonarRuntime sonarRuntime, CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory) { this.sonarRuntime = sonarRuntime; this.checks = checkFactory .create(CheckList.REPOSITORY_KEY) .addAnnotatedChecks(CheckList.getChecks()); this.fileLinesContextFactory = fileLinesContextFactory; - this.analysisWarnings = analysisWarnings; } @Override @@ -102,7 +100,6 @@ private void processesFilesIndependently(SensorDescriptor descriptor) { @Override public void execute(SensorContext context) { - analysisWarnings.addUnique("The Flex analysis has been deprecated."); FileSystem fileSystem = context.fileSystem(); FilePredicates predicates = fileSystem.predicates(); diff --git a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/AnalysisWarningsWrapperTest.java b/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/AnalysisWarningsWrapperTest.java deleted file mode 100644 index 4435da64..00000000 --- a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/AnalysisWarningsWrapperTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube Flex Plugin - * Copyright (C) 2010-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Sonar Source-Available License for more details. - * - * You should have received a copy of the Sonar Source-Available License - * along with this program; if not, see https://sonarsource.com/license/ssal/ - */ -package org.sonar.plugins.flex; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -import java.util.ArrayList; -import java.util.List; -import org.junit.jupiter.api.Test; - -class AnalysisWarningsWrapperTest { - - @Test - void test() { - List warnings = new ArrayList<>(); - AnalysisWarningsWrapper wrapper = new AnalysisWarningsWrapper(warnings::add); - wrapper.addUnique("test"); - assertThat(warnings).containsExactly("test"); - } - - @Test - void test_null() { - try { - AnalysisWarningsWrapper wrapper = new AnalysisWarningsWrapper(null); - wrapper.addUnique("test"); - } catch (Exception e) { - fail("No exception should be thrown"); - } - } -} diff --git a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexProfileTest.java b/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexProfileTest.java index 1fd3b522..642c9a31 100644 --- a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexProfileTest.java +++ b/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexProfileTest.java @@ -40,6 +40,11 @@ public void should_create_sonar_way_profile() { assertThat(profile).isNotNull(); List activeRules = profile.rules(); - assertThat(activeRules).isEmpty(); + assertThat(activeRules.size()).isGreaterThan(40); + assertThat(activeRules).extracting(BuiltInActiveRule::ruleKey) + .contains("S1871") + .contains("S101") + .doesNotContain("S1469") + .doesNotContain("S1176"); } } diff --git a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexSquidSensorTest.java b/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexSquidSensorTest.java index 44dbd3a5..7a92a2cb 100644 --- a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexSquidSensorTest.java +++ b/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexSquidSensorTest.java @@ -62,7 +62,6 @@ public class FlexSquidSensorTest { private FlexSquidSensor sensor; private SensorContextTester tester; - private TestAnalysisWarnings analysisWarnings = new TestAnalysisWarnings(); @RegisterExtension public LogTesterJUnit5 logTester = new LogTesterJUnit5(); @@ -81,7 +80,7 @@ private FlexSquidSensor createSensor(SonarRuntime sonarRuntime) { FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class); FileLinesContext fileLinesContext = mock(FileLinesContext.class); when(fileLinesContextFactory.createFor(Mockito.any(InputFile.class))).thenReturn(fileLinesContext); - sensor = new FlexSquidSensor(sonarRuntime, checkFactory, fileLinesContextFactory, analysisWarnings); + sensor = new FlexSquidSensor(sonarRuntime, checkFactory, fileLinesContextFactory); return sensor; } @@ -119,8 +118,6 @@ public void analyse() throws IOException { componentKey = "key:bom.as"; assertThat(tester.highlightingTypeAt(componentKey, 1, 0)).containsOnly(TypeOfText.COMMENT); assertThat(tester.highlightingTypeAt(componentKey, 2, 0)).containsOnly(TypeOfText.COMMENT); - - assertThat(analysisWarnings.warnings).contains("The Flex analysis has been deprecated."); } private DefaultInputFile inputFile(String fileName) throws IOException { diff --git a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/TestAnalysisWarnings.java b/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/TestAnalysisWarnings.java deleted file mode 100644 index a2d5d332..00000000 --- a/sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/TestAnalysisWarnings.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarQube Flex Plugin - * Copyright (C) 2010-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Sonar Source-Available License for more details. - * - * You should have received a copy of the Sonar Source-Available License - * along with this program; if not, see https://sonarsource.com/license/ssal/ - */ -package org.sonar.plugins.flex; - -import java.util.ArrayList; -import java.util.List; - -public class TestAnalysisWarnings extends AnalysisWarningsWrapper { - - public List warnings = new ArrayList<>(); - - @Override - public void addUnique(String text) { - warnings.add(text); - } -} diff --git a/sonarpedia.json b/sonarpedia.json index 35302879..87e00fec 100644 --- a/sonarpedia.json +++ b/sonarpedia.json @@ -3,7 +3,7 @@ "languages": [ "FLEX" ], - "latest-update": "2024-08-21T10:04:32.266152Z", + "latest-update": "2023-09-28T11:58:54.944638Z", "options": { "no-language-in-filenames": true, "preserve-filenames": true