定制 piotrpasich/code-quality-threshold 二次开发

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

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

piotrpasich/code-quality-threshold

最新稳定版本:v0.2

Composer 安装命令:

composer require piotrpasich/code-quality-threshold

包简介

README 文档

README

This extension is purposed to run every necessary tool to check the code against violation from composer (ex. tools - PHP Mess Detector, PHP Code Sniffer, PHP Dead Code Detector, PHP Copy Paste).

Installation

composer require piotrpasich/code-quality-threshold:dev-master --dev

Configuration

To your composer.json file you might add

"scripts": {
    "quality-test": [
        "piotrpasich\\CodeQualityThreshold\\Composer\\ScriptHandler::checkThresholds"
    ]
},

And execute the command

composer quality-test

You can also add this script to already existing scripts like post-update-cmd.

Reports

If the test throws an exception you can always ask for the report:

composer quality-test -v

Advanced configuration

This plugin checks the app folder by default, but you can always change this behavior by creating yml file. This might be placed wherever you want, ex. app/Config/cqt.yml

Then you need to add to your composer.json file the extra option:

"extra": {
    "cqt-parameters": {
        "file": "app/Config/cqt.yml"
    }
}

The example yml file might look like:

phpmd:
    class: piotrpasich\CodeQualityThreshold\Tool\Phpmd
    options:
        threshold: 42
        directory: src
        rules: Config/Phpmd/ruleset.xml

phpcs:
    class: piotrpasich\CodeQualityThreshold\Tool\Phpcs
    options:
        threshold: 42
        rules: Config/Phpcs/ruleset.xml
        directory: src

phpcpd:
    class: piotrpasich\CodeQualityThreshold\Tool\Phpcpd
    options:
        threshold: 42
        directory: src

Phpdcd:
    class: piotrpasich\CodeQualityThreshold\Tool\Phpdcd
    options:
        directory: src
        threshold: 21

Adding new tools

To add new tool you need to specify new record in yml file (look at the Advanced configuration chapter) and create a class extending Tool abstract class from the plugin.

统计信息

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

GitHub 信息

  • Stars: 36
  • Watchers: 4
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-13