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

Functions should not have too many parameters

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      [Function|Constructor|Method|Lambda] "XXXX" has {0} parameters, which is greater than the {1} authorized.
    • List of parameters:
      Hide
      • Key: max
        • Description: Maximum authorized number of parameters
        • Default Value: 7
      • key: constructorMax
        • Description: Maximum authorized number of parameters for a constructor
        • default: 7
      Show
      Key: max Description: Maximum authorized number of parameters Default Value: 7 key: constructorMax Description: Maximum authorized number of parameters for a constructor default: 7
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Default Quality Profiles:
      Sonar way
    • Legacy Key:
      ProcedureParameterCount, ExcessiveParameterList, PlSql.FunctionAndProcedureExcessiveParameters
    • Targeted languages:
      RPG, VB6
    • Covered Languages:
      C#, C, C++, Flex, Go, Java, JavaScript, Kotlin, Objective-C, PHP, PL/I, PL/SQL, Python, Ruby, Scala, Swift, T-SQL, TypeScript, VB.Net
    • Irrelevant for Languages:
      ABAP, Cobol, HTML, XML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      20min
    • Analysis Level:
      Syntactic Analysis
    • Analysis Scope:
      Main Sources, Test Sources
    • Common Rule:
      Yes
    • Checkstyle:
      ParameterNumber
    • ESLint:
      max-params
    • PMD:
      ExcessiveParameterList, UseObjectForClearerAPI
    • Pylint:
      R0913
    • SwiftLint:
      function_parameter_count
    • TSLint-SonarTS:
      parameters-max-number

      Description

      A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: