Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
phpcs has an option to output the "sniff codes" of the violations that occur. This is very helpful to pinpoint the exact sniff that has thrown a warning. It would be nice to pass through this option.
$ phpcs --help
Usage: phpcs [-nwlsaepvi] [-d key[=value]]
...
-s Show sniff codes in all reports
$ phpcs --standard=Drupal -s .
FILE: ...odules/paddle_editorial_notes/paddle_editorial_notes.features.field.inc
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 3 WARNING(S) AFFECTING 3 LINE(S)
--------------------------------------------------------------------------------
13 | WARNING | Line exceeds 80 characters; contains 81 characters
| | (Drupal.Files.LineLength.TooLong)
--------------------------------------------------------------------------------
Comment | File | Size | Author |
---|---|---|---|
#1 | 2106375-1-coder-show-sniffs.patch | 879 bytes | pfrenssen |
Comments
Comment #1
pfrenssenHere is a patch that passes through the option "drush dcs --show-sniffs" to phpcs.
Comment #2
pfrenssenThe patch is identical for 7.x-2.x and 8.x-2.x. Let's apply it to 8.x first.
Comment #3
klausirunning with drush is not supported anymore, just use phpcs with -s.