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 |
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;
}