Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
也许这为您指明了正确的方向:(原文来自:http://www.squatlabs .de/versionierung/arbeiten-git-hooks(德语))
您必须编辑 exec 行 exec('php -l... 以指向您的codesniffer 安装。
Maybe this point you in the right direction: (Orginal from: http://www.squatlabs.de/versionierung/arbeiten-git-hooks in German)
You will have to edit the exec line exec('php -l... to point to your codesniffer installation.
好的,我找到了解决方案:)
这是概念验证代码:)用于预接收挂钩:
此示例代码只会打印远程存储库收到的 blob,但这足以让需要类似内容的人继续(我希望)。
您可以将每个 blob 放入某个临时文件中,在该文件上运行您需要的任何内容,删除该文件等等...
Ok I found the solution :)
This is proof of concept code :) for pre-receive hook:
This example code will only print blobs received by remote repository but it's enough to get someone needing something like that going (I hope).
You can put every blob in some temporary file run whatever you need on this file delete the file and so on...
这可能会有所帮助: http://github.com/s0enke /git-hooks/tree/master/phpcs-pre-commit/
This might help: http://github.com/s0enke/git-hooks/tree/master/phpcs-pre-commit/
我开发了一个基于 PHPCodeSniffer 的预接收 git hook,用于检查 PHP、JavaScript 和 CSS 文件的代码样式。
我的脚本可以从 Github 获取:
https://github.com/blueicefield/PHP_CodeSniffer_GIT_Hook
I developed a pre-receive git hook based on PHPCodeSniffer to check the code styling of PHP, JavaScript and CSS files.
My script is available from Github :
https://github.com/blueicefield/PHP_CodeSniffer_GIT_Hook