You are here

README.txt in Coder 7.2

-------------------------------------------------------------------------------
                            Drupal Code Sniffer
-------------------------------------------------------------------------------

Drupal Code Sniffer is a coding standard validation tool for Drupal and contributed
modules/themes.

Online documentation: https://drupal.org/node/1419980


Installation: PEAR
------------------

Requirements:
  - PEAR
  - 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/coder/coder_sniffer/Drupal $(pear config-get php_dir)/PHP/CodeSniffer/Standards

Please see the online documentation for more detailed instructions:

  https://drupal.org/node/1419988


Installation: Drush
-------------------

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 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)
--------------------------

$> phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme /path/to/drupal_module

Usage (drush)
-------------

$> drush drupalcs sites/all/modules/custom

Working with Editors
--------------------
Drupal Code Sniffer can be used with various editors.

Editors:

eclipse: http://drupal.org/node/1420004
Komodo: http://drupal.org/node/1419996
Netbeans: http://drupal.org/node/1420008
Sublime Text: http://drupal.org/node/1419996
vim: http://drupal.org/node/1419996


Attention
---------
This is still a draft!!
Please cross check with http://drupal.org/coding-standards and
http://drupal.org/project/coder if the validation is correct

Known Issues:
Documentation Tags just rarly supported - there are many missing / disabled sniffs

File

coder_sniffer/README.txt
View source
  1. -------------------------------------------------------------------------------
  2. Drupal Code Sniffer
  3. -------------------------------------------------------------------------------
  4. Drupal Code Sniffer is a coding standard validation tool for Drupal and contributed
  5. modules/themes.
  6. Online documentation: https://drupal.org/node/1419980
  7. Installation: PEAR
  8. ------------------
  9. Requirements:
  10. - PEAR
  11. - PHPCS 1.4.1 or newer
  12. - Install PEAR ( http://pear.php.net/manual/en/installation.php )
  13. - Install PHPCS ( http://pear.php.net/package/PHP_CodeSniffer )
  14. - Sym-link the drupalcs directory into the standards folder for PHP_CodeSniffer.
  15. The code for that looks like this:
  16. $> sudo ln -sv /path/to/coder/coder_sniffer/Drupal $(pear config-get php_dir)/PHP/CodeSniffer/Standards
  17. Please see the online documentation for more detailed instructions:
  18. https://drupal.org/node/1419988
  19. Installation: Drush
  20. -------------------
  21. While Coder Sniffer can be used as a standalone set of rules for PHP_CodeSniffer,
  22. drush command support is included to facilitate ease of use, installation,
  23. and leveraging of drush features such as site aliasing.
  24. Extract the contents of the Coder project into one of the locations specified
  25. in the drush README.txt COMMANDS section, such as the subdirectory of the
  26. .drush folder in your home directory. For other alternatives, please see
  27. http://drupal.org/node/1419988
  28. Installation: Composer
  29. ----------------------
  30. You can also use Coder Sniffer as a library with Composer:
  31. "require": {
  32. "drupal/coder": "*"
  33. }
  34. "composer install" will fetch all necessary dependencies and you can then use/execute
  35. PHPCS locally in your project:
  36. ./vendor/bin/phpcs --standard=coder_sniffer/Drupal /path/to/code/to/review
  37. Usage (running in a shell)
  38. --------------------------
  39. $> phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme /path/to/drupal_module
  40. Usage (drush)
  41. -------------
  42. $> drush drupalcs sites/all/modules/custom
  43. Working with Editors
  44. --------------------
  45. Drupal Code Sniffer can be used with various editors.
  46. Editors:
  47. eclipse: http://drupal.org/node/1420004
  48. Komodo: http://drupal.org/node/1419996
  49. Netbeans: http://drupal.org/node/1420008
  50. Sublime Text: http://drupal.org/node/1419996
  51. vim: http://drupal.org/node/1419996
  52. Attention
  53. ---------
  54. This is still a draft!!
  55. Please cross check with http://drupal.org/coding-standards and
  56. http://drupal.org/project/coder if the validation is correct
  57. Known Issues:
  58. Documentation Tags just rarly supported - there are many missing / disabled sniffs