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: 2 rules found
naming
    Impact
      Clean code attribute
        1. Custom exception classes should follow proper naming conventions

           Code Smell
        2. Constants should use SNAKE_CASE with all uppercase letters

           Code Smell

        Custom exception classes should follow proper naming conventions

        consistency - conventional
        maintainability
        Code Smell
        • convention
        • naming

        This rule raises an issue when a custom exception class does not end with the suffix "Exception".

        Why is this an issue?

        How can I fix it?

        More Info

        Custom exception classes serve as a way to handle specific error conditions in your Apex code. When these classes don’t follow proper naming conventions, it creates several problems.

        First, unclear naming makes code harder to understand and maintain. A class named MyError or CustomHandler doesn’t immediately signal to other developers that it’s an exception class. This lack of clarity can lead to confusion when reading or debugging code.

        Second, Apex follows Java conventions where exception classes should end with "Exception". This convention is widely recognized and expected by developers. Breaking this convention makes your code inconsistent with established patterns.

        Third, proper exception naming helps with code organization and searchability. When all exception classes follow the same naming pattern, developers can quickly identify and locate them in the codebase.

        Finally, some development tools and static analysis systems rely on naming conventions to provide better support, such as syntax highlighting, code completion, and error detection.

        What is the potential impact?

        Poor naming conventions for exception classes can lead to:

        • Reduced code readability and maintainability
        • Confusion for team members and future developers
        • Inconsistency with Apex and Java conventions
        • Difficulty in identifying exception classes during code reviews
        • Potential issues with development tools that rely on naming patterns
          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories

        © 2008-2025 SonarSource SA. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use