AnthonysWebLLC / CodingStandards

CakePHP Plugin which assists with keeping Coding Standards
0 stars 0 forks source link

About

This is a full CakePHP Coding Standards stack centered around:

Requirments

*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.

Install

  1. Copy files to app/Plugin/CodingStandards
  2. Load Plugin in app/Config/bootstrap.php*
  3. Install via 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.

Use

  1. Run Console/cake CodingStandards.check >> run a full HTML report >> clean up all code
  2. Run Console/cake CodingStandards.check >> run reports on specific file(s) you're concerned about >> clean up specific code
  3. Run git commit >> (automatic check run, errors descriptively abort commit, otherwise done)* >> fix >> run git commit ...

*You can skip this check via git commit -n

Standards

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

Formatting Basics

Why Coding Standards?

Contributing

We'd love your help! See CONTRIBUTING.md