SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
ABAP

ABAP static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your ABAP code

  • All rules 94
  • Vulnerability4
  • Bug14
  • Security Hotspot7
  • Code Smell69
 
Tags
    Impact
      Clean code attribute
        1. All branches in a conditional structure should not have exactly the same implementation

           Bug
        2. "WHERE" clause conditions should not be contradictory

           Bug
        3. Open SQL "SELECT" statements should have an "ORDER BY" clause

           Bug
        4. Empty driver tables should not be used in a "SELECT/FOR ALL ENTRIES" clause

           Bug
        5. Related "if/else if" statements should not have the same condition

           Bug
        6. Identical expressions should not be used on both sides of a binary operator

           Bug
        7. Loops with at most one iteration should be refactored

           Bug
        8. An internal table should be sorted before duplicates are deleted

           Bug
        9. Sort fields should be provided for an internal table sort

           Bug
        10. Operational statements should not be chained

           Bug
        11. Variables should not be self-assigned

           Bug
        12. SQL "BYPASSING BUFFER" clause should not be used

           Bug
        13. SQL "UPDATE dbtab SET ..." statements should have a "WHERE" clause

           Bug
        14. "DELETE FROM dbtab" statements should have a "WHERE" clause

           Bug

        Loops with at most one iteration should be refactored

        intentionality - clear
        reliability
        Bug
        • confusing
        • bad-practice

        Why is this an issue?

        A loop with at most one iteration is equivalent to the use of an IF statement to conditionally execute one piece of code. No developer expects to find such usage of a loop statement. If the initial intention of the author was really to conditionally execute one piece of code, an IF statement should be used in place.

        At worst that was not the initial intention of the author and so the body of the loop should be fixed to use the nested STOP, RETURN or EXIT statements in a more appropriate way.

        Noncompliant code example

        DATA remainder TYPE i.
        DO 20 TIMES.
          remainder = sy-index MOD 2.
          cl_demo_output=>write_text().
          EXIT.  " noncompliant, loop only executes once
        ENDDO.
        

        Compliant solution

        DATA remainder TYPE i.
        DO 20 TIMES.
          remainder = sy-index MOD 2.
          cl_demo_output=>write_text().
        ENDDO.
        
          Available In:
        • SonarQube IdeCatch issues on the fly,
          in your IDE
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories
        • SonarQube ServerAnalyze code in your
          on-premise CI
          Developer Edition
          Available Since
          9.1

        © 2008-2025 SonarSource SA. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use