-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configuration file #256
Comments
Hi, v2 does not support configuration files yet. Do you use PhpMetrics v2 ? |
Hi Halleck, Same problem here, i want to block a CI if class / method are too complex, and .phpmetrics respond well for this job :) did you know when we can use this feature for v2 ? :) Thanks for all your awesome job 👍 |
Added support for passing configuration options via config files instead of command line for now in #303 |
so the ".phpmetrics.yml" is not valid anymore? Is there a example for a ".phpmetrics.json" config? I don't know if this config is 100% correct, but this is what I have found in the code: ".phpmetrics.json" {
"extensions": [
"php"
],
"exclude": [
"infra",
"tests",
"composer",
"archiv",
"vendor",
"thirdparty",
"generated",
"tmp"
],
"report-xml": "./build/report/phpmetrics.xml",
"report-html": "./build/report/phpmetrics.html",
"report-csv": "./build/report/phpmetrics.csv"
}
|
Examples are in the commit: 7bebaba#diff-713f164f2a0941b2e1b0bff3a95b0256 |
@FractalizeR but in this example I see "exclude" as string but in the code it will expect an array (https://github.com/phpmetrics/PhpMetrics/blob/master/src/Hal/Component/File/Finder.php#L55) ... also in the example there is only the html- and the exclude-option, are this the only valid options? |
ok, if some finds this e.g. via google (phpmetrics +exclude) -> this is working:
{
"extensions": [
"php"
],
"exclude": "infra,tests,composer,archiv,vendor,thirdparty,generated,tmp",
"report-xml": "./build/report/phpmetrics.xml",
"report-html": "./build/report/phpmetrics.html",
"report-csv": "./build/report/phpmetrics.csv"
} |
What about failure configuration? I want to stop jenkins when a specific metric fails, i didnt find nothing about it in .json configuration files, only in yml. It is still possible? |
There is now a way to to that. For instance, this configuration makes fail PhpMetrics in case of any class having a too low Maintainability Index (60, for instance): {
"searches": {
"Unacceptable Maintainability Index": {
"type": "class",
"mi": "<60",
"failIfFound": true
}
}
} Tested on v3.0.0-rc4 and working as expected. I'm closing the issue as original question was irrelevant (asking for a configuration file when PhpMetrics wasn't able to manage some yet) and derivated questions are now answered. |
Hello,
in the moment i test PhpMetrics.
I use PhpStorm with the PhpMetrics - Plugin.
I will write my own config file for PhpMetrics.
For example i have a ' .phpmetrics.yml ' file under the document root of my project.
I will change the measure for the maintainability index.
--------------------- .phpmetrics.yml ----
default:
rules:
cyclomaticComplexity: [ 10, 6, 2 ]
maintainabilityIndex: [ 0, 95, 99 ]
It does not work !
Where can I find the default settings?
Your sincerly
Stephan
The text was updated successfully, but these errors were encountered: