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: 5 rules found
performance
    Impact
      Clean code attribute
        1. String conversions should use explicit methods instead of empty string concatenation

           Code Smell
        2. SOQL queries should not be executed inside loops

           Code Smell
        3. HTTP requests should have explicit timeout configuration

           Code Smell
        4. SOQL queries should use SystemModStamp instead of LastModifiedDate for better performance

           Code Smell
        5. Batch Apex scope parameters should not exceed 2000 records

           Code Smell

        HTTP requests should have explicit timeout configuration

        intentionality - complete
        reliability
        maintainability
        Code Smell
        • performance
        • salesforce
        • governor-limits

        This rule raises an issue when an HttpRequest is sent without explicitly setting a timeout value using the setTimeout() method.

        Why is this an issue?

        How can I fix it?

        More Info

        HTTP callouts in Apex can take a long time to complete, especially when external services are slow or unresponsive. Without an explicit timeout, Salesforce uses a default timeout of 120 seconds, which is often too long for most integration scenarios.

        Long-running HTTP requests consume valuable execution time and can easily cause your code to hit Salesforce’s governor limits. In a single transaction, you have a maximum of 120 seconds of total execution time. If you make multiple callouts or have other processing logic, a single slow HTTP request can consume most or all of this time budget.

        Additionally, users waiting for a response will experience poor performance when requests take too long to complete. This creates a frustrating user experience and can make your application appear unresponsive.

        By setting an appropriate timeout value, you ensure that HTTP requests fail fast when external services are unresponsive, allowing your code to handle errors gracefully and maintain good performance characteristics.

        What is the potential impact?

        Without explicit timeouts, HTTP callouts can consume excessive execution time, leading to governor limit violations and transaction failures. Users may experience long wait times or timeouts, degrading the overall user experience. In batch processing scenarios, a single slow request can cause entire batches to fail.

          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