-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
a:new-ruleProposal to add a new built-in ruleProposal to add a new built-in rule
Milestone
Description
Proposed Rule Name: AnnotationsNamingConventions
Proposed Category: Code Style
Description: This rule enforces that Apex annotations should be written in PascalCase. Apex, while case-insensitive, benefits from a consistent code style to improve readability and maintainability. Enforcing PascalCase for annotations aligns with the established convention for classes and methods, reducing ambiguity and promoting a unified coding standard. Furthermore, Apex currently does not support custom annotations; therefore, the set of allowable annotations is fixed and known at compile time, ensuring that this rule can always be reliably checked.
The current set of permitted annotations is published here.
Code Sample:
// Incorrect:
@istest
private static void fooShouldBar() {
//...
}
// Correct:
@IsTest
private static void fooShouldBar() {
//...
}
//Incorrect:
@testvisible
private boolean doSomething = false;
//Correct:
@TestVisible
private boolean doSomething = false;brandbarrbrandbarr
Metadata
Metadata
Assignees
Labels
a:new-ruleProposal to add a new built-in ruleProposal to add a new built-in rule