smart-gamma/php-composter-quality-tool

PHP Composter Smart Gamma 质量工具(预提交)

安装次数: 7,180

依赖项: 0

建议者: 0

安全性: 0

星标: 2

关注者: 3

分支: 2

开放问题: 1

类型:php-composter-action

v0.1.11 2018-09-24 12:28 UTC

This package is not auto-updated.

Last update: 2024-09-15 05:28:45 UTC


README

交互式工具将允许项目团队基于预提交的git钩子保持常见的开发代码样式标准。

该工具允许自动将git预提交钩子添加到本地开发机器,并运行一系列质量断言。

  • PHPLint
  • PHPCS
  • php-cs-fixer
  • PHPMD
  • PhpSpec
  • PhpUnit (待办事项)
  • 提交消息包含Jira功能编号,例如AB-123(待办事项)

作为附加功能,它允许使用php-cs-fixer,并自动修复已提交的文件。

预配置

1.1. 为了覆盖默认设置,您可以自动安装tool config.yml以进行进一步修改。

如果您想修改默认工具配置,请向composer.json添加以下行"post-install-cmd" / "post-update-cmd",这将安装默认的config.yml

"PHPComposter\\GammaQualityTool\\Installer::install"

1.2. 对于IDE代码样式格式配置的建议

IDE PHP Scheme

1.3. 添加到 .gitignore

.php_cs.cache

安装

1. 编辑您的composer.json

1.1. 稳定性

"minimum-stability": "dev", 

"prefer-stable": true,

1.2. 必需的分支

直到以下pull request被合并,它将需要以下行添加到composer.json中

"repositories": [
    {
        "type" : "vcs",
        "url" : "git@github.com:Evgenas/php-composter.git"
    }
],

2. 包安装

composer require --dev smart-gamma/php-composter-quality-tool

用法

  1. 编辑源文件
  2. git add files
  3. git commit -m "我的提交"

PHPCS & php-cs-fixer

将启动断言,如果发现在提交中应用到的文件中存在代码样式违规,将提示自动修复这些违规,并重新扫描文件。自动修复的文件将自动添加到最新的提交中。

PHPMD

该工具将扫描PhpMD警告,但不会阻止提交,但会输出列表,并提示您如果想要通过IDE修复一些指示的警告,则重新扫描您的提交文件。