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
Apex

Apex static code analysis

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

  • All rules 97
  • Vulnerability2
  • Bug26
  • Security Hotspot3
  • Code Smell66
Filtered: 3 rules found
design
    Impact
      Clean code attribute
        1. Abstract classes should contain at least one abstract or virtual method

           Code Smell
        2. Two branches in a conditional structure should not have exactly the same implementation

           Code Smell
        3. String literals should not be duplicated

           Code Smell

        Abstract classes should contain at least one abstract or virtual method

        intentionality - clear
        maintainability
        Code Smell
        • design
        • confusing

        This rule raises an issue when an abstract class contains only fields and no methods, making it function as a data container rather than a proper base class.

        Why is this an issue?

        How can I fix it?

        More Info

        Abstract classes are designed to serve as base classes that define common behavior for their subclasses. They should contain abstract or virtual methods that subclasses can implement or override.

        When an abstract class contains only fields and no methods, it’s not fulfilling its intended purpose. Instead, it’s acting as a simple data container that cannot be instantiated. This creates confusion about the class’s role and design intent.

        Using the abstract keyword for a data-only class is misleading because:

        • It suggests that the class is meant for inheritance and method overriding
        • It doesn’t clearly communicate that the class is simply a non-instantiable data container
        • Other developers might expect to find abstract methods to implement

        A class that only holds data and should not be instantiated is better served by using a private or protected constructor. This approach clearly communicates the design intent and prevents instantiation without the misleading implications of the abstract keyword.

        What is the potential impact?

        This design issue can lead to confusion among team members about the class’s intended purpose and usage patterns. It may result in incorrect assumptions about inheritance relationships and make the codebase harder to understand and maintain.

          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories

        © 2025 SonarSource Sàrl. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use