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
async
    Impact
      Clean code attribute
        1. Future methods must be static and return void

           Bug
        2. Future methods making HTTP callouts should include "callout=true" parameter

           Bug

        Future methods must be static and return void

        intentionality - logical
        reliability
        Bug
        • apex
        • async

        This rule raises an issue when a method annotated with @future is not declared as static or does not have a void return type.

        Why is this an issue?

        How can I fix it?

        More Info

        Methods annotated with @future in Apex execute asynchronously in a separate thread when system resources become available. This asynchronous execution model has two fundamental requirements:

        First, future methods must be static because they cannot rely on instance state. When a future method executes, it runs independently of the original calling context, potentially long after the original object instance has been destroyed or modified. Static methods ensure the code can execute without requiring access to instance variables or methods.

        Second, future methods must return void because they cannot return values to the calling code. The calling thread continues execution immediately after invoking the future method, without waiting for its completion. By the time the future method actually executes, the original caller has already moved on, making it impossible to receive any return value.

        These are not just recommendations but strict compilation requirements enforced by the Apex compiler. Any attempt to declare a future method as non-static or with a non-void return type will result in compilation errors, preventing the code from being saved or deployed.

        What is the potential impact?

        Violating this rule will cause compilation errors, preventing the code from being saved, deployed, or executed. This breaks the build process and blocks development progress until the method signature is corrected.

          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