Closed SimonXT closed 9 years ago
So I guess this message below that I got when running git commit
was due to this issue then:
ardnet$ git commit lightlazyloader.module -m "Test for codesniffer pre-commit"
************************************************************************
* *
* GIT PRE-COMMIT HOOK FOR DRUPAL *
* *
* In order to commit your changes, it must pass the four filters: *
* I. Syntax checking using PHP Linter *
* II. Coding standards checking using PHP Code Sniffer *
* III. Blacklisted functions checking/validation. *
* IV. Check Javascript syntax. *
* *
************************************************************************
File(s) to be processed/validated:
lightlazyloader.module
Validating: lightlazyloader.module...
I. Running the PHP Linter...
No syntax errors detected in lightlazyloader.module
II. Running the PHP Code Sniffer...
ERROR: the "Drupal" coding standard is not installed. The installed coding standards are MySource, PEAR, PHPCS, PSR1, PSR2, Squiz and Zend
Invalid operation.
coz when i run it using drush drupalcs
it seems like it managed to detect my bad code, means it looks working fine to me:
ardnet$ drush drupalcs
FILE: /Library/WebServer/Documents/2472989/lightlazyloader.module
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
11 | ERROR | [x] Whitespace found at end of line
12 | ERROR | [x] Opening brace should be on the same line as the
| | declaration
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Time: 77ms; Memory: 5.25Mb
PHP_CodeSniffer found at least one issue.
Please note that i'm using the latest version of Coder module for Drupal 8 with CodeSniffer v.2.3.2.
Worth noting that for Drupal 7, PHP_CodeSniffer needs to be running the 1.x branch. The instructions in the README.md install the lastest 2.x branch. Took me a little while to work this out, so mentioning incase anyone else has this problem.
Source: https://www.drupal.org/node/2342611
At this time the stable release is 1.5.6, so would need to use:
Drupal 8 Coder 2.x will support PHP_CodeSniffer 2.x.
EDIT: PHP_CodeSniffer releases listed here: http://pear.php.net/package/PHP_CodeSniffer/download