This is a full CakePHP Coding Standards stack centered around:
*Tested with CakePHP 2.3.1
**Our install script is only tested on CentOS 6.3 and an old version of Fedora. There are likely major issues with non-yum based Linux flavors. We intend to support other major Linux flavors in future releases as the community grows.
app/Plugin/CodingStandards
app/Config/bootstrap.php
*Console/cake CodingStandards.install
***Code to add
if (Configure::read('debug') > 0) {
CakePlugin::load('CodingStandards', array('bootstrap' => true));
//Configure::write('CodingStandards.ADDITIONAL_PATHS', array('CodingStandards' => Configure::read('CodingStandards.PLUGIN_PATH'))); // Optional - Useful if you have extra paths you want included in full reports. Example here is the coding standards themselves, though you can other other(s).
//Configure::write('CodingStandards.SERVER_NAME', '<Insert Accessible URL HERE>') // Optional and probably server specific -- enables CSS checking & provides full URL for HTML reports
//Also see See app/Plugin/CodingStandards/Config/bootstrap.php for other variables you can tweak
}
**Meant to be run on each server / installation.
Console/cake CodingStandards.check
>> run a full HTML report >> clean up all codeConsole/cake CodingStandards.check
>> run reports on specific file(s) you're concerned about >> clean up specific codegit commit
>> (automatic check run, errors descriptively abort commit, otherwise done)* >> fix >> run git commit
...*You can skip this check via git commit -n
Type | Coding Standard | |
---|---|---|
General (Applied to all files) | Formatting Basics | |
PHP (Models, Controllers, Console, Configuration, ...) | CakePHP Coding Standards | |
CTP (Views, Layouts, Elements, ...) | CakePHP Coding Standards* | |
CSS | W3C CSS Validation | |
JavaScript | jQuery JavaScript Style Guide |
*CakePHP's PHP standards are applied here, but they give a lot of what are probably false-positive errors. Though they can be resolved, we probably need to work on / find a better matching Coding Standard for .ctp files
We'd love your help! See CONTRIBUTING.md