Code Monkey home page Code Monkey logo

coding-standard's Introduction

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

coding-standard's People

Contributors

zlik avatar pborreli avatar philwinkle avatar tkn98 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.