The phpcs/phpcbf standard in use is a modified Drupal standard, so you call the standard of "Drupal":
phpcbf --standard="Drupal" filename.php
However, if you ALSO have unmodified copies of the Drupal standard installed, the trick is to make sure that you're calling the correct version of phpcbf. For instance, I get this:
mycomputer» which phpcbf
/home/jon/local/civicrm-buildkit/bin/phpcbf
If your default phpcbf isn't the one installed with civicrm-buildkit
, make sure to specify the full path to the one that is.
If that doesn't work:
civilint
is a script. So you can edit it in a text editor. In the latest version, line 179 reads:
xargs $BINDIR/phpcs --standard="$PHPCS_STD" < "$TMP/php.txt"
Add an "echo" into it like so:
xargs echo $BINDIR/phpcs --standard="$PHPCS_STD" < "$TMP/php.txt"
Run civilint again:
civilint myfile.php
Instead of outputting the result of phpcs
it should instead show the command it WOULD have run. In my case, it's:
/home/jon/local/civicrm-buildkit/bin/phpcs --standard=/home/jon/local/civicrm-buildkit/vendor/drupal/coder/coder_sniffer/Drupal fastactionlinks.php
Change phpcs
to phpcbf
and run that command:
/home/jon/local/civicrm-buildkit/bin/phpcbf --standard=/home/jon/local/civicrm-buildkit/vendor/drupal/coder/coder_sniffer/Drupal fastactionlinks.php
Note Don't forget to remove the echo
when you're done!