定制 fperezco/captainhook-conventional-branchs-commits 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fperezco/captainhook-conventional-branchs-commits

Composer 安装命令:

composer require fperezco/captainhook-conventional-branchs-commits

包简介

Captain hook conventional branchs and commits is just a 'hook' to check that a commit, in a conventional branching model, follows the conventional rules.

README 文档

README

Captain hook conventional branch commits is just a 'hook' to check that a commit, in a conventional branching model, follows the conventional rules.

Usage

The conventional branch and commit checker script will be executed on every commit.

By default, the branch should follow the conventional branches rules: https://conventional-branch.github.io/

And, by default, the commits the conventional commits rules: https://www.conventionalcommits.org/en/v1.0.0/

If the branch or commit message does not follow the rules, the commit will be rejected.

Installation

Previously you have should installed captainhook in your project. See: https://github.com/captainhookphp/captainhook

Install this package using:

composer require --dev fperezco/captainhook-conventional-branchs-commits

After that, you should configure the commit-msg hook by doing:

vendor/bin/captainhook-conventional-branchs-commits configure

That command will install the selected config in the commit-msg hook in captainhook.json. By default( option 1), empty configuration so only check for standard conventional commits and branches will be installed.

Configuration

The available variables in the commit-msg hook section for this validator are:

"branchPattern": "/^(develop|master|main|(feature|bugfix|hotfix|chore|release)\\/\\w+(-.*)?)$/",
"commitPattern": "/^(customcommit|patterncommit): [A-Za-z0-9-]+$/",

"branchShouldIncludeTicketCode": true,
"branchTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

"commitShouldIncludeTicketCode": true,
"commitTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

"commitAndBranchShouldIncludeTheSameTicketCode": true,
"commitAndBranchCommonTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",
"commitAndBranchCommonTicketCodePatternBranchExceptionsPattern": "/^(develop|master|main)$/"

The main variables are those to define the branchPattern and commitPattern.

The pattern that the branch should follow. If no provided, the default is the conventional branches pattern:

"branchPattern": '/^(develop|master|main|(feature|bugfix|hotfix|chore|release)\/[A-Za-z0-9-]+)$/'

The pattern that the commit should follow. If no provided, the default is the conventional commits pattern (in this case skipping Merge commits):

commitPattern: /^(Merge.*|(feat|fix|build|chore|ci|docs|style|refactor|perf|test)(\([A-Za-z0-9-]+\))?: .+)/'

If your project requires to provide a specific ticket code always you can set this section, by default/not defined the check is disabled:

"branchShouldIncludeTicketCode": true,
"branchTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

If your project requires to provide a specific ticket code in the commit message, you can set this section, by default/not defined the check is disabled:

"commitShouldIncludeTicketCode": true,
"commitTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

If your project requires that the commit and branch should have the same ticket code in the branch name and in the commit message , you can set this section, by default/not defined the check is disabled:

"commitAndBranchShouldIncludeTheSameTicketCode": true,
"commitAndBranchCommonTicketCodePattern": "/[A-Z]+-[0-9]+/",
"commitAndBranchCommonTicketCodePatternBranchExceptionsPattern": "/^(develop|master|main)$/"

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change

License

MIT

fperezco/captainhook-conventional-branchs-commits 适用场景与选型建议

fperezco/captainhook-conventional-branchs-commits 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 fperezco/captainhook-conventional-branchs-commits 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fperezco/captainhook-conventional-branchs-commits 我们能提供哪些服务?
定制开发 / 二次开发

基于 fperezco/captainhook-conventional-branchs-commits 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 68
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 29
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-10