Beautiful and understandable static analysis tool for PHP

Overview

PhpMetrics

License Build Status 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

composer require phpmetrics/phpmetrics --dev
php ./vendor/bin/phpmetrics --report-html=myreport <folder-to-analyze>

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

Configure

Use the --config=<file>.json option. For example:

{
    "includes": [   // directory and files to analyze, relative to config file directory 
        "src"
    ],
    "exclude": [    // regex of files (or directory) to exclude from analyze
      "tests"
    ],
    "report": {     // list of reports to generate (html, json, csv or violation)
        "html": "/tmp/report/",             // destination directory of HTML report 
        "csv": "/tmp/report.csv",           // destination file for CSV report
        "json": "/tmp/report.json",         // destination file for JSON report
        "violations": "/tmp/violations.xml" // destination file for XML violations report
    },
    "groups": [     // "layers" of code. You can group your classes and packages by regex, 
                    // to visualise specific HTML report for each of them
        {
            "name": "Component",      // name of the layer
            "match": "!component!i"   // regular expression used to match the group (based on 
                                      // the name of the fully qualified class name)
                                      // remember to double escape (for json, then for regex): 
                                      // set "!\\\\MyPackage\\\\!" if you want to capture  
                                      // expression "\MyPackage\"
        },
        {
            "name": "Example",
            "match": "!example!"
        }
    ],
    "plugins": {
        "git": {
            "binary": "git"           // if defined, runs git analyze
        },
        "junit": {
            "file": "/tmp/junit.xml"  // if defined, JUnit report file will be analyzed            
        }
    },
    "extensions": [ "php", "php8" ]   // default: ["php", "inc"]
}

More

If want, you can install PhpMetrics globally with your favorite package manager (APT, Brew...). You can also visit our documentation.

Metrics list

See the metrics file.

Author

License

See the LICENSE file.

Contributing

See the CONTRIBUTING file.

Comments
  • v2 of PhpMetrics: roadmap and ideas

    v2 of PhpMetrics: roadmap and ideas

    Hi !

    Edit: this issue has been translated by C-Duv here.

    Please note that [you'll find the associated PR here](https://github.com/phpmetrics/PhpMetrics/issues/220#issuecomment-217040620(https://github.com/phpmetrics/PhpMetrics/pull/221)


    PhpMetrics fonctionne bien et est aujourd'hui stable, grâce au travail de tous les contributeurs. Je crois avoir à peu près respecté la vision initiale : offrir un moyen simple et ludique de disposer de métriques sur son code source.

    Cependant, il y a un défaut de conception majeur. A l'origine, j'ai conçu cet outil comme une "preuve de concept" (poc), et mon unité de base était le fichier.

    J'ai ajouté un certain nombre d'analyseurs de code (Halstead, McCabe...), mais à chaque fois en prenant comme réferentiel le fichier. Puis est apparu le besoin de travailler sur des objets PHP. Que faire ? J'ai procédé à une rustine : le parsage du code objet est un analyseur comme un autre, bien qu'il soit utilisé à peu près partout.

    Il en résulte des lourdeurs (performande) et des incohérences de conception.

    Par ailleurs, l'utilisation de la fonction token_get_all() a posé de nombreux problèmes : de performance, de RAM, mais aussi de cohérence. PHP manque de logique dans la nomenclature des tokens.

    Par exemple, en PHP, un if est représenté par le token T_IF, alors qu'une expression ternaire par le token T_STRING (le même qui sera utilisé pour les accolades { et } par exemple). Ce qui nous oblige à jongler en permanence avec des conditions pour tester la valeur du token avec le lequel on travaille...

    Je souhaite inverser les postulats et repartir de zéro. Aujourd'hui, je connais mieux le besoin en terme de métriques, aussi j'ai refondu le code en posants les principes suivants:

    • le code objet est l'unité de base. La première étape consiste à parser le code
    • le parsage du code ne dépend plus de la fonction token_get_all() ni d'aucune fonction native
    • le code est représenté sous forme d'arbre
    • les composants de calcul de métrique travaillent au choix sur
      • un arbre
      • un noeud de l'arbre
      • une classe
      • (rarement) un fichier
    • le projet réduit ses dépendances externes

    Par ailleurs, les rapports CLI (tableaux immenses affichés dans le terminal) ne semblent que très peu utilisés. Au contraire, le rapport HTML semble être l'outil de base. une refonte serait donc l'occasion de faire le tri dans les types de rapports d'analyse.

    Le passage à une représentation en graph permet aussi d'ajouter de nouvelles métriques, aujourd'hui très difficiles à obtenir: NPath complexity, Hauteur de l'arbre moyen, représentation en arbre, diagramme UML...

    Enfin, j'ai réellement honte du diagramme "Evaluation", qui est sensé fournir une idée générale de l'état du projet. J'en ai honte car il n'est ni fiable ni cohérent. J'ai posé des mini-formules à-la-va-vite ; il en résulte quelque chose de fondamentalement inutile et contre-productif.

    C'est pourquoi je propose aujourd'hui une v2.

    J'aimerai avoir vos retours sur ces idées.

    Pour cela, j'ai volontairement exclu tout code applicatif (le code actuel ne contient que les analyseurs et les composants) : j'aimerai d'abord recevoir des idées de chacun, pour améliorer l'ergonomie de l'outil et le rendre encore plus utile.

    Si vous avez des idées, des choses à améliorer / changer dans les rapports, des métriques qui vous manque... n'hésitez donc pas à en faire part ici.

    Merci à tous de votre aide !

    question 
    opened by Halleck45 25
  • svg graphs broken in v1.8.3

    svg graphs broken in v1.8.3

    installed latest version. ran phpmetrics from the command line overcame memory limit problem from #188 by doubling memory to 1024M. Chrome reports javascript errors. Ditto in Firefox and Safari phpmetrics_report_-_by_jean-francois_lepine

    line 1618 begins

    d3=function(){function n(n)
    
    bug 
    opened by pavarnos 22
  • Allowed memory size of XXX bytes exhausted

    Allowed memory size of XXX bytes exhausted

    Get some memory size error when scan code. I try it with different memory_limit.

    Allowed memory size of 268435456 bytes exhausted (tried to allocate 528384 bytes) in phar:///usr/local/bin/phpmetrics/src/Hal/Component/Token/TokenCollection.php on line 118

    Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in phar:///usr/local/bin/phpmetrics/src/Hal/Component/Token/TokenCollectionCompatibility.php on line 56

    Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in phar:///usr/local/bin/phpmetrics/src/Hal/Component/Token/TokenCollectionCompatibility.php on line 34

    Want suggest add option to ignore files by size --max-size

    bug 
    opened by infectormp 20
  • Enable use as a Composer dependency

    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.

    waiting 
    opened by anroots 18
  • [Enhancement] Better Relations Map

    [Enhancement] Better Relations Map

    Hi It seems like relations map becomes useless(hard to understand) on projects with a large number of classes. screen shot 2016-02-20 at 4 03 31 am I guess there is a better representation of such data, like a draggable directed graph or something else. So, if it seems interesting and people feels discomfort with relations map(like me), then i could provide a PR with suggestions.

    enhancement legacy-v1 
    opened by YuraLukashik 12
  • Updated pmd priority levels

    Updated pmd priority levels

    PMD uses values 1 to 5 for assigning priority, 1 being the most urgent task and 5 least urgent.

    1 - Change absolutely required. Behavior is critically broken/buggy. 2 - Change highly recommended. Behavior is quite likely to be broken/buggy. 3 - Change recommended. Behavior is confusing, perhaps buggy, and/or against standards/best practices. 4 - Change optional. Behavior is not likely to be buggy, but more just flies in the face of standards/style/good taste. 5 - Change highly optional. Nice to have, such as a consistent naming policy for package/class/fields...

    See http://pmd.sourceforge.net/pmd-5.0.5/rule-guidelines.html

    I think that changing the values here will have no other effect on the application, but will result in a correct pmd file.

    enhancement 
    opened by krukru 11
  • Mark old composer packages as abandoned

    Mark old composer packages as abandoned

    Regarding to #198 and #189 user do not get the current version of phpmetrics because the packages halleck45/phpmetrics and halleck45/php-metrics are still at version v1.8.3 (both packages reference to https://github.com/Halleck45/PhpMetrics.git).

    Instead of changing the repository of both packages we may consider to abandon the packages.

    See composer/composer#3325 for an example how the error message would look.

    bug quality 
    opened by UFOMelkor 11
  • Update of nikic/php-parser dependency

    Update of nikic/php-parser dependency

    Any upgrade plans of this dependency?

    Seems like next versions eg. psalm is using 4.x branch of that library, so basically I need to decide which one I'm going to keep.

    Another solution would be phpmetrics-shim , which would only contain necessary .phar file

    What do you think?

    opened by tarlepp 10
  • PhpMetrics v2.0.0 Fatal error on analyze folder (catchable error)

    PhpMetrics v2.0.0 Fatal error on analyze folder (catchable error)

    My test environment:

    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux unstable (sid)
    Release:    unstable
    Codename:   sid
    
    $ php --version
    PHP 7.0.8-3 (cli) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
        with Zend OPcache v7.0.8-3, Copyright (c) 1999-2016, by Zend Technologies
        with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
    
    $ ../PhpMetrics/bin/phpmetrics --version
    PhpMetrics v2.0.0 <http://phpmetrics.org>
    by Jean-François Lépine <https://twitter.com/Halleck45>
    
    $ ../PhpMetrics/bin/phpmetrics --report-html=build/metrics ./src
     27/34 [======================>-----]  79% 2 secsPHP Catchable fatal error:  Object of class PhpParser\Node\Expr\PropertyFetch could not be converted to string in PhpMetrics/src/functions.php on line 84
    PHP Stack trace:
    PHP   1. {main}() PhpMetrics/bin/phpmetrics:0
    PHP   2. Hal\Application\Application->run() PhpMetrics/bin/phpmetrics:6
    PHP   3. Hal\Application\Analyze->run() PhpMetrics/src/Hal/Application/Application.php:56
    PHP   4. PhpParser\NodeTraverser->traverse() PhpMetrics/src/Hal/Application/Analyze.php:86
    PHP   5. PhpParser\NodeTraverser->traverseArray() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
    PHP   6. PhpParser\NodeTraverser->traverseNode() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
    PHP   7. PhpParser\NodeTraverser->traverseArray() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
    PHP   8. Hal\Metric\Class_\Structural\LcomVisitor->leaveNode() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:139
    PHP   9. iterate_over_node() PhpMetrics/src/Hal/Metric/Class_/Structural/LcomVisitor.php:81
    PHP  10. PhpParser\NodeTraverser->traverse() PhpMetrics/src/functions.php:39
    PHP  11. PhpParser\NodeTraverser->traverseArray() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
    PHP  12. PhpParser\NodeTraverser->traverseNode() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
    PHP  13. PhpParser\NodeTraverser->traverseArray() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
    PHP  14. PhpParser\NodeTraverser->traverseNode() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
    PHP  15. PhpParser\NodeTraverser->traverseArray() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
    PHP  16. PhpParser\NodeTraverser->traverseNode() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
    PHP  17. MyVisitor->leaveNode() PhpMetrics/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:101
    PHP  18. Hal\Metric\Class_\Structural\LcomVisitor->Hal\Metric\Class_\Structural\{closure}() PhpMetrics/src/functions.php:26
    PHP  19. getNameOfNode() PhpMetrics/src/Hal/Metric/Class_/Structural/LcomVisitor.php:56
    
    bug Cannot reproduce 
    opened by clagiordano 10
  • PhpMetrics v2.0.0 warnings on analyze folder

    PhpMetrics v2.0.0 warnings on analyze folder

    /usr/local/bin/phpmetrics --version
    PhpMetrics v2.0.0 <http://phpmetrics.org>
    by Jean-François Lépine <https://twitter.com/Halleck45>
    

    using this command:

    /usr/local/bin/phpmetrics --report-html=build/metrics ./src/
    

    text output seems to be correct but it returns same repetitive warning, i think, on output html report:

    PHP Warning:  array_push() expects parameter 1 to be array, float given in phar:///usr/local/bin/phpmetrics/src/Hal/Metric/Consolidated.php on line 95
    PHP Stack trace:
    PHP   1. {main}() /usr/local/bin/phpmetrics:0
    PHP   2. Hal\Application\Application->run() /usr/local/bin/phpmetrics:16
    PHP   3. Hal\Report\Html\Reporter->generate() phar:///usr/local/bin/phpmetrics/src/Hal/Application/Application.php:67
    PHP   4. Hal\Metric\Consolidated->__construct() phar:///usr/local/bin/phpmetrics/src/Hal/Report/Html/Reporter.php:44
    PHP   5. array_push() phar:///usr/local/bin/phpmetrics/src/Hal/Metric/Consolidated.php:95
    

    and

    PHP Warning:  array_push() expects parameter 1 to be array, float given in phar:///usr/local/bin/phpmetrics/src/Hal/Metric/Consolidated.php on line 95
    PHP Stack trace:
    PHP   1. {main}() /usr/local/bin/phpmetrics:0
    PHP   2. Hal\Application\Application->run() /usr/local/bin/phpmetrics:16
    PHP   3. Hal\Report\Html\Reporter->generate() phar:///usr/local/bin/phpmetrics/src/Hal/Application/Application.php:67
    PHP   4. Hal\Metric\Consolidated->__construct() phar:///usr/local/bin/phpmetrics/src/Hal/Report/Html/Reporter.php:44
    PHP   5. array_push() phar:///usr/local/bin/phpmetrics/src/Hal/Metric/Consolidated.php:95
    PHP Warning:  array_sum() expects parameter 1 to be array, float given in phar:///usr/local/bin/phpmetrics/src/Hal/Metric/Consolidated.php on line 103
    

    thanks for your work!

    bug 
    opened by clagiordano 10
  • PHP Parse error with phpmetrics.phar v1.10.0

    PHP Parse error with phpmetrics.phar v1.10.0

    Hi,

    I've installed PhpMetrics version v1.10.0 as phar archive, with PHP 5.4.24 (cli) on Windows 10

    When I run this command:

    php phpmetrics.phar folder
    

    I get this output:

    PHPMetrics by Jean-Fran├ºois L├®pine <https://twitter.com/Halleck45>
    
    PHP Parse error:  syntax error, unexpected 'list' (T_LIST) in phar://phpmetrics.phar/vendor/symfony/config/Definition/ArrayNode.php on line 335
    
    Parse error: syntax error, unexpected 'list' (T_LIST) in phar://phpmetrics.phar/vendor/symfony/config/Definition/ArrayNode.php on line 335
    
    bug 
    opened by adrien-thierry 9
  • Add a CCN value to every method in a class

    Add a CCN value to every method in a class

    I've found your package very useful. I want to thank you for the great package.

    During the usage, I realized that there is a thing which I really miss in this package. The possibility to see the Cyclomatic complexity of the most complex method in a class is useful, but I really wanted to see the complexity of every method in a class. So, my proposition is to add this possibility, which I think is quite useful. For now it looks like this.

    image

    opened by kudashevs 3
  • Show error if yaml_parse function does not exists

    Show error if yaml_parse function does not exists

    Feature request

    Problem: I tried to run phpmetrcis with --config option:

    php ./vendor/bin/phpmetrics --config=phpmetrics.yaml
    

    And command finished without any error and not generated report.

    The problem was because my PHP version (8.1) doesn't have yaml_parse function. Class Hal\Application\Config\File\ConfigFileReaderYaml::read() throw RuntimeException:

    if (!function_exists('yaml_parse')) {
        throw new \RuntimeException('YAML parser not found. Please install the PECL extension "yaml".');
    }
    

    My proposition: Make changes in the src/Hal/Application/Application.php from this:

    // config
    $config = (new Parser())->parse($argv);
    

    to this

    // config
    try{
        $config = (new Parser())->parse($argv);
    } catch (\Throwable $exception) {
        $output->writeln($exception->getMessage());
        exit(0);
    }
    
    opened by lutdev 0
  • Xdebug has detected a possible infinite loop,

    Xdebug has detected a possible infinite loop,

    Bug report

    PhpMetrics v2.7.4

    ...PHP Fatal error: Uncaught Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '3000' frames in /third_party/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php:28

    third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(110): PhpParser\Node\Expr\BinaryOp->getSubNodeNames()
    third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    /third_party/phpmetrics/phpmetrics/src/Hal/Component/Ast/Php7NodeTraverser.php(25): PhpParser\NodeTraverser->traverseNode()
    /third_party/nikic/php-parser/lib/PhpParser/NodeTraverser.php(146): Hal\Component\Ast\Php7NodeTraverser->traverseNode()
    
    opened by olleharstedt 3
  • [Bug] Trying to scan an excluded folder

    [Bug] Trying to scan an excluded folder

    Bug report

     php ./vendor/bin/phpmetrics --config=.phpmetrics.json      
    
    Executing system analyzes...
    
    Executing composer analyzes, requesting https://packagist.org...
    Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(./docker/volumes/data-test): Failed to open directory: Permission denied in /var/www/vendor/phpmetrics/phpmetrics/src/Hal/Component/File/Finder.php:88
    Stack trace:
    #0 [internal function]: RecursiveDirectoryIterator->__construct('./docker/volume...', 0)
    #1 [internal function]: RecursiveDirectoryIterator->getChildren()
    #2 /var/www/vendor/phpmetrics/phpmetrics/src/Hal/Component/File/Finder.php(88): FilterIterator->next()
    #3 /var/www/vendor/phpmetrics/phpmetrics/src/Hal/Metric/System/Packages/Composer/Composer.php(76): Hal\Component\File\Finder->fetch(Array)
    #4 /var/www/vendor/phpmetrics/phpmetrics/src/Hal/Metric/System/Packages/Composer/Composer.php(39): Hal\Metric\System\Packages\Composer\Composer->getComposerJsonRequirements()
    #5 /var/www/vendor/phpmetrics/phpmetrics/src/Hal/Application/Analyze.php(144): Hal\Metric\System\Packages\Composer\Composer->calculate(Object(Hal\Metric\Metrics))
    #6 /var/www/vendor/phpmetrics/phpmetrics/src/Hal/Application/Application.php(57): Hal\Application\Analyze->run(Array)
    #7 /var/www/vendor/phpmetrics/phpmetrics/bin/phpmetrics(27): Hal\Application\Application->run(Array)
    #8 {main}
      thrown in /var/www/vendor/phpmetrics/phpmetrics/src/Hal/Component/File/Finder.php on line 88
    

    My config

    {
      "includes": [
        "app"
      ],
      "exclude": [
        "tests",
        "vendor",
        "docker"
      ],
      "report": {
        "html": "./tmp/php-metrics/report/",
        "csv": "./tmp/php-metrics/report.csv",
        "json": "./tmp/php-metrics/report.json",
        "violations": "./tmp/php-metrics/violations.xml"
      }
    }
    

    "docker" folder has access restrictions and added to config exclude. Despite this, the script tries to scan this folder.

    If you run the script from another folder, for example from vendor, then there is no such problem. It looks like at startup there is a search for something without checking permission.

    opened by stolentine 0
Releases(v2.8.1)
PHP Static Analysis Tool - discover bugs in your code without running it!

PHPStan - PHP Static Analysis Tool PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even b

PHPStan 11.6k Dec 30, 2022
A static php code analysis tool using the Graph Theory

Mondrian Ok guyz, you have a master degree in Graph Theory, you follow Law of Demeter and you live on S.O.L.I.D principles ? Let's have some Fun ! (^ω

Florent Genette 391 Nov 30, 2022
A static analysis tool for finding errors in PHP applications

Psalm Psalm is a static analysis tool for finding errors in PHP applications. Installation To get started, check out the installation guide. Live Demo

Vimeo 5k Jan 2, 2023
A static analysis tool for security

progpilot A static analyzer for security purposes Only PHP language is currently supported Installation Option 1: use standalone phar Download the lat

null 271 Dec 27, 2022
Performs advanced static analysis on PHP code

PHP Analyzer Please report bugs or feature requests via our website support system ? in bottom right or by emailing [email protected]. Contri

Continuous Inspection 443 Sep 23, 2022
The Exakat Engine : smart static analysis for PHP

Exakat The Exakat Engine is an automated code reviewing engine for PHP. Installation Installation with the phar Phar is the recommended installation p

Exakat 370 Dec 28, 2022
Static code analysis to find violations in a dependency graph

PhpDependencyAnalysis PhpDependencyAnalysis is an extendable static code analysis for object-oriented PHP-Projects to generate dependency graphs from

Marco Muths 546 Dec 7, 2022
Static Analysis Results Baseliner

Static Analysis Results Baseliner (SARB) Why SARB Requirements Installing Using SARB Examples Further reading Why SARB? If you've tried to introduce a

Dave Liddament 151 Jan 3, 2023
Infection Static Analysis Plugin

Static analysis on top of mutation testing - prevents escaped mutants from being invalid according to static analysis

Roave, LLC 108 Jan 2, 2023
A set of tools for lexical and syntactical analysis written in pure PHP.

Welcome to Dissect! master - this branch always contains the last stable version. develop - the unstable development branch. Dissect is a set of tools

Jakub Lédl 221 Nov 29, 2022
A project to add Psalm support for Drupal for security testing, focused only on taint analysis.

psalm-plugin-drupal A Drupal integration for Psalm focused on security scanning (SAST) taint analysis. Features Stubs for sinks, sources, and sanitize

Samuel Mortenson 38 Aug 29, 2022
Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.

Phan is a static analyzer for PHP that prefers to minimize false-positives. Phan attempts to prove incorrectness rather than correctness. Phan looks f

null 5.4k Jan 7, 2023
A static analyzer for PHP version migration

PHP Migration Readme in Chinese 中文 This is a static analyzer for PHP version migration and compatibility checking. It can suppose your current code ru

Yuchen Wang 194 Sep 27, 2022
SonarPHP: PHP static analyzer for SonarQube & SonarLint

Code Quality and Security for PHP This SonarSource project is a static code analyser for PHP language used as an extension for the SonarQube platform.

SonarSource 343 Dec 25, 2022
Parse: A Static Security Scanner

Parse: A PHP Security Scanner PLEASE NOTE: This tool is still in a very early stage. The work continues... The Parse scanner is a static scanning tool

psec.io 342 Jan 2, 2023
PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

PHPMD PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly

PHP Mess Detector 2.1k Jan 8, 2023
PHP completion, refactoring, introspection tool and language server.

Phpactor This project aims to provide heavy-lifting refactoring and introspection tools which can be used standalone or as the backend for a text edit

Phpactor 882 Jan 1, 2023
PHP Architecture Tester - Easy to use architectural testing tool for PHP :heavy_check_mark:

Easy to use architecture testing tool for PHP Introduction ?? PHP Architecture Tester is a static analysis tool to verify architectural requirements.

Carlos A Sastre 765 Dec 30, 2022
A tool to automatically fix PHP Coding Standards issues

PHP Coding Standards Fixer The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards; whether you want to follow PHP codi

null 11.6k Jan 3, 2023