1

I am using this PHP Library here https://github.com/bruli/php-git-hooks, this library uses phpcs (https://github.com/squizlabs/PHP_CodeSniffer)

I have a php-git-hooks.yml config file like this

pre-commit:
  enabled: true
  execute:
    phpcs:
        enabled:     true
        standard:    my-custom-cs.xml

I am trying to use a custom standards file. I get this error

 [PhpGitHooks\Module\Configuration\Contract\Exception\InvalidPhpCsStandardException]  
 Invalid phpcs standard <my-custom-cs.xml>

Specifying a built in standard such as standard: PSR2 does work.

How can I specify a custom file? Judging by the libraries code at https://github.com/bruli/php-git-hooks/blob/528a9a4c5905e9f5ca7bdb55f5111dd4fe22ca9c/src/PhpGitHooks/Module/Configuration/Domain/PhpCsStandard.php#L22 this may not even be possible?

Sam Anthony
  • 1,669
  • 2
  • 22
  • 39
  • I raised an issue on the github project, I believe this has been corrected in newer versions of the library https://github.com/bruli/php-git-hooks/issues/96 – Sam Anthony Sep 10 '17 at 13:08

1 Answers1

0

you need to add the new standard as normal you do it. For example i add the WPCS. I clone into the phpcs Standard folder /vendor/****/Standard and i follow the instruction from https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards as standard alone installationa and it detect pretty well.

gfirem
  • 328
  • 3
  • 8