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

Statements should not end with semicolons

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Remove the semicolon.
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Targeted languages:
      JavaScript
    • Covered Languages:
      Java, Swift
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      1min
    • Analysis Scope:
      Main Sources, Test Sources
    • ESLint:
      semi
    • SwiftLint:
      trailing_semicolon

      Description

      The semicolon (;) is optional as a statement separator except in traditional for loops and when several statements are combined on one line (which is a bad practice). For cleaner code, semicolons should be omitted.

      Noncompliant Code Example

      int a;  // Noncompliant
      

      Compliant Solution

      int a
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ann.campbell.2 Ann Campbell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: