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

Cyclomatic Complexity of functions should not be too high

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      The Cyclomatic Complexity of this [function|method|subroutine] ["XXXXX"|expression] is Y which is greater than T authorized.
    • List of parameters:
      • Key: Threshold
      • Description: The maximum authorized complexity.
      • Default Value: 10
      • Default for ABAP: 20
      • Default for RPG: 30
      • Default for PHP: 20
      • Default for Python: 15
    • Default Severity:
      Critical
    • Impact:
      High
    • Likelihood:
      Low
    • Legacy Key:
      too-complex-function, FunctionComplexity, SubAndFunctionComplexity, PlSql.FunctionAndProcedureComplexity, MethodCyclomaticComplexity
    • Covered Languages:
      ABAP, C#, C, C++, Flex, Java, JavaScript, Objective-C, PHP, PL/SQL, Python, RPG, Swift, TypeScript, VB.Net, VB6
    • Remediation Function:
      Linear with offset
    • Linear Argument Description:
      per complexity point above the threshold
    • Linear Factor:
      1min
    • Linear Offset:
      10min
    • Analysis Scope:
      Main Sources
    • Checkstyle:
      CyclomaticComplexity, NPathComplexity
    • ESLint:
      complexity
    • FxCop:
      AvoidExcessiveComplexity, CA1502
    • PMD:
      CyclomaticComplexity, ModifiedCyclomaticComplexity, NPathComplexity, tdCyclomaticComplexity, StdCyclomaticComplexity
    • SwiftLint:
      cyclomatic_complexity
    • TSLint:
      cyclomatic-complexity
    • TSLint-SonarTS:
      mccabe-complexity

      Description

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

        Attachments

          Issue Links

            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: