Skip to main content

Inconsistent Naming Conventions

David Martin avatar
Written by David Martin
Updated this week

Overview

This rule flags Apex code and metadata that do not follow consistent or standardized naming conventions across the org. While names may technically work, inconsistency in how classes, methods, fields, or other elements are named leads to confusion, poor developer experience, and increased risk of errors.

Clayton classifies this as a Warning because inconsistent naming doesn’t break functionality, but it undermines the clarity, structure, and maintainability of your codebase especially in collaborative or fast-scaling teams.

Why This Matters

Inconsistent naming:

  • Reduces readability, making code harder to navigate and understand

  • Slows down development, as teams spend time deciphering naming intent

  • Leads to duplication, when developers unknowingly recreate similar objects or logic

  • Impacts collaboration, especially across admins, developers, and architects

  • Makes onboarding harder, as naming patterns don’t clearly reflect purpose or context

Standard naming acts as a contract across the team it communicates structure, intent, and ownership.

What Triggers This Rule

Code Reviews flags inconsistently named:

  • Apex Classes and Triggers – e.g., mixing CamelCase, snake_case, or abbreviations

  • Methods – unclear names like process1() or overly generic names like doStuff()

  • Test Classes – not using the _Test suffix or not matching the class they support

  • Variables – using shorthand, unclear prefixes, or inconsistent casing

  • Custom Fields & Objects – missing suffixes like __c, using unclear abbreviations, or inconsistent word order

  • Aura Properties – mismatched with their bound templates or controllers

Recommended Approach

Establish and enforce naming conventions across:

  • Apex: Use PascalCase for class names (AccountService), camelCase for variables and methods (calculateDiscount)

  • Custom Metadata: Use full words and consistent suffixes (Renewal_Status__c)

  • Test Classes: Match the target class name and append _Test (AccountService_Test)

  • Triggers: Use ObjectTrigger format (AccountTrigger)

  • Objects: Use descriptive names with consistent prefixing for custom apps or modules

Use naming patterns that clearly indicate purpose, object, and action.

Summary

Consistent naming conventions reduce confusion and help your codebase scale with your team. Apply clear, standardized naming across all elements to improve readability, reduce duplication, and make collaboration smoother. Code Reviews flags inconsistencies as a Warning to promote a clean, well-structured Salesforce environment.

Did this answer your question?