joaorobertopb/php-githook-sniffer

Php-GitHook-Sniffer 是一个简单的自动化任务集合,您可以通过 git 仓库中的钩子来执行这些任务。

0.0.5 2018-02-23 14:22 UTC

This package is auto-updated.

Last update: 2024-09-06 00:36:39 UTC


README

README 葡萄牙语.

Build Status Latest Stable Version Total Downloads Latest Unstable Version Code Coverage Quality Score Software License

Php-GitHook-Sniffer 是一个简单的自动化任务集合,您可以通过 git 仓库中的钩子来执行这些任务。

可用的钩子

  • pre-commit

pre-commit

检查提交的文件

  • 检查 PHP 语法(使用 PHPLint)
  • 根据 PSR2 标准修复代码风格

示例

验证语法

php-lint

应用 PSR2 规则

php-cs-fix

其他钩子

即将推出。

安装

composer.json 中添加 joaorobertopb/php-githook-sniffer 作为开发依赖项

"require-dev": {
    "joaorobertopb/php-githook-sniffer": "~0.0.5"
}

或者通过 Composer

$ composer require joaorobertopb/php-githook-sniffer --dev

将 src/Hooks/pre-commit 复制到 .git/hooks。(需要执行权限)

$ php -r "if(file_exists('./.git')&&file_exists('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit')){copy('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit','./.git/hooks/pre-commit');chmod('./.git/hooks/pre-commit',0777);}"

或者

"scripts": {
    "post-install-cmd": [
      "php -r \"if(file_exists('./.git')&&file_exists('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit')){copy('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit','./.git/hooks/pre-commit');chmod('./.git/hooks/pre-commit',0777);}\""
    ],
    "post-update-cmd": [
      "php -r \"if(file_exists('./.git')&&file_exists('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit')){copy('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit','./.git/hooks/pre-commit');chmod('./.git/hooks/pre-commit',0777);}\""
    ]
}

变更日志

请参阅 CHANGELOG 以获取最近更改的更多信息。

测试

即将推出。

致谢

许可证

MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件