PHP_CodeSniffer rules (sniffs) to enforce FunPlus coding conventions
Installs: 116
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 23
Forks: 1
Open Issues: 0
pkg:composer/fp-coding-standards/fpcs
Requires
This package is not auto-updated.
Last update: 2017-01-30 07:51:26 UTC
README
This project is a collection of PHP_CodeSniffer rules (sniffs) to validate code developed for FunPlus.
Installation
Composer
Standards can be installed with Composer dependency manager:
composer create-project fp-coding-standards/fpcs:dev-master --no-dev
Running this command will:
- Install FunPlus standards into
fpcsdirectory. - Install PHP_CodeSniffer.
- Register FunPlus standards in PHP_CodeSniffer configuration.
- Make
phpcscommand available fromfpcs/vendor/bin.
For convenience of using phpcs as global command you might want to add path to fpcs/vendor/bin directory to a PATH environment of your operating system.
Standalone
Install PHP_CodeSniffer by following its installation instructions (via Composer, PEAR, or Git checkout).
Do ensure, if for example you're using VVV, that PHP_CodeSniffer's version matches our requirements (you can check the required version in composer.json).
Clone FunPlus standards repository:
git clone -b master https://github.com/funplus/FunPlus-Coding-Standards.git fpcsAdd its path to PHP_CodeSniffer configuration:
phpcs --config-set installed_paths /path/to/fpcs
To summarize:
cd ~/projects git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs git clone -b master https://github.com/funplus/FunPlus-Coding-Standards.git fpcs cd phpcs ./scripts/phpcs --config-set installed_paths ../fpcs
And then add the ~/projects/phpcs/scripts directory to your PATH environment variable via your .bashrc.
You should then see FunPlus et al listed when you run phpcs -i.
How to use
Command line
Run the phpcs command line tool on a given file or directory, for example:
phpcs --standard=FunPlus somephpfile.php
Standards subsets
The project encompasses a super–set of the sniffs that the FunPlus community may need. If you use the FunPlus standard you will get all the checks.
You can use the following as standard names when invoking phpcs to select sniffs, fitting your needs:
FunPlus— all of the sniffs in the project.
Using custom ruleset
If you need to further customize selection of sniffs for your project — you can create custom ruleset.xml standard. See fully annotated example in PHP_CodeSniffer documentation.
License
See LICENSE (MIT).