Class name is not PascalCase

ID

apex.maintainability.naming_class

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming

Language

Apex

Description

Reports a class, inner class or interface whose name does not follow the Apex convention of PascalCase - an uppercase first letter and no underscores. The expected shape is ^[A-Z][A-Za-z0-9]*$; adjust it if your org has settled on a different convention.

Rationale

Apex is case-insensitive, so the compiler accepts any spelling and the convention is the only thing keeping type references readable. A name like account_service or accountService reads as a variable at the call site, which is exactly where the reader needs to tell a type from a value. Consistency also matters for the org-wide search that developers use to find a class, since a mixed-convention codebase forces every search to be tried twice.

The following code illustrates the pattern detected by this rule:

// FLAGGED: Class name is not PascalCase
public class account_service {

    // FLAGGED: Class name is not PascalCase
    public class Inner_Holder {
        public Integer value;
    }

    public class InnerHolder {
        public Integer value;
    }
}

Remediation

Rename the class to PascalCase (AccountService, InvoiceBatch) and update its references. A class file must be renamed together with its .cls metadata file, so do it through your IDE or the metadata API rather than by hand.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved