unh3ck3d/php-cs-fixer-git-hook 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

unh3ck3d/php-cs-fixer-git-hook

最新稳定版本:v1.0.0

Composer 安装命令:

composer require unh3ck3d/php-cs-fixer-git-hook

包简介

Git hook running PHP CS Fixer on staged files using CaptainHook

README 文档

README

MIT licensed Code coverage

php-cs-fixer-git-hook

Git hook running PHP CS Fixer on staged files using CaptainHook
Report Bug · Request Feature

About The Project

Git hook that with each git commit command runs Php Cs Fixer on staged files to automatically fix them and re-stage before committing.

(back to top)

Requirements

(back to top)

Installation

  1. Install package as a dev dependency using composer
    composer require --dev unh3ck3d/php-cs-fixer-git-hook
    
  2. Add the following code to your captainhook.json configuration file
    {
      "pre-commit": {
        "enabled": true,
        "actions": [
          {
            "action": "\\Unh3ck3d\\PhpCsFixerGitHook\\LintStagedFiles"
          }
        ]
      }
    }
    
  3. Install newly added hook by following CaptainHook docs

That's it. From now on after running git commit files that were staged will be automatically fixed by Php Cs Fixer.

(back to top)

Configuration

You can customize the behaviour how git hook is run by changing following options

Option Description
phpCsFixerPath Path to Php Cs Fixer executable. Defaults to ./vendor/bin/php-cs-fixer.
pathMode path-mode cli option of Php Cs Fixer. Defaults to intersection.
config config cli option of Php Cs Fixer. Defaults to .php-cs-fixer.dist.php.
additionalArgs String of additional arguments that will be passed to Php Cs Fixer process.

e.g.

{
  "pre-commit": {
    "enabled": true,
    "actions": [
      {
        "action": "\\Unh3ck3d\\PhpCsFixerGitHook\\LintStagedFiles",
        "options": {
            "phpCsFixerPath": "php-cs-fixer.phar",
            "pathMode": "overwrite",
            "config": ".php-cs-fixer.php",
            "additionalArgs": "-v --dry-run --diff"
        }
      }
    ]
  }
}

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

统计信息

  • 总下载量: 8.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固