grunt-phpmetrics
Grunt plugin for running PHP Metrics.
Getting started
- Install grunt-phpmetrics
npm install grunt-phpmetrics --save-dev
-
Add this to your project's
Gruntfile.js
:
grunt.loadNpmTasks('grunt-phpmetrics');
Usage Example
Run this task with the grunt phpmetrics
command.
phpmetrics: options: bin: 'vendor/bin/phpmetrics' //path to bin phpmetrics file reportHtml: 'report.html' //example configuration application: dir: 'test/' //path to directory for phpmetrics
Target Properties
dir
Type: String
|| Array
The file or directory to analyze.
Options
For more information about options check configuration options of PHP Metrics.
bin
Type: String
Default: phpmetrics
The path to phpmetrics
.
(For composer, use vendor/bin/phpmetrics
).
config
Type: String
Default: null
Path to config file (YAML) config.yml
reportHtml
Type: String
Default: null
Path to save report in HTML format. report.html
reportXml
Type: String
Default: null
Path to save report in XML format. report.xml
reportCli
Type: Boolean
Default: null
Enable report in terminal.
violationsXml
Type: String
Default: null
Path to save violations in XML format. violations.xml
reportCsv
Type: String
Default: null
_ Path to save summary report in CSV format. report.csv
_
reportJson
Type: String
Default: null
Path to save detailed report in JSON format. report.json
chartBubbles
Type: String
Default: null
Path to save Bubbles chart, in SVG format. charts.svg
level
Type: Integer
Default: null
Depth of summary report. 3
extensions
Type: String
Default: null
Regex of extensions to include. php|inc
excludedDirs
Type: String
Default: null
Regex of subdirectories to exclude. cache|vendor
symlinks
Type: Boolean
Default: null
_Enable following symlinks. _
withoutOOP
Type: Boolean
Default: null
If provided, tool will not extract any information about OOP model (faster).
failureCondition
Type: String
Default: null
Optional failure condition, in english. Example: average.maintainabilityIndex < 50 or sum.loc > 10000
templateTitle
Type: String
Default: null
Title for the HTML summary report