Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-1067

Expressions should not be too complex

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Reduce the number of conditional operators ({}) used in the expression (maximum allowed {}).
    • List of parameters:
      • Key: max
      • Description: Maximum number of allowed conditional operators in an expression
      • Default Value : 3
    • Default Severity:
      Critical
    • Impact:
      High
    • Likelihood:
      Low
    • Legacy Key:
      BooleanExpressionComplexity
    • Targeted languages:
      Cobol, Flex, PL/I, PL/SQL, Python, Rust, Solidity, TypeScript
    • Covered Languages:
      ABAP, C#, C, C++, Go, Java, JavaScript, Kotlin, Objective-C, PHP, RPG, Ruby, Scala, Swift, T-SQL, VB.Net, VB6
    • Irrelevant for Languages:
      HTML, XML
    • Remediation Function:
      Linear with offset
    • Linear Argument Description:
      per complexity point above the threshold
    • Linear Factor:
      1min
    • Linear Offset:
      5min
    • Analysis Level:
      Syntactic Analysis
    • Analysis Scope:
      Main Sources, Test Sources
    • Common Rule:
      Yes
    • Checkstyle:
      BooleanExpressionComplexity, SimplifyBooleanExpression
    • SwiftLint:
      cyclomatic_complexity

      Description

      The complexity of an expression is defined by the number of &&, || and condition ? ifTrue : ifFalse operators it contains.
      A single expression's complexity should not become too high to keep the code readable.

        Attachments

          Issue Links

          1.
          ABAP RSPEC-2279 Language-Specification Active Unassigned
          2.
          RPG RSPEC-2280 Language-Specification Active Unassigned
          3.
          VB6 RSPEC-2281 Language-Specification Active Unassigned
          4.
          Cobol RSPEC-2587 Language-Specification Active Unassigned
          5.
          PHP RSPEC-2660 Language-Specification Active Unassigned
          6.
          Java RSPEC-2661 Language-Specification Active Unassigned
          7.
          C# RSPEC-2844 Language-Specification Active Unassigned
          8.
          Swift RSPEC-2862 Language-Specification Active Unassigned
          9.
          C-Family RSPEC-2880 Language-Specification Active Unassigned
          10.
          VB.NET RSPEC-3091 Language-Specification Active Unassigned
          11.
          JavaScript RSPEC-3910 Language-Specification Active Unassigned
          12.
          Go RSPEC-4588 Language-Specification Active Unassigned
          13.
          Kotlin RSPEC-4706 Language-Specification Active Unassigned
          14.
          Ruby RSPEC-4778 Language-Specification Active Unassigned
          15.
          T-SQL RSPEC-4857 Language-Specification Active Unassigned
          16.
          Scala RSPEC-4939 Language-Specification Active Unassigned
          17.
          Apex RSPEC-5017 Language-Specification Active Unassigned

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                freddy.mallet Freddy Mallet (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: