-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Rule: ClassNamingConventions
Is your feature request related to a problem? Please describe.
As a developer working with multiple clients who have different federally imposed naming conventions, I need to be able to tailor my ruleset file to match those naming conventions so that my developers are reminded to remain in compliance. Specifically, we make use of a 3-4 character module prefix before the class name. ie: FOO_ This is required of every enum, class etc.
Except Inner classes. Inner classes are not supposed to have a prefix. So I'd like to request an expansion of the Class naming convention rule to allow for a separate Regex for inner classes.
Describe the solution you'd like
An expansion of this rule:
<rule ref="category/apex/codestyle.xml/ClassNamingConventions">
<priority>2</priority>
<properties>
<property name="testClassPattern" value="[A-Z]{3,4}_[a-zA-Z0-9_]*" />
<property name="abstractClassPattern" value="[A-Z][a-zA-Z0-9]*" />
<property name="classPattern" value="[A-Z]{3,4}_[a-zA-Z0-9]*" />
<property name="interfacePattern" value="[A-Z][a-zA-Z0-9]*" />
<property name="enumPattern" value="[A-Z][a-zA-Z0-9]*" />
</properties>
</rule>With an additional property named "innerClassPattern" that would allow for configuration like this:
<rule ref="category/apex/codestyle.xml/ClassNamingConventions">
<priority>2</priority>
<properties>
<property name="testClassPattern" value="[A-Z]{3,4}_[a-zA-Z0-9_]*" />
<property name="abstractClassPattern" value="[A-Z][a-zA-Z0-9]*" />
<property name="classPattern" value="[A-Z]{3,4}_[a-zA-Z0-9]*" />
<property name="innerClassPattern" value="[A-Z]{1,}[a-zA-Z0-9]*" />
<property name="interfacePattern" value="[A-Z][a-zA-Z0-9]*" />
<property name="enumPattern" value="[A-Z][a-zA-Z0-9]*" />
</properties>
</rule>Describe alternatives you've considered
I've seriously considered gifting my developers a bullet ant (world's most painful bite) on their keyboards for violating this but HR says thats 'capricious' and may be considered illegal.
Additional context
I took a look at the java for this, and I'll be honest, I do not, at the moment, possess the requisite skills to make this a pull request. Happy to buy a round for the developer who makes this a reality at the next mutually attended Salesforce conference.