xwillq / captains-hooks
CaptainHook 的附加钩子
1.1.0
2022-09-04 17:19 UTC
Requires
- php: ^8.0
- captainhook/captainhook: ^5.10
- xwillq/git-stage-editor: ^1.0
Requires (Dev)
- laravel/pint: ^1.1
- phpstan/phpstan: ^1.8
- phpstan/phpstan-strict-rules: ^1.4
This package is auto-updated.
Last update: 2024-09-04 21:54:26 UTC
README
我的 Captain Hook 钩子。Captain Hook.
安装
使用 Composer 安装
composer require --dev xwillq/captains-hooks
可用的钩子
FormatPHPFilesInCommit
在提交前运行代码格式化工具,仅格式化已暂存的变更,并应用到工作树中。默认使用 Laravel 的 Pint。
只能用作 pre-commit
钩子。配置
{ "action": "\\Xwillq\\Hooks\\Hooks\\FormatPHPFilesInCommit", "options": { // Exclude files from formatting. "excluded-files": [ // Specify file path. "src/FormatPHPFilesInCommit.php", // Patterns starting with / are treated as a regex. "/tests\/.*/", // Glob pattern. "config/*" ], // Command to execute. Placeholder `{}` gets replaced with path to file. // `vendor/bin/pint {}` is the default value. "formatter": "vendor/bin/pint {}" } }
FixPHPStormMergeMessage
在合并时,PHPStorm 将冲突列表作为注释添加到提交消息正文中。此钩子将移除它们。
只能用作 prepare-commit-msg
钩子。配置
{ "action": "\\Xwillq\\Hooks\\Hooks\\FixPHPStormMergeMessage" }
RemoveCommentsFromCommitMessage
从提交消息中移除注释。可用于在验证之前清理消息。
可用作 pre-commit
、prepare-commit-msg
和 commit-msg
钩子。配置
{ "action": "\\Xwillq\\Hooks\\Hooks\\RemoveCommentsFromCommitMessage" }