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: 4 rules found
exception-handling
    Impact
      Clean code attribute
        1. DML operations in catch blocks can mask original exceptions

           Bug
        2. Catch blocks should not be empty

           Code Smell
        3. Apex REST services should implement comprehensive exception handling

           Vulnerability
        4. SOQL queries should be assigned to Lists to avoid QueryException

           Bug

        Catch blocks should not be empty

        intentionality - complete
        reliability
        maintainability
        Code Smell
        • exception-handling

        This rule raises an issue when a catch block contains no statements at all, silently ignoring any exceptions that occur.

        Why is this an issue?

        How can I fix it?

        More Info

        Empty catch blocks are problematic because they completely suppress exceptions without any acknowledgment or handling. When an exception occurs, it disappears silently, making it impossible to detect, debug, or recover from errors.

        In Salesforce environments, this can be particularly dangerous because:

        • Data operations may fail silently, leading to incomplete or corrupted records
        • Integration errors go unnoticed, causing synchronization issues
        • Performance problems remain hidden, affecting user experience
        • Compliance and audit trails become incomplete

        Even if you expect certain exceptions to occur and want to ignore them, an empty catch block provides no documentation of this intent. Future developers (including yourself) won’t understand why the exception is being ignored or whether it’s safe to do so.

        Proper exception handling doesn’t always mean stopping execution - it means making a conscious decision about how to respond to the error condition.

        What is the potential impact?

        Silent failures can lead to data corruption, incomplete business processes, and difficult-to-diagnose production issues. In Salesforce contexts, this can result in missing records, failed integrations, or compliance violations that go undetected.

          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