Tools for Checking Magento 2 Coding Standards

coding-standardsmagento-2.1magento2

I am currently working on Magento 2 coding standard checking project.

Is any other tool available, other than PHP_CodeSniffer, to check Magento 2 and PHP coding standing?

Best Answer

Magento 2 use ECGM2 coding standard

You can download from here

https://github.com/magento-ecg/coding-standard

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:

  1. raw SQL queries; SQL queries inside a loop;
  2. direct instantiation of Mage and Enterprise classes;
  3. unnecessary collection loading;
  4. excessive code complexity;
  5. use of dangerous functions; use of PHP Superglobals;

and many others.

  1. Ecg for Magento
  2. EcgM2 for Magento 2

Both Magento and Magento 2 are supported.

Related Topic