AOEpeople/magento2-coding-standard

Name: magento2-coding-standard

Owner: AOE

Description: null

Created: 2017-04-13 09:23:38.0

Updated: 2017-04-16 17:47:28.0

Pushed: 2017-04-13 11:58:01.0

Homepage: null

Size: 78

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ECG Magento Code Sniffer Coding Standard

SensioLabsInsight Medal

ECG Magento Code Sniffer Coding Standard is a set of rules and sniffs for PHP_CodeSniffer tool.

It allows automatically check your code against some of the common Magento and PHP coding issues, like:

and many others.

Update: Magento 2 standard just released. Try it out:
pcs --config-set installed_paths ./vendor/magento-ecg/coding-standard
pcs --standard=EcgM2 /path/to/code

Installation & Usage

Before starting using our coding standard install PHP_CodeSniffer.

Clone or download this repo somewhere on your computer or install it with Composer. To do so, add the dependency to your composer.json file by running composer require magento-ecg/coding-standard.

Add the standards directory to PHP_CodeSniffer installed paths:

pcs --config-set installed_paths ./vendor/magento-ecg/coding-standard

Select a standard to run with CodeSniffer:

Run CodeSniffer:

pcs --standard=Ecg /path/to/code
pcs --standard=EcgM2 /path/to/code

PHP CodeSniffer will automatically scan Magento PHP files. To check design templates, you can specify phtml in the --extensions argument: --extensions=php,phtml.

Requirements

PHP 5.4 and up.

Checkout the php-5.3-compatible branch to get the PHP 5.3 version.

Contribution

Please feel free to contribute new sniffs or any fixes or improvements for the existing ones.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.