Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
douggreen CreditAttribution: douggreen commentedLooks like we are missing many rules from [#608152] (the standard was created after the initial coder style rules were written).
Comment #2
douggreen CreditAttribution: douggreen commentedI have already committed two rules to the 7.x-2.x version.
Comment #3
douggreen CreditAttribution: douggreen commentedPlease test and suggest what additional rules are needed.
Comment #4
Lars Toomre CreditAttribution: Lars Toomre commented@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!
Comment #5
douggreen CreditAttribution: douggreen commentedCoder 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.
Comment #6
klausiYes, this is handled by Coder Sniffer in coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php and coder_sniffer/Drupal/Sniffs/NamingConventions/ValidVariableNameSniff.php