Git: pre-receive hook with PHP_CodeSniffer

后端 未结 10 1799
情话喂你
情话喂你 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:34

    We do now employ pre-commit hooks that both check the code and the commit message.

    Developers can skip them with -n, but they rarely do and we always have another developer doing QA so things get noticed.

    The hook is important because it notices when files are broken, so that broken PHP or JS doesn't get committed at all.

    Find them hook code at https://github.com/netresearch/git-client-hooks

    We use a central server for development, and our git hooks get automatically installed because we provide a central git repository template that gets used automatically when you git clone or git init.

提交回复
热议问题