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

Unused condition names should be removed

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      This condition name variable "XXXX" is unused and so should be removed.
    • Highlighting:
      Hide

      The unused condition name.

      Show
      The unused condition name.
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Default Quality Profiles:
      Sonar way
    • Covered Languages:
      Cobol
    • Irrelevant for Languages:
      ABAP, APEX, C#, C, C++, CSS, Flex, Go, HTML, Java, JavaScript, Kotlin, Objective-C, PHP, PL/I, PL/SQL, Python, RPG, Ruby, Rust, Scala, Solidity, Swift, T-SQL, TypeScript, VB.Net, VB6, XML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min
    • Analysis Level:
      Semantic Analysis
    • Analysis Scope:
      Main Sources

      Description

      88-level variables, also known as "condition name" variables, represent possible values of the "conditional variables" they're tied to. An unused "condition name" variable is dead code. Such variables should be removed to increase the maintainability of the program.

      Noncompliant Code Example

      01 COLOR PIC X.
        88 COL-YELLOW VALUE 'Y'.
        88 COL-GREEN VALUE 'G'. *> Noncompliant; not used
        88 COL-RED VALUE 'R'.
      
      * ...
      IF COL-YELLOW 
      * ...
      END-IF
      IF COL-RED 
      * ...
      END-IF
      

      Compliant Solution

      01 COLOR PIC X.
        88 COL-YELLOW VALUE 'Y'.
        88 COL-RED VALUE 'R'.
      
      * ...
      IF COL-YELLOW 
      * ...
      END-IF
      IF COL-RED 
      * ...
      END-IF
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              alexandre.gigleux Alexandre Gigleux
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: