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

Statements should be on separate lines

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Reformat the code to have only one statement per line.
    • Highlighting:
      • Primary: second statement on the line
      • Secondary: rest statements if any (statements highlighted entirely and separately from each other)
        • message: none
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Legacy Key:
      OneStatementPerLine, OneStatementPerLineCheck
    • Covered Languages:
      ABAP, C#, C, C++, Cobol, Flex, Go, Java, JavaScript, Kotlin, Objective-C, PHP, PL/I, PL/SQL, Python, Ruby, Scala, Swift, T-SQL, TypeScript, VB.Net, VB6
    • Irrelevant for Languages:
      HTML, RPG, XML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      1min
    • Analysis Level:
      Syntactic Analysis
    • Analysis Scope:
      Main Sources, Test Sources
    • Common Rule:
      Yes
    • Checkstyle:
      OneStatementPerLine
    • ESLint:
      max-statements-per-line
    • PMD:
      OneDeclarationPerLine
    • SwiftLint:
      switch_case_on_newline
    • TSLint-SonarTS:
      no-statements-same-line

      Description

      For better readability, do not put more than one statement on a single line.

      Noncompliant Code Example

      if(someCondition) doSomething();
      

      Compliant Solution

      if(someCondition) {
        doSomething();
      }
      

        Attachments

          Issue Links

          1.
          PL/SQL RSPEC-2400 Language-Specification Active Unassigned
          2.
          Swift RSPEC-2502 Language-Specification Active Unassigned
          3.
          VB6 RSPEC-2512 Language-Specification Active Unassigned
          4.
          ABAP RSPEC-2513 Language-Specification Active Unassigned
          5.
          COBOL RSPEC-2514 Language-Specification Active Unassigned
          6.
          PHP RSPEC-2515 Language-Specification Active Unassigned
          7.
          JavaScript RSPEC-2516 Language-Specification Active Unassigned
          8.
          VB.NET RSPEC-3099 Language-Specification Active Unassigned
          9.
          PL/I RSPEC-3312 Language-Specification Active Unassigned
          10.
          C# RSPEC-3393 Language-Specification Active Unassigned
          11.
          C-Family RSPEC-3968 Language-Specification Active Unassigned
          12.
          Python RSPEC-4003 Language-Specification Active Unassigned
          13.
          T-SQL RSPEC-4161 Language-Specification Active Unassigned
          14.
          Go RSPEC-4484 Language-Specification Active Unassigned
          15.
          Kotlin RSPEC-4697 Language-Specification Active Unassigned
          16.
          Ruby RSPEC-4760 Language-Specification Active Unassigned
          17.
          Scala RSPEC-4918 Language-Specification Active Unassigned
          18.
          Apex RSPEC-4990 Language-Specification Active Unassigned

            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: