2017 © Pedro Peláez
 

library code-quality-threshold

image

piotrpasich/code-quality-threshold

  • Saturday, February 14, 2015
  • by piotrpasich
  • Repository
  • 5 Watchers
  • 35 Stars
  • 1,919 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 2 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Code Quality Threshold

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)., (*1)

Installation

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

Configuration

To your composer.json file you might add, (*2)

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

And execute the command, (*3)

composer quality-test

You can also add this script to already existing scripts like post-update-cmd., (*4)

Reports

If the test throws an exception you can always ask for the report:, (*5)

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, (*6)

Then you need to add to your composer.json file the extra option:, (*7)

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

The example yml file might look like:, (*8)

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., (*9)

The Versions