From 005476cddc54a18b78eca55d10338702eb31e4b0 Mon Sep 17 00:00:00 2001 From: Yassin Kammoun <52890329+yassin-kammoun-sonarsource@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:23:28 +0100 Subject: [PATCH] SONARFLEX-187 Update rule metadata (#197) --- .../l10n/flex/rules/flex/CommentedCode.html | 5 +- .../rules/flex/NonEmptyCaseWithoutBreak.html | 2 +- .../rules/flex/NonEmptyCaseWithoutBreak.json | 2 +- .../l10n/flex/rules/flex/ParsingError.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1066.html | 10 ++- .../org/sonar/l10n/flex/rules/flex/S1066.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1068.html | 17 +--- .../org/sonar/l10n/flex/rules/flex/S107.html | 2 +- .../org/sonar/l10n/flex/rules/flex/S1116.html | 8 +- .../org/sonar/l10n/flex/rules/flex/S1117.html | 18 +++- .../org/sonar/l10n/flex/rules/flex/S1117.json | 4 +- .../org/sonar/l10n/flex/rules/flex/S1125.html | 17 ++-- .../org/sonar/l10n/flex/rules/flex/S1144.html | 24 +++--- .../org/sonar/l10n/flex/rules/flex/S1144.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1145.html | 6 +- .../org/sonar/l10n/flex/rules/flex/S115.html | 26 ++++-- .../org/sonar/l10n/flex/rules/flex/S116.html | 20 +++-- .../org/sonar/l10n/flex/rules/flex/S117.html | 52 ++++++++++-- .../org/sonar/l10n/flex/rules/flex/S1172.html | 43 ++++++---- .../org/sonar/l10n/flex/rules/flex/S1176.html | 82 +++++++++++++------ .../org/sonar/l10n/flex/rules/flex/S1186.html | 35 +++++--- .../org/sonar/l10n/flex/rules/flex/S1186.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S120.html | 14 ++-- .../org/sonar/l10n/flex/rules/flex/S1312.json | 3 +- .../org/sonar/l10n/flex/rules/flex/S1314.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S134.html | 19 +++-- .../org/sonar/l10n/flex/rules/flex/S1442.html | 6 +- .../org/sonar/l10n/flex/rules/flex/S1444.html | 2 +- .../org/sonar/l10n/flex/rules/flex/S1446.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1448.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1451.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1466.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1468.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1469.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1481.html | 35 ++++++-- .../org/sonar/l10n/flex/rules/flex/S1820.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1871.html | 42 +++++----- .../org/sonar/l10n/flex/rules/flex/S1871.json | 2 +- .../org/sonar/l10n/flex/rules/flex/S1951.html | 6 +- .../org/sonar/l10n/flex/rules/flex/S3923.html | 2 +- .../org/sonar/l10n/flex/rules/flex/S4507.html | 10 +-- .../flex/rules/flex/SwitchWithoutDefault.html | 2 +- sonarpedia.json | 2 +- 43 files changed, 348 insertions(+), 194 deletions(-) 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 86475f08..0d83de02 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,4 +1,5 @@

Why is this an issue?

-

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.

+

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.

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 e6d0c2f5..ffde3577 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 @@ -48,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 0d3c0b36..3b3cc28e 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 @@ -3,7 +3,7 @@ "type": "CODE_SMELL", "code": { "impacts": { - "MAINTAINABILITY": "HIGH" + "MAINTAINABILITY": "BLOCKER" }, "attribute": "CLEAR" }, 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 5d4e1926..ae84248f 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 @@ -13,5 +13,5 @@ "ruleSpecification": "RSPEC-2260", "sqKey": "S2260", "scope": "All", - "quickfix": "unknown" + "quickfix": "infeasible" } 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 dbe8f150..b3b84450 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,14 +1,16 @@

Why is this an issue?

-

Merging collapsible if statements increases the code’s readability.

-

Noncompliant code example

+

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

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

Compliant solution

+

Is more readable as

 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 f6857be3..732a6ea9 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": "Collapsible \"if\" statements should be merged",
+  "title": "Mergeable \"if\" statements should be combined",
   "type": "CODE_SMELL",
   "code": {
     "impacts": {
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 a50f6ed9..aecba307 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,19 +1,10 @@
 

Why is this an issue?

-

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

+

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.

 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/S107.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S107.html
index f7ae5242..031b131e 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,5 +1,5 @@
 

Why is this an issue?

-

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 +

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 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/S1116.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1116.html
index 3f2abd20..34829829 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,9 +1,7 @@
 

Why is this an issue?

-

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. ;;.
  • -
+

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.

Noncompliant code example

 function doSomething():void {
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 2dff5850..be8574c2 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,13 +1,23 @@
 

Why is this an issue?

-

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.

+

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

 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 f25aa897..11887dd5 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,5 +1,4 @@ { - "title": "Local variables should not shadow class fields", "type": "CODE_SMELL", "code": { "impacts": { @@ -20,5 +19,6 @@ "ruleSpecification": "RSPEC-1117", "sqKey": "S1117", "scope": "All", - "quickfix": "unknown" + "quickfix": "unknown", + "title": "Local variables should not shadow class fields" } 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 e530943a..d06a9af1 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,7 +1,14 @@

Why is this an issue?

-

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

-

Noncompliant code example

-
+

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

+
 if (booleanMethod() == true) { /* ... */ }
 if (booleanMethod() == false) { /* ... */ }
 if (booleanMethod() || false) { /* ... */ }
@@ -14,8 +21,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/S1144.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1144.html
index dd147b72..ac2a18c9 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,25 +1,27 @@
+

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

Why is this an issue?

-

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

-
+

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

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

Compliant solution

-
+

Compliant solution

+
 public class Foo
 {
-  private function Foo(){}   //Compliant, private empty constructor intentionally used to prevent any direct instantiation of a class.
-  public static function doSomething():void
+  public static function doSomething(): void  // Compliant - public function
   {
     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 41e06ecc..6c901275 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
@@ -10,7 +10,7 @@
   "status": "ready",
   "remediation": {
     "func": "Constant\/Issue",
-    "constantCost": "5min"
+    "constantCost": "2min"
   },
   "tags": [
     "unused"
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 33ba3a98..10fcf894 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
@@ -25,8 +25,8 @@ 

Compliant solution

Resources

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 5ce2ed8f..82346a08 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,12 +1,26 @@ +

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?

-

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]+)*$:

-
+

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]+)*$:

+
 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/S116.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S116.html index 530fc6e0..bc75bb56 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,17 +1,23 @@

Why is this an issue?

-

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]*$:

-
+

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:

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

Compliant solution

-
+

Should be replaced with:

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

Resources

+

Documentation

+ 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 12130ce7..2c9e51e6 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,21 +1,61 @@ +

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?

-

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

+

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

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/S1172.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1172.html index c66751e8..23f90377 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,27 +1,16 @@

Why is this an issue?

-

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);
-}
-
+

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.

Exceptions

-

The following cases are ignored

+

The rule ignores the following cases:

  • event handlers.
  • overriding methods.
  • all methods in classes implementing one or more interfaces.
  • -
  • 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).
  • +
  • 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).
 override function doSomething(a:int):void {    // ignored
@@ -51,4 +40,22 @@ 

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/S1176.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1176.html index 2007fe3a..4c8135b7 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,17 +1,54 @@ +

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?

-

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

+

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.

+/**
+ * @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
  */
@@ -26,26 +63,17 @@ 

Compliant solution

* @param param1 my doc * @return my doc */ - 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
+  public function myMethod(param1:String):Boolean {
+    // ...
+  }
 }
 
+

Resources

+

Articles & blog posts

+ 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 65f4b341..3b2a1dfb 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,26 +1,37 @@

Why is this an issue?

-

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

+

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:

  • 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 NotSupportedException should be thrown.
  • +
  • It is not yet, or never will be, supported. In this case an exception should be thrown.
  • The method is an intentionally-blank override. In this case a nested comment should explain the reason for the blank override.
-

Noncompliant code example

-
-public override function doSomething():void {
+

How to fix it

+

Code examples

+

Noncompliant code example

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

Compliant solution

-
-public override function doSomething():void {
-  throw new IllegalOperationError("doSomething cannot be performed because ...");
+

Compliant solution

+
+public function shouldNotBeEmpty():void {
+  doSomething();
+}
+
+public function notImplemented():void {
+  throw new Error("notImplemented() cannot be performed because ...");
 }
 
-public function doSomethingElse():void {
-  //This method is empty because ...
+public override function emptyOnPurpose():void {
+  // comment explaining why the method is empty
 }
 
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 42c07f99..ab7982da 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 @@ -19,5 +19,5 @@ "ruleSpecification": "RSPEC-1186", "sqKey": "S1186", "scope": "All", - "quickfix": "unknown" + "quickfix": "infeasible" } 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 09358dab..9e5999e0 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,14 +1,18 @@

Why is this an issue?

-

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

-

Noncompliant code example

+

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

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/S1312.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1312.json
index f54144f7..0dfb3be7 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
@@ -13,7 +13,8 @@
     "constantCost": "5min"
   },
   "tags": [
-    "convention"
+    "convention",
+    "logging"
   ],
   "defaultSeverity": "Minor",
   "ruleSpecification": "RSPEC-1312",
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 66bbaf09..d7557e6e 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
@@ -3,7 +3,7 @@
   "type": "CODE_SMELL",
   "code": {
     "impacts": {
-      "MAINTAINABILITY": "HIGH"
+      "MAINTAINABILITY": "BLOCKER"
     },
     "attribute": "CLEAR"
   },
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 3f0a5013..64a67ff3 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,9 +1,13 @@
 

Why is this an issue?

-

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:

+

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

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

Noncompliant code example

} }
+

Resources

+ 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 5d70db45..3848d003 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 6471eed4..5d27facb 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 @@ -18,6 +18,6 @@

Compliant solution

Resources

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 0a47e8d6..38703fef 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 @@ -3,7 +3,7 @@ "type": "CODE_SMELL", "code": { "impacts": { - "MAINTAINABILITY": "HIGH" + "MAINTAINABILITY": "BLOCKER" }, "attribute": "CLEAR" }, 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 fab83268..6cda1e1c 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 @@ -19,5 +19,5 @@ "ruleSpecification": "RSPEC-1448", "sqKey": "S1448", "scope": "Main", - "quickfix": "unknown" + "quickfix": "infeasible" } 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 b6b4082f..2ce43510 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 @@ -3,7 +3,7 @@ "type": "CODE_SMELL", "code": { "impacts": { - "MAINTAINABILITY": "HIGH" + "MAINTAINABILITY": "BLOCKER" }, "attribute": "LAWFUL" }, 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 336ce001..f373e3f6 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 @@ -3,7 +3,7 @@ "type": "VULNERABILITY", "code": { "impacts": { - "SECURITY": "HIGH" + "SECURITY": "BLOCKER" }, "attribute": "COMPLETE" }, 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 2776271f..056185a0 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 @@ -3,7 +3,7 @@ "type": "VULNERABILITY", "code": { "impacts": { - "SECURITY": "HIGH" + "SECURITY": "BLOCKER" }, "attribute": "COMPLETE" }, 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 fe4e84c2..70ebbbfa 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 @@ -3,7 +3,7 @@ "type": "CODE_SMELL", "code": { "impacts": { - "MAINTAINABILITY": "HIGH" + "MAINTAINABILITY": "BLOCKER" }, "attribute": "CONVENTIONAL" }, 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 fcdefe0d..1b16ab23 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,16 +1,37 @@

Why is this an issue?

-

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

-
+

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

+
 public function numberOfMinutes(hours:int):int
 {
-  var seconds:int = 0;  // seconds is never used
+  var seconds:int = 0;  // Noncompliant - seconds is unused
   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/S1820.json b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S1820.json
index b66e71c6..7ca46b8b 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
@@ -19,5 +19,5 @@
   "ruleSpecification": "RSPEC-1820",
   "sqKey": "S1820",
   "scope": "Main",
-  "quickfix": "unknown"
+  "quickfix": "infeasible"
 }
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 f8c6d786..9c849f15 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,7 +1,25 @@
 

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();
@@ -18,27 +36,11 @@ 

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();
@@ -51,9 +53,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
@@ -74,7 +76,7 @@ 

Exceptions

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

 if (a == 1) {
-  doSomething();  //no issue, usually this is done on purpose to increase the readability
+  doSomething();  // Compliant, 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 94130e8b..cf1a5247 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
@@ -20,5 +20,5 @@
   "ruleSpecification": "RSPEC-1871",
   "sqKey": "S1871",
   "scope": "Main",
-  "quickfix": "unknown"
+  "quickfix": "infeasible"
 }
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 59df2c6b..4005119b 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/S3923.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S3923.html index e8f55ac6..489681b7 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 @@ -24,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 needs removing.

+

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

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/S4507.html b/flex-checks/src/main/resources/org/sonar/l10n/flex/rules/flex/S4507.html
index 456d4a09..6c6de1c3 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
@@ -23,10 +23,10 @@ 

Sensitive Code Example

See

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 09d8e21a..c974fde9 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 @@ -34,6 +34,6 @@

Compliant solution

Resources

diff --git a/sonarpedia.json b/sonarpedia.json index 87e00fec..2cd1916b 100644 --- a/sonarpedia.json +++ b/sonarpedia.json @@ -3,7 +3,7 @@ "languages": [ "FLEX" ], - "latest-update": "2023-09-28T11:58:54.944638Z", + "latest-update": "2024-11-25T11:36:05.186615Z", "options": { "no-language-in-filenames": true, "preserve-filenames": true