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

Local variable and function parameter names should comply with a naming convention

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Rename this [local variable|parameter] "XXXX" to match the regular expression ${format}.
    • List of parameters:
      Hide

      Key: format
      Description: Regular expression used to check the names against.
      Default Value for Java : ^[a-z][a-zA-Z0-9]*$
      Default Value for Flex : ^[_a-z][a-zA-Z0-9]*$
      Default Value for Python : ^[_a-z][a-z0-9_]*$
      Default Value for Swift : ^[a-z][a-zA-Z0-9]*$
      Default Value for PHP : ^[a-z][a-zA-Z0-9]*$
      Default Value for VB.NET: ^[a-z][a-z0-9]*([A-Z]

      {1,3}

      [a-z0-9]+)*([A-Z]

      {2}

      )?$
      Default Value for TSQL: @[a-zA-Z0-9_]*

      Show
      Key: format Description: Regular expression used to check the names against. Default Value for Java : ^ [a-z] [a-zA-Z0-9] *$ Default Value for Flex : ^ [_a-z] [a-zA-Z0-9] *$ Default Value for Python : ^ [_a-z] [a-z0-9_] *$ Default Value for Swift : ^ [a-z] [a-zA-Z0-9] *$ Default Value for PHP : ^ [a-z] [a-zA-Z0-9] *$ Default Value for VB.NET: ^ [a-z] [a-z0-9] *( [A-Z] {1,3} [a-z0-9] +)*( [A-Z] {2} )?$ Default Value for TSQL: @ [a-zA-Z0-9_] *
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Legacy Key:
      LocalVariableName, NamingVariablesCheck
    • Targeted languages:
      C#
    • Covered Languages:
      C, C++, Flex, Go, Java, JavaScript, Kotlin, Objective-C, PHP, PL/SQL, Python, Ruby, Scala, Swift, T-SQL, TypeScript, VB.Net
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      2min
    • Analysis Scope:
      Main Sources, Test Sources
    • Checkstyle:
      ParameterName, AbbreviationAsWordInName, LocalVariableName, LocalFinalVariableName
    • ESLint:
      id-length, id-match, no_underscore_dangle
    • FxCop:
      IdentifiersShouldNotContainUnderscores, IdentifiersShouldBeCasedCorrectly, IdentifiersShouldHaveCorrectSuffix, IdentifiersShouldNotHaveIncorrectSuffix, IdentifiersShouldHaveCorrectPrefix, IdentifiersShouldNotHaveIncorrectPrefix
    • PMD:
      AvoidDollarSigns, MisleadingVariableName, AvoidPrefixingMethodParameters, LongVariable, ShortVariable
    • Pylint:
      C0103
    • TSLint:
      variable-name

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: