SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
Flex

Flex static code analysis

Unique rules to find Bugs, Security Hotspots, and Code Smells in your FLEX code

  • All rules 76
  • Vulnerability5
  • Bug9
  • Security Hotspot1
  • Code Smell61
 
Tags
    Impact
      Clean code attribute
        1. "default" clauses should be first or last

           Code Smell
        2. Flex parser failure

           Code Smell
        3. "MovieClip.onEnterFrame" event handler should not be used

           Code Smell
        4. Objects should not be instantiated inside a loop

           Code Smell
        5. Two branches in a conditional structure should not have exactly the same implementation

           Code Smell
        6. "switch" statements should not be nested

           Code Smell
        7. Classes should not have too many fields

           Code Smell
        8. Cyclomatic Complexity of functions should not be too high

           Code Smell
        9. Unused local variables should be removed

           Code Smell
        10. The element type of an array field should be specified

           Code Smell
        11. Event types should be defined in metadata tags

           Code Smell
        12. Event names should not be hardcoded in event listeners

           Code Smell
        13. Package definition should be separate from Class definition

           Code Smell
        14. Track lack of copyright and license headers

           Code Smell
        15. Classes should not have too many methods

           Code Smell
        16. Constructor bodies should be as lightweight as possible

           Code Smell
        17. Dynamic classes should not be used

           Code Smell
        18. Constructors should not have a "void" return type

           Code Smell
        19. "public static" fields should be constant

           Code Smell
        20. "===" and "!==" should be used instead of "==" and "!="

           Code Smell
        21. Only "while", "do" and "for" statements should be labelled

           Code Smell
        22. Statements should end with semicolons

           Code Smell
        23. The special "star" type should not be used

           Code Smell
        24. Variables of the "Object" type should not be used

           Code Smell
        25. Track breaches of an XPath rule

           Code Smell
        26. Functions should not have too many lines of code

           Code Smell
        27. Control flow statements "if", "for", "while" and "switch" should not be nested too deeply

           Code Smell
        28. Statements, operators and keywords specific to ActionScript 2 should not be used

           Code Smell
        29. Octal values should not be used

           Code Smell
        30. Loggers should be "private static const" and should share naming convention

           Code Smell
        31. Cyclomatic Complexity of classes should not be too high

           Code Smell
        32. "switch" statements should have "default" clauses

           Code Smell
        33. "switch" statements should have at least 3 "case" clauses

           Code Smell
        34. Switch cases should end with an unconditional "break" statement

           Code Smell
        35. "for" loop stop conditions should be invariant

           Code Smell
        36. Sections of code should not be commented out

           Code Smell
        37. Track comments matching a regular expression

           Code Smell
        38. Statements should be on separate lines

           Code Smell
        39. Package names should comply with a naming convention

           Code Smell
        40. Methods should not be empty

           Code Smell
        41. Overriding methods should do more than simply call the same method in the super class

           Code Smell
        42. Public classes, methods, properties and metadata should be documented with ASDoc

           Code Smell
        43. Unused function parameters should be removed

           Code Smell
        44. Public constants and fields initialized at declaration should be "const static" rather than merely "const"

           Code Smell
        45. Local variable and function parameter names should comply with a naming convention

           Code Smell
        46. Field names should comply with a naming convention

           Code Smell
        47. "switch case" clauses should not have too many lines of code

           Code Smell
        48. Constant names should comply with a naming convention

           Code Smell
        49. Unused "private" functions should be removed

           Code Smell
        50. Functions should not contain too many return statements

           Code Smell
        51. Boolean literals should not be redundant

           Code Smell
        52. Local variables should not shadow class fields

           Code Smell
        53. Empty statements should be removed

           Code Smell
        54. Nested blocks of code should not be left empty

           Code Smell
        55. Functions should not have too many parameters

           Code Smell
        56. Unused "private" fields should be removed

           Code Smell
        57. Mergeable "if" statements should be combined

           Code Smell
        58. Lines should not be too long

           Code Smell
        59. Class names should comply with a naming convention

           Code Smell
        60. A function should have a single point of exit at the end of the function

           Code Smell
        61. Function names should comply with a naming convention

           Code Smell

        Functions should not contain too many return statements

        intentionality - clear
        maintainability
        Code Smell

          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.

          Noncompliant code example

          With the default threshold of 3:

          function myFunction():boolean { // Noncompliant as there are 4 return statements
            if (condition1) {
              return true;
            } else {
              if (condition2) {
                return false;
              } else {
                return true;
              }
            }
            return false;
          }
          
            Available In:
          • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories
          • SonarQube Community BuildAnalyze code in your
            on-premise CI
            Available Since
            9.1
          • SonarQube ServerAnalyze code in your
            on-premise CI
            Developer Edition
            Available Since
            9.1

          © 2008-2025 SonarSource SA. All rights reserved.

          Privacy Policy | Cookie Policy | Terms of Use