1.0.0 • Published 8 years ago

gulp-phpmetrix v1.0.0

Weekly downloads
9
License
-
Repository
github
Last release
8 years ago

Run your phpmetrics analysis with gulp

npm Build Status Dependency Status devDependency Status Coverage Status

Usage

First, install gulp-phpmetrix as a development dependency:

npm install gulp-phpmetrix --save-dev

Then, add it to your gulpfile.js:

// Vanilla gulp task to run phpmetrics
var gulp = require('gulp');

var phpmetrix = require("gulp-phpmetrix").phpmetrix;

gulp.src('')
    .pipe(phpmetrix('phpmetrix.yml'))
    .on('error', function(e) { throw e });

Then add a phpmetrix.yml to the root of your site. Here's an example:

default:
    rules:
        cyclomaticComplexity: [ 10, 6, 2 ]
        maintainabilityIndex: [ 0, 75, 95 ]

    failure: average.maintainabilityIndex < 50 or sum.loc > 10000

    path:
        directory: .
        extensions: php
        exclude: grunt|node_modules|public|storage|vendor

    logging:
        report:
            #cli:    true
            xml:    ./public/reports/phpmetrics.xml
            html:   ./public/reports/phpmetrics.html
            csv:    ./public/reports/phpmetrics.csv
        violations:
            xml:    ./public/reports/violations.xml
        chart:
            bubbles: ./public/reports/bubbles.svg

License

MIT License