A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/4800 below:

Support naming convention for *inner* classes · Issue #4800 · pmd/pmd · GitHub

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4