Skip to content

karthibillproj/coding-standard

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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:

  • raw SQL queries;
  • SQL queries inside a loop;
  • direct instantiation of Mage and Enterprise classes;
  • unnecessary collection loading;
  • excessive code complexity;
  • use of dangerous functions;
  • use of PHP superglobals;

and many others.

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

Run CodeSniffer:

phpcs --standard=/path/to/Ecg/standard /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.

About

Magento PHP_CodeSniffer Coding Standard

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.2%
  • C++ 1.3%
  • Pascal 0.5%