Field name is not camelCase

ID

apex.maintainability.naming_field

Severity

info

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Naming

Language

Apex

Description

Reports a class field whose name does not follow the Apex convention of camelCase - a lowercase first letter and no underscores. static final fields are constants and are covered by their own convention, and properties carry their own, so neither is reported here.

Rationale

Field names are read far from their declaration, often in a method that receives no other clue about where a value comes from. A consistent camelCase field next to PascalCase types and uppercase constants lets a reader classify every name in an expression at a glance, without scrolling back to the top of the class.

The following code illustrates the pattern detected by this rule:

public class NamingFields {
    // FLAGGED: Field name is not camelCase
    private Integer Retry_Counter;

    // FLAGGED: Field name is not camelCase
    public String AccountName = 'x';

    // FLAGGED: Field name is not camelCase
    private static Integer SharedCounter = 0;

    private Integer retryCounter;

    public String customerName = 'x';

    public String Name { get; set; }

    public Integer Total { get; private set; }

    private static final Integer MAX_RETRIES = 3;

    private static final Integer lowercaseConstant = 3;

    public void work() {
        Integer Local_Value = 1;
        System.debug(Local_Value);
    }
}

Remediation

Rename the field to camelCase (accountId, retryCounter) and update its references. If the value never changes after initialization, make it static final and give it a constant name instead.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved