Property is not named in camelCase

ID

apex.maintainability.naming_property

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming

Language

Apex

Description

Reports a property declaration whose name does not match ^[a-z][A-Za-z0-9]*$.

Rationale

A property is read at the call site exactly like a field, so the same convention has to hold: a lowercase first letter and no underscores is what tells a reader that invoice.totalAmount is a value on the object and not a type or a constant. A Customer_Name property also looks like a Salesforce field API name, which sends the next reader looking for a field that does not exist - and in a Visualforce or Lightning binding the two really are written the same way, so the confusion is not theoretical.

The following code illustrates the pattern detected by this rule:

public class InvoiceView {

    // FLAGGED: Property is not named in camelCase
    public String Customer_Name { get; set; }

    // FLAGGED: Property is not named in camelCase
    public Decimal TotalAmount { get; private set; }

    public String customerName { get; set; }

    public Decimal invoiceTotal { get; private set; }

    public List<Invoice__c> invoices { get; set; }

    private Integer lineCount;
}

Remediation

Rename the property to camelCase. Where it is bound from Visualforce, a Lightning component or serialized JSON, rename the binding at the same time - the property name is part of that contract, so this cannot be done from the Apex side alone.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved