Skip to content
Snippets Groups Projects
Commit fa8e809d authored by Klaus Purer's avatar Klaus Purer
Browse files

Issue #2002184 by klausi, Mile23: Create composer.json to provide Drupal code...

Issue #2002184 by klausi, Mile23: Create composer.json to provide Drupal code sniffer rules as external library.
parent 920166d6
No related branches found
No related tags found
No related merge requests found
......@@ -2,42 +2,59 @@
Drupal Code Sniffer
-------------------------------------------------------------------------------
Drupal Code Sniffer (drupalcs) is a coding standard validation tool for Drupal
and contributed modules/themes.
Drupal Code Sniffer is a coding standard validation tool for Drupal and contributed
modules/themes.
Online documentation: http://drupal.org/node/1419980
Online documentation: https://drupal.org/node/1419980
Installation
------------
Installation: PEAR
------------------
Requirements:
- PEAR
- PHPCS 1.3.5 or newer
- PHPCS 1.4.1 or newer
- Install PEAR ( http://pear.php.net/manual/en/installation.php )
- Install PHPCS ( http://pear.php.net/package/PHP_CodeSniffer )
- Sym-link the drupalcs directory into the standards folder for PHP_CodeSniffer.
The code for that looks like this:
$> sudo ln -sv /path/to/drupalcs/Drupal $(pear config-get php_dir)/PHP/CodeSniffer/Standards
$> sudo ln -sv /path/to/coder/coder_sniffer/Drupal $(pear config-get php_dir)/PHP/CodeSniffer/Standards
Please see the online documentation for more detailed instructions:
http://drupal.org/node/1419988
https://drupal.org/node/1419988
Installation: Drush
-------------------
While drupalcs can be used as a standalone set of rules for PHP_CodeSniffer,
While Coder Sniffer can be used as a standalone set of rules for PHP_CodeSniffer,
drush command support is included to facilitate ease of use, installation,
and leveraging of drush features such as site aliasing.
Extract the contents of the drupalcs project into one of the locations specified
Extract the contents of the Coder project into one of the locations specified
in the drush README.txt COMMANDS section, such as the subdirectory of the
.drush folder in your home directory. For other alternatives, please see
http://drupal.org/node/1419988
Installation: Composer
----------------------
You can also use Coder Sniffer as a library with Composer:
"require": {
"drupal/coder": "*"
}
"composer install" will fetch all necessary dependencies and you can then use/execute
PHPCS locally in your project:
./vendor/bin/phpcs --standard=coder_sniffer/Drupal /path/to/code/to/review
Usage (running in a shell)
--------------------------
......
{
"name": "drupal/coder",
"type": "library",
"description": "Coder is a library and a module to review Drupal code.",
"homepage": "https://drupal.org/project/coder",
"support": {
"issues": "https://drupal.org/project/issues/coder",
"source": "https://drupal.org/project/coder"
},
"keywords": ["phpcs", "standards", "code review"],
"license": "GPL-2.0+",
"require": {
"php": ">=5.2.0",
"squizlabs/php_codesniffer": ">=1.4.6"
},
"require-dev": {
"phpunit/phpunit": "3.7"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment