The naming conventions, http://drupal.org/coding-standards#naming, state that classes should be defined using UpperCamelCase, i.e. that the first letter is also in upper case, so MyClass, not myClass.

The Coder module does not appear to detect this coding standards error.

For example, the statspro module, in statspro.inc defines the class as:

class statspro {

}

and no error is shown when this module is run through the Coder module.

Comments

douggreen’s picture

Version: 6.x-1.0 » 7.x-2.x-dev

Looks like we are missing many rules from [#608152] (the standard was created after the initial coder style rules were written).

douggreen’s picture

I have already committed two rules to the 7.x-2.x version.

douggreen’s picture

Status: Active » Needs review

Please test and suggest what additional rules are needed.

Lars Toomre’s picture

@douggreen I am unsure where to find the rules in the 7.x-2.x version. Hence, I cannot confirm myself.

However, it does not appear lowerCamelCase is being flagged for properties (such as admin_user in many Test files) as per http://drupal.org/node/608152. How can I confirm if this is being flagged?

Thanks in advance for your help and great work!

douggreen’s picture

Coder review tests for class names, and method names, and camelCase function names. Property names could probably also be tested, but before I add this, please check if this is already handled by coder sniffer.

klausi’s picture

Component: Code » Code Sniffer
Status: Needs review » Fixed

Yes, this is handled by Coder Sniffer in coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php and coder_sniffer/Drupal/Sniffs/NamingConventions/ValidVariableNameSniff.php

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.