Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git 钩子检查 PHP 语法和代码规范 #113

Open
codcodog opened this issue Mar 17, 2019 · 0 comments
Open

Git 钩子检查 PHP 语法和代码规范 #113

codcodog opened this issue Mar 17, 2019 · 0 comments
Labels

Comments

@codcodog
Copy link
Owner

场景

每次提交代码都要手动执行 php 的语法检查和代码规范,如何在客户端把这些工作进行自动化。

方案

利用 git 的钩子,这里使用的是 pre-commit.

具体脚本参考:pre-commit

如果该钩子以非零值退出,Git 将放弃此次提交,不过你可以用 git commit --no-verify 来绕过这个环节

依赖

pre-commit 脚本依赖 php 两个包,需要 composer 安装.

  • php-cs-fixer
  • php-parallel-lint

参考
Git 钩子

@codcodog codcodog added the Git label Mar 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant