Giter Club home page Giter Club logo

phpmetrics's Introduction

PhpMetrics

License Latest Stable Version Slack

Standard report

PhpMetrics

PhpMetrics provides metrics about PHP project and classes, with beautiful and readable HTML report.

Documentation | Twitter | Contributing



Quick start

Follow the quick start guide to get started.

# install the package as a dev dependency
composer require phpmetrics/phpmetrics --dev

# run PHPMetrics to analyze a folder and generate a report
php ./vendor/bin/phpmetrics --report-html=myreport <folder-to-analyze>

Then open the generated ./myreport/index.html file in your browser.

You can use a configuration file to customize the report, add options, configure rules for Continuous Integration, etc.

Metrics

You'll find detailed list of metrics in documentation, or running php ./vendor/bin/phpmetrics --metrics

Author

License

See the LICENSE file.

Contributing

See the CONTRIBUTING file.

phpmetrics's People

Contributors

alexandrecruz avatar alexdenvir avatar baptistedeleplace avatar big-shark avatar carusogabriel avatar dinamic avatar fabianbadoi avatar fonsecas72 avatar fractalizer avatar gemal avatar gmponos avatar halfer avatar halleck45 avatar hywan avatar janpieper avatar lencse avatar niconoe- avatar paolomainardi avatar pattisahusiwa avatar pavarnos avatar pborreli avatar photodude avatar rafaelign avatar rexem avatar roelbaka avatar shaunl avatar skors avatar ssfinney avatar ufomelkor avatar underq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpmetrics's Issues

Get "undefined constant" for report

Hi,

I get some error when trying to export a report from a script:

The error msg are save in the resuts.json


Notice: Use of undefined constant T_INSTEADOF - assumed 'T_INSTEADOF' in C:\xampp\htdocs\PhpMetrics\bin\metrics.php on line 35

Notice: Use of undefined constant T_TRAIT - assumed 'T_TRAIT' in C:\xampp\htdocs\PhpMetrics\bin\metrics.php on line 35

Notice: Use of undefined constant T_CALLABLE - assumed 'T_CALLABLE' in C:\xampp\htdocs\PhpMetrics\bin\metrics.php on line 35

Notice: Use of undefined constant T_TRAIT_C - assumed 'T_TRAIT_C' in C:\xampp\htdocs\PhpMetrics\bin\metrics.php on line 35

Notice: Use of undefined constant JSON_PRETTY_PRINT - assumed 'JSON_PRETTY_PRINT' in C:\xampp\htdocs\PhpMetrics\src\Hal\Formater\Json.php on line 38

Warning: json_encode() expects parameter 2 to be long, string given in C:\xampp\htdocs\PhpMetrics\src\Hal\Formater\Json.php on line 38

phpci integration

Hi, following up on the the phpci issues, I'd like to offer some implementation help for integration into phpci.
Easiest way I see at the moment is to make the path for the reports optional. If a path is given, the report is written to a file. Otherwise it will be printed like the summary.
What do you think @Halleck45 ?
I've already forked the repo and played around a bit ;-) Also I've added a JSON report.

Can I get a report of twig template

I notice sometime developer will also put logic into the template. I wonder is it possible we can create Cyclomatic Complexity report of a twig template

Missing shebang in PHAR file

I like to move PHAR files to /usr/local/bin/ to make them globally available but I am not able to do this with your PHAR because it requires me to call it with php. Please add #!/usr/bin/env php or #!/usr/bin/php to your PHAR file.

[phar] removing dev deps

the phar is pretty big (5,6M), vendor contains phpunit, I guess it's not necessary and could be removed from the phar processing.

LCOM is not applicable to interfaces

As interfaces do not contain any logic and consequently attribute accesses, include them in LCOM calculation is not relevant.
Currently the overall LCOM result is distorted, and does not reflect the reality.
Maybe interfaces should be excluded from LCOM calculation or at least should not influence the result.

Eric

Enable use as a Composer dependency

Currently, when including the project via Composer as a dependency, it isn't possible to run it: including the Composer autoloader from bin/metrics.php fails, since it is assumed that the project is a root-level project, with its own vendor directory.

To solve that, the following changes would be necessary:

  • Tell Composer to move the metrics.php to the Composer vendor/bin dir (optionally, losing the .php extension)
  • Rewrite the Composer autoloader inclusion in metrics.php so it would work when the project is included as a dependency

If you'd like, I could try creating a pull request for this.

Per Package / per class

Hi,

currently I use phpmetrics from composer and from PhpStorm-Plugin. Comparing the CE/CA of both versions, there seems to be a mismatch.

The ‘old’ version from the PhpStorm-Plugin:
phpmetrics1

The ‘new’ version from composer:
phpmetrics2

This may belong to the fact, that in the ‘new‘ version the “Explore” section contains data per class, the ‘old‘ one did it per package.

Issue with command path and global composer install

This happens, for me at least, when composer is already installed globally.
Running the command from the homepage

$ composer global require 'halleck45/phpmetrics=@dev'

Results in the phpmetrics file being installed to ~/.composer/vendor/bin/phpmetrics.php.

Then (if ~/.composer/vendor/bin is in PATH as it should be) the phpmetrics command fails:

$ phpmetrics
phpmetrics: command not found

Obviously, it's easy to thie file to ~/.composer/vendor/bin/phpmetrics, which solves the problem. Nevertheless, it would be great to either a) not have to that or b) update the docs accordingly.

Thanks. Keep up the great work!

Notices triggered by anonymous functions

An anonymous function will trigger several notices:

function myFunction() use($sth) {
}

Note that it only fails if there's no space after the use keyword. That's because none of the conditions here is met: https://github.com/Halleck45/PhpMetrics/blob/master/src/Hal/OOP/Extractor/AliasExtractor.php#L44

Although it's not a namespace declaration, a token matches T_USE here: https://github.com/Halleck45/PhpMetrics/blob/master/src/Hal/OOP/Extractor/Extractor.php#L85
Example notice:

PHP Notice:  Undefined variable: real in /Users/jzalas/Projects/PhpMetrics/src/Hal/OOP/Extractor/AliasExtractor.php
on line 54
PHP Stack trace:
PHP   1. {main}() /Users/jzalas/Projects/PhpMetrics/bin/metrics.php:0
PHP   2. Symfony\Component\Console\Application->run() /Users/jzalas/Projects/PhpMetrics/bin/metrics.php:22
PHP   3. Symfony\Component\Console\Application->doRun() /Users/jzalas/Projects/PhpMetrics/vendor/symfony/console/Symfony/Component/Console/Application.php:121
PHP   4. Symfony\Component\Console\Application->doRunCommand() /Users/jzalas/Projects/PhpMetrics/vendor/symfony/console/Symfony/Component/Console/Application.
php:191
PHP   5. Symfony\Component\Console\Command\Command->run() /Users/jzalas/Projects/PhpMetrics/vendor/symfony/console/Symfony/Component/Console/Application.php:8
92
PHP   6. Hal\Command\RunMetricsCommand->execute() /Users/jzalas/Projects/PhpMetrics/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
PHP   7. Hal\Command\Job\Queue->execute() /Users/jzalas/Projects/PhpMetrics/src/Hal/Command/RunMetricsCommand.php:102
PHP   8. Hal\Command\Job\DoAnalyze->execute() /Users/jzalas/Projects/PhpMetrics/src/Hal/Command/Job/Queue.php:51
PHP   9. Hal\Command\Job\Analyze\FileAnalyzer->execute() /Users/jzalas/Projects/PhpMetrics/src/Hal/Command/Job/DoAnalyze.php:119
PHP  10. Hal\OOP\Extractor\Extractor->extract() /Users/jzalas/Projects/PhpMetrics/src/Hal/Command/Job/Analyze/FileAnalyzer.php:133
PHP  11. Hal\OOP\Extractor\AliasExtractor->extract() /Users/jzalas/Projects/PhpMetrics/src/Hal/OOP/Extractor/Extractor.php:86

Notice: Undefined variable: real in /Users/jzalas/Projects/PhpMetrics/src/Hal/OOP/Extractor/AliasExtractor.php on line 54

Empty data in html report

PHPMetrics version v1.4.1 (phar)

Command: phpmetrics --report-html=phpmetrics.html --report-cli --chart-bubbles=chart.svg apps

Cli report and bubbles chart seems working fine, but html report doesn't have any charts but have a JS error because data and groupedData have no values:

    ...
    var rAxis = 'loc';

    var data = 
    var groupedData = 

    var ruleSet = ...

Screen: http://joxi.ru/823j4zdFjGVlmO

What I'm doing wrong?

UPD: Seems like this issue related for the project only. Other project has been analyzed successfully. How I can dedug this issue? -vvv or --verbose provides the same output as normal run.

Bug

Hello,

below is a bug of PhpMetrics
"php ./bin/metrics.php --summary-html=/home/deleris/analysecode/resultats/PhpMetricsDolibarrGlobal.html var/www/dolibarr/
PHPMetrics by Jean-François Lépine https://twitter.com/Halleck45

271/1402 [=====>----------------------] 19%PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /root/PhpMetrics-master/src/Hal/Halstead/Halstead.php on line 67"

Regards
BD

_values undefined

I'm having issues running PHPMetrics, it displays the maintainability page, and the relations map, but the other charts and tables aren't shown, here's the error in the JS Console on chrome 38:

screen shot 2014-09-05 at 12 23 41

Uncaught TypeError: Cannot read property '_values' of undefined 

Failure condition not working

#!/usr/bin/env bash

OUTPUT=$(./phpmetrics.phar --failure-condition="sum.loc > 0" test.php)

echo $?

Returns 0 instead of 1 with test.php having 100+ lines of code.

Terminal issues warning when using date() in Yosemite

I'm getting some console warnings due to phpmetrics usage of date() function.
PHP v.5.5.20 (cli) with XDebug 2.2.6 - Mac OS Yosemite

PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php on line 160
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/phpmetrics:0
PHP   2. require_once() /usr/local/bin/phpmetrics:15
PHP   3. ComposerAutoloaderInit612a80c798d437b20b8c1610ca2ebe41::getLoader() phar:///usr/local/bin/phpmetrics/vendor/autoload.php:7
PHP   4. composerRequire612a80c798d437b20b8c1610ca2ebe41() phar:///usr/local/bin/phpmetrics/vendor/composer/autoload_real.php:45
PHP   5. require() phar:///usr/local/bin/phpmetrics/vendor/composer/autoload_real.php:54
PHP   6. Hoa\Core\Core->initialize() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Core.php:514
PHP   7. Hoa\Core\Parameter\Parameter->__construct() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Core.php:251
PHP   8. Hoa\Core\Parameter\Parameter->setDefault() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:147
PHP   9. Hoa\Core\Parameter\Parameter->zFormat() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:214
PHP  10. Hoa\Core\Parameter\Parameter::initializeConstants() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:562
PHP  11. date() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:160

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php on line 160

Call Stack:
    0.0008     225568   1. {main}() /usr/local/bin/phpmetrics:0
    0.0113     524952   2. require_once('phar:///usr/local/bin/phpmetrics/vendor/autoload.php') /usr/local/bin/phpmetrics:15
    0.0115     537664   3. ComposerAutoloaderInit612a80c798d437b20b8c1610ca2ebe41::getLoader() phar:///usr/local/bin/phpmetrics/vendor/autoload.php:7
    0.0135     777456   4. composerRequire612a80c798d437b20b8c1610ca2ebe41() phar:///usr/local/bin/phpmetrics/vendor/composer/autoload_real.php:45
    0.0140     882696   5. require('phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Core.php') phar:///usr/local/bin/phpmetrics/vendor/composer/autoload_real.php:54
    0.0169    1346016   6. Hoa\Core\Core->initialize() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Core.php:514
    0.0169    1351264   7. Hoa\Core\Parameter\Parameter->__construct() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Core.php:251
    0.0169    1352304   8. Hoa\Core\Parameter\Parameter->setDefault() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:147
    0.0169    1352504   9. Hoa\Core\Parameter\Parameter->zFormat() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:214
    0.0169    1352552  10. Hoa\Core\Parameter\Parameter::initializeConstants() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:562
    0.0169    1352696  11. date() phar:///usr/local/bin/phpmetrics/vendor/hoa/core/Parameter.php:160

Follow symlinked folders when scanning

When scanning a project that contains a symlinked folder, the contents of the symlinked folder – which can be included in the project – are not scanned.

Closure detected instead of method && Fatal Error

Hi,

trying to run phpMetrics on https://github.com/TYPO3/TYPO3.CMS I get:

[Exception]
Closure detected instead of method

Trying to run metrics without oop (--without-oop) the analysis runs but then I get a fatal error:

Grouping results by package/directory. This will take few minutes...           
PHP Fatal error:  Call to a member function getConcreteClasses() on a non-object in /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Metrics/Mood/Abstractness/Abstractness.php on line 32
PHP Stack trace:
PHP   1. {main}() /home/susanne/.composer/vendor/halleck45/phpmetrics/bin/metrics.php:0
PHP   2. Symfony\Component\Console\Application->run() /home/susanne/.composer/vendor/halleck45/phpmetrics/bin/metrics.php:22
PHP   3. Symfony\Component\Console\Application->doRun() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
PHP   4. Symfony\Component\Console\Application->doRunCommand() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
PHP   5. Symfony\Component\Console\Command\Command->run() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:885
PHP   6. Hal\Application\Command\RunMetricsCommand->execute() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
PHP   7. Hal\Application\Command\Job\Queue->execute() /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/RunMetricsCommand.php:114
PHP   8. Hal\Application\Command\Job\DoAggregatedAnalyze->execute() /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/Job/Queue.php:51
PHP   9. Hal\Metrics\Mood\Abstractness\Abstractness->calculate() /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/Job/DoAggregatedAnalyze.php:81

Anything I'm doing wrong?

Thanks,

susanne

PHP Fatal error : Class 'Twig_SimpleTest' not found in phar

Dear,
I tried to execute this command : php metrics.phar --format=html > /path/of/your/choice.html

You will find the stack trace below :

Fatal error: Class 'Twig_SimpleTest' not found in phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 233

Call Stack:
    0.0170     540992   1. {main}() {myPath}\metrics.phar:0
    0.0173     540128   2. require('phar://{myPath}/metrics.phar/init.php') {myPath}\metrics.phar:14
    0.0214     740880   3. require_once('phar://{myPath}/metrics.phar/bin/metrics.php') phar://{myPath}/metrics.phar/init.php:14
   26.2342    4393040   4. Hal\Formater\Html->terminate() phar://{myPath}/metrics.phar/bin/metrics.php:54
   26.4433    7532416   5. Twig_Environment->render() phar://{myPath}/metrics.phar/src/Hal/Formater/Html.php:53
   26.4433    7532488   6. Twig_Environment->loadTemplate() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:292
   26.4439    7537928   7. Twig_Environment->compileSource() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:331
   26.4439    7538056   8. Twig_Environment->tokenize() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:559
   26.4439    7538104   9. Twig_Environment->getLexer() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:469
   26.4452    7693792  10. Twig_Lexer->__construct() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:441
   26.4452    7698336  11. Twig_Lexer->getOperatorRegex() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Lexer.php:65
   26.4452    7698904  12. Twig_Environment->getUnaryOperators() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Lexer.php:367
   26.4452    7698968  13. Twig_Environment->initExtensions() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:1094
   26.4457    7729152  14. Twig_Environment->initExtension() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:1161
   26.4467    7834408  15. Twig_Extension_Core->getTests() phar://{myPath}/metrics.phar/vendor/twig/twig/lib/Twig/Environment.php:1193

regards.

PHP Deprecated Notice re: Symfony ProgressBar

PHP Deprecated: "Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead. in /var/www/project/vendor/opine/container/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php on line 123

Catchable fatal error being triggered

I've tried running phpmetrics over several libraries including Zend 1.11, aws sdk (v1). For the v1 of aws, it crashes when analyzing ec2.class.php

PHP Catchable fatal error: Argument 1 passed to Hal\Component\Token\TokenType::isOperator() must be an instance of Hal\Component\Token\Token, array given, called in phar:///home/user/bin/phpmetrics/src/Hal/Metrics/Complexity/Text/Halstead/Halstead.php on line 81 and defined in phar:///home/user/bin/phpmetrics/src/Hal/Component/Token/TokenType.php on line 170

[PHP 5.3 compatibility] Multiple interfaces implementation

I've got this error running metrics.phar on 5.3.3 (CentOs 6.5) :

PHP Fatal error:  Can't inherit abstract function Hal\Bounds\BoundsAgregateInterface::calculate() (previously declared abstract in Hal\Bounds\BoundsInterface)
...

It seems that under php 5.3.9, a class couldn't implement 2 interfaces with a same named method.

I've commented the second implementation and modified Hal/Formater/Summary classes and Hal/Command/Job/SearchBounds to make it work but I'm not sure its a good solution.

Report tables are broken

When I test this sample file separately, I get a big red circle for no obvious reason.

  • Maintainability index 53,
  • comment weight 0
  • vocabulary 29
  • volume 520
  • intelligent content 59
  • difficulty 9

Test an entire directory with the same file in it gives me very different results for that file:

  • Maintainability index still 53
  • comment weight 59
  • vocabulary 0
  • volume 29
  • intelligent content 9
  • difficulty 18

The results are clearly wrong, I think they are partially mixed up, partially just wrong for itself.

Files are not found

Due to incorrect default configuration, files are not found by PhpMetrics : default extension is never imported by ConfigurationFactory

generate datetime

Hi,
I think it could be helpfull to have the datetime of the generate file (html) printed inside the page.

Call to a member function getConcreteClasses() on a non-object

Following on from #72 I decided to play around with the options and had more success with the ``--without-oop` flag although still ran into issues.

➜  web git:(master) phpmetrics . --report-html ../html --without-oop
PHPMetrics by Jean-François Lépine <https://twitter.com/Halleck45>

  139/1295 [===>------------------------]  10%
  149/1295 [===>------------------------]  11%
  151/1295 [===>------------------------]  11%
  215/1295 [====>-----------------------]  16%
  216/1295 [====>-----------------------]  16%
  224/1295 [====>-----------------------]  17%
  879/1295 [===================>--------]  67%

Grouping results by package/directory. This will take few minutes...           

PHP Fatal error:  Call to a member function getConcreteClasses() on a non-object in phar:///usr/local/bin/phpmetrics/src/Hal/Metrics/Mood/Abstractness/Abstractness.php on line 33

Broken with PHP 5.3

PhpMetrics cannot be installed with composer on PHP 5.3

  • hoa/ruler 1.14.09.23 requires hoa/core ~2.0 -> satisfiable by hoa/core[2.14.09.17, 2.14.09.23].
  • hoa/ruler 1.14.09.25 requires hoa/core ~2.0 -> satisfiable by hoa/core[2.14.09.17, 2.14.09.23].
  • hoa/core 2.14.09.23 requires php >=5.4.0 -> no matching package found.
  • hoa/core 2.14.09.17 requires php >=5.4.0 -> no matching package found.
  • Installation request for hoa/ruler ~1.0 -> satisfiable by hoa/ruler[1.14.09.23, 1.14.09.25].

We should use hoa/core 1.14.09.16

A Default Ruleset

When I use a config file I have to set every single ruleset in my config for this tool to work properly.

Doing this causes me some trouble:

  • I don't know which values to use
  • I don't know each ruleset's name

At RuleSet class __contructor we have an array that suggests a default list of ruleset and I can use that to config the yml properly.

Obviously, this is not something as easy as it should be.
Perhaps this ruleset list should in fact be a default list and then we would merge this at the __contructor.

This seems obvious to me but as there are tests that will fail, I rather ask you first instead of PR right away.

[DOC] Missing root node in configuration file example

I'm following your instructions on creating configuration file, but it seems there is missing the root node.

I've solved adding the root node in my metrics.yml
There is my working configuration

phpmetrics:
    # paths to explore
    path:
        directory: src
        extensions: php
        exclude: Features|Tests|tests

    # report and violations files
    logging:
        report:
            xml:    app/logs/metrics/phpmetrics.xml
            html:   app/logs/metrics/phpmetrics.html
            csv:    app/logs/metrics/phpmetrics.csv
        violations:
            xml:    app/logs/metrics/violations.xml
        chart:
            bubbles: app/logs/metrics/bubbles.svg

    # condition of failure
    failure: average.maintenabilityIndex < 50 or sum.loc > 10000

    # rules used for color
    rules:
        cyclomaticComplexity: [ 10, 6, 2 ]
        maintenabilityIndex: [ 0, 69, 85 ]

Interfaces cannot extend multiple interfaces

Actualy a class can have only one parent (correct), but an interface can also have only one parent (incorrect).

Because ReflectedInterface inherits ReflectedClass, this would need some refactorings. I'd like to remove most calls of getParent() and return the parent class within getDependencies(). Thereby we're more flexible and can handle interfaces that extends multiple interfaces.

Any thoughts? @Halleck45

Remove unneeded version_compares

Because hoa/core ~2.0 requires PHP >=5.4.0, Php-Metrics ended up requiring that PHP version as well so it seems to me that we have some unneeded version_compare(PHP_VERSION, '5.4.0') >= 0

Perhaps we should remove those.

no global php version available

The SyntaxChecker in Hal\Component\File went wrong, because the method isCorrect can't find a global php version. On our servers there is no global php version available. Also a symlink is a bad idea, because of maintainability reasons.
The error message is "file %s is not valid and has been skipped" in line 114 in the DoAnalyze class in the namespace Hal\Application\Command\Job.

Support traits

Actual traits are unsupported. I'd like to implement this, but we should clarify before whether we drop support for php 5.3 or not (see #101).

Closure detected instead of method

➜  web git:(master) phpmetrics . --report-html ../html
PHPMetrics by Jean-François Lépine <https://twitter.com/Halleck45>

  139/1295 [===>------------------------]  10%
  149/1295 [===>------------------------]  11%
  151/1295 [===>------------------------]  11%
  200/1295 [====>-----------------------]  15%


  [Exception]                         
  Closure detected instead of method  

Got this exception when trying to test it on a project. The current PHP version I'm running is ...

➜  web git:(master) php --version
PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

Although the project targets a lower PHP version than 5.4

Help appreciated.

parent treated as a class

"parent" is shown as a class in the relations graph : (tested on Mondrian )

image

It's not a big deal but it's a little confusing. And I think perhaps it might affect some other metrics if PhpMetrics is seeing this call as a static call ?

Hope this helps 🍺

Deprecated flag usage in Readme

I got a deprecated warning in console before installing composer dependencies.
Follow readme code I've used the --dev flag (as code located above "Contribute" section) and got this warning:

You are using the deprecated option "dev". Dev packages are installed by default now.

Checked for chengelog in composer/composer and find that this was added in 1.0.0-alpha8
For more information changelog ref. is avaiable.

Make use of "bin-dir" in "composer.json"

When package is installed globally via Composer (as advised in README.md) it's impossible to run it. There is ~/.composer/vendor/halleck45/phpmetrics/bin/metrics.php file, but it isn't suggested by Bash Auto-complete.

I think, that following should be done:

  1. add bin-dir setting to composer.json to indicate where directory containing binary files is located within a package
  2. rename metricks.php to the phpmetrics to be consistent with filename resulting from PHAR installation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.