This file describes how to use the FireGento Code Sniffer.
Version: 1.1.0
cd /path/to/pear/
cd PHP/CodeSniffer/Standards
git clone https://github.com/firegento/phpcs.git FireGento
Note: If your current user doesn't have enough rights to create a directory in the pear directory you might type "sudo" before "git clone".
cd /path/to/module/
phpcs --extensions=php --standard=FireGento src/
You'll find the installation instructions for PEAR in the official documentation here: http://pear.php.net/manual/en/installation.getting.php
You should use the following command to install the PHP CodeSniffer:
pear install PHP_CodeSniffer
Maybe you don't need a coding standard, but we believe that a coherent coding standard for all modules is a good thing. It will make the code of a module easier to read and maintain, especially when multiple developers are working on the same module.
You need to know the directory of your PHP_CodeSniffer install. You can do this by opening a terminal/shell and typing in the following:
pear config-get php_dir
Then you should see a directory printed on the screen which represents your PEAR directory, e.g.
/usr/lib/php/pear/
Fixing tons of coding standard problems by hand is tedious, especially on a large codebase. Luckily there is a tool called PHP Coding Standard Fixer which helps you to programmatically fix some coding standard problems and hopefully reduces the PHP_CodeSniffer result.
You can use the following command for fixing some common coding standard problems:
php-cs-fixer.phar fix path/to/module/ --fixers=indentation,linefeed,trailing_spaces,phpdoc_params,visibility,braces,include,php_closing_tag,controls_spaces,elseif,eof_ending
FireGento Team
- Website: http://firegento.com
- Twitter: @firegento
GNU General Public License, version 3 (GPLv3)
(c) 2013 FireGento Team