Git: pre-receive hook with PHP_CodeSniffer

后端 未结 10 1743
情话喂你
情话喂你 2021-02-04 07:51

Since switching from SVN to Git, we lost the ability to enforce our coding standards through a pre-commit hook on the subversion server.

With Git, you only

10条回答
  •  無奈伤痛
    2021-02-04 08:23

    I used this hook: http://criticallog.thornet.net/2011/06/02/running-php-linter-before-pushing-changes-to-a-git-repository/

    and modified it to also test code with phpcs.

    Might contain some bugs and I have hardcoded drupal code standard but it works! http://pastebin.com/fEmN519B

提交回复
热议问题