CGov Naming Conventions - NCIOCPL/cgov-digital-platform GitHub Wiki
This project uses standard Drupal Naming Conventions, highlighted here:
- Classes and interfaces should use UpperCamel naming.
- Methods and class properties should use lowerCamel naming. In Drupal 8, properties of configuration entities are exempt of these conventions. Those properties are allowed to use underscores.
- If an acronym is used in a class or method name, make it CamelCase too (SampleXmlClass, not SampleXMLClass). [Note: this standard was adopted in March 2013, reversing the previous standard.]
- Classes should not use underscores in class names unless absolutely necessary to derive names inherited class names dynamically. That is quite rare, especially as Drupal does not mandate a class-file naming match.
- Names should not include "Drupal".
- Class names should not have "Class" in the name.
- Interfaces should always have the suffix "Interface".
- Test classes should always have the suffix "Test".
- Protected or private properties and methods should not use an underscore prefix.
- Classes and interfaces should have names that stand alone to tell what they do without having to refer to the namespace, read well, and are as short as possible without losing functionality information or leading to ambiguity. Notes:
- If necessary for clarity or to prevent ambiguity, include the last component of the namespace in the name.
- Exception for Drupal 8.x: due to the way database classes are loaded, do not include the database engine name (MySQL, etc.) in engine-specific database class names.
- Exception for test classes: Test classes only need to be unambiguous within the context of the module they are testing.
- CGov* variables should be listed as Cgov* to prevent
Public method name "CGovSiteTest::testCGovSiteProfile" is not in lowerCamel format
errors- (or should we create an exception to the coding standards to allow the CGov* format?)