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: 1 rule found
lwc
    Impact
      Clean code attribute
        1. Custom event names should not be prefixed with "on"

           Code Smell

        Custom event names should not be prefixed with "on"

        consistency - conventional
        maintainability
        Code Smell
        • lwc
        • convention
        • salesforce

        This rule raises an issue when a custom event is created with a name that starts with the prefix 'on'.

        Why is this an issue?

        How can I fix it?

        More Info

        In Lightning Web Components, event handler names conventionally start with 'on' (like onclick, onchange, etc.). When custom event names also start with 'on', it creates confusion and inconsistency.

        For example, if you create a custom event named 'onselect', the corresponding event handler would need to be named 'ononselect', which is confusing and breaks the expected naming pattern.

        This naming convention issue makes the code harder to read and understand, especially for developers who are familiar with standard web development practices where the 'on' prefix is reserved for event handlers, not event names themselves.

        Following consistent naming conventions helps maintain code clarity and makes it easier for team members to understand the codebase.

        What is the potential impact?

        This issue affects code maintainability and readability. While it doesn’t cause runtime errors, it can lead to confusion among developers and makes the code harder to understand and maintain. It also goes against established Lightning Web Components best practices.

          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