This rule is designed to ensure all custom fields in your Salesforce environment follow a consistent naming convention, which is crucial for maintaining a healthy and manageable codebase. Code Reviews flags these inconsistencies as a Warning to help you proactively address potential issues.
Why this rule matters
Inconsistent naming of custom fields can introduce several problems that impact your team's efficiency and the long-term health of your Salesforce org:
Reduces Readability: When a field's purpose isn't immediately clear from its name, developers and administrators have to spend time deciphering its function, slowing down work.
Impairs Collaboration: A lack of naming standards can lead to miscommunication and errors, especially in larger teams or with new members joining the project.
Increases Technical Debt: Inconsistent fields are often symptoms of poor design and contribute to a disorganized codebase that is difficult to maintain and scale.
Hinders Scalability: As your organization grows and adds more custom fields, a lack of a clear naming convention can make your Salesforce environment difficult to manage.
By adopting a consistent naming convention, you create a description that clearly communicates the field's purpose, its associated object, and its data type, which is invaluable for long-term project success.
What triggers this rule
Code Reviews flags custom fields that do not follow a consistent naming pattern, for example:
Mixing different casing styles (e.g.,
CamelCase,snake_case).Using unclear abbreviations or inconsistent word order.
Missing a consistent suffix (e.g.,
__c).
Configuring Naming Convention Patterns
To update the patterns for constants and variables, go to the Policies section and click the pencil icon next to the Intentional policy. Then click the pencil icon beside the Inconsistent naming custom fields rule. Here, you can use regex patterns to define and maintain a consistent naming convention for your constants and variables.
Recommended approach
To ensure consistency and maintainability, you should establish and enforce a naming convention for your custom fields. A good practice is to use descriptive names with a consistent suffix. In Code Reviews, you can customize this rule with a Regex (Regular Expression) pattern to fit your team’s specific standards. This allows you to define a precise pattern that all custom fields must follow.
Summary
The "Inconsistent naming custom fields" rule is an essential tool for maintaining code quality and team productivity. By establishing and enforcing a clear naming convention, you can prevent many common issues, reduce technical debt, and ensure a smooth and efficient development workflow. Clayton helps you achieve this by automatically flagging inconsistencies and providing you with the tools to define your own rules.

