GitXplorerGitXplorer
T

phpstan-bodyscan

public
128 stars
10 forks
0 issues

Commits

List of commits on branch main.
Unverified
9a9c1c93ee09495ce0d9c94d78e3da79670c3553

cs

TTomasVotruba committed 2 days ago
Unverified
6862fcae3a29801944f656fdce71f12b50d63f52

skip showing section on json (closes https://github.com/TomasVotruba/phpstan-bodyscan/issues/32, closes https://github.com/TomasVotruba/phpstan-bodyscan/pull/33)

TTomasVotruba committed 2 days ago
Unverified
b1b6fb37e2fc0e286e0aac18f6c9063fb33ec190

cs

TTomasVotruba committed 2 days ago
Unverified
58603c2bccf03c1caefaade6450fe6a926025a7f

misc

TTomasVotruba committed 2 days ago
Unverified
e256f178bb1513db8630b48a4f6f50fd3ddb9a3e

alwasy skip ignored errow, to get raw data

TTomasVotruba committed 2 days ago
Unverified
09d94132f9f2568193305ef55a5af1bbcf692591

cs

TTomasVotruba committed 2 days ago

README

The README file for this repository.

PHPStan Bodyscan

Downloads total

  • Do you want to get quick glimpse of new project code quality?
  • Do you want to know, what PHPStan level is the best for your project?
  • Do you want to know, how much errors you're facing per level to see how hard it will be to reach them?

Get error count for each PHPStan level!


How does it work?

First, we look into the project root for phpstan.neon file.

  • If found, we reuse it.
  • If not, we look for defaults source code paths like /src, /app, /tests, etc.

Then we run PHPStan for each level from 0 to 8. We count errors and display them in a table.


Install

composer require tomasvotruba/phpstan-bodyscan --dev

Usage

Run tool in your project. It will take some time, as it will run full PHPStan analysis for each level.

vendor/bin/phpstan-bodyscan

To get errors count per level:

+-------+-------------+-----------+
| Level | Error count | Increment |
+-------+-------------+-----------+
|     0 |           0 |         - |
|     1 |          35 |      + 35 |
|     2 |          59 |      + 24 |
|     3 |          59 |         - |
|     4 |         120 |      + 61 |
|     5 |         120 |         - |
|     6 |         253 |     + 133 |
|     7 |         350 |      + 97 |
|     8 |         359 |       + 9 |
+-------+-------------+-----------;

Do you want to run levels including all ignored messages?

vendor/bin/phpstan-bodyscan --no-ignore

Do you want to run levels without extensions?

vendor/bin/phpstan-bodyscan --bare

Do you need a JSON format?

We got you covered:

vendor/bin/phpstan-bodyscan --json

[
    {
        "level": 0,
        "error_count": 0,
        "increment_count": 0
    },
    {
        "level": 1,
        "error_count": 5,
        "increment_count": 5
    },
    {
        "level": 2,
        "error_count": 25,
        "increment_count": 20
    }
]

Limit level count

Are you interested only in a few levels? You can limit ranges by the options:

vendor/bin/phpstan-bodyscan run --min-level 0 --max-level 3

Load env file

Some projects need to load .env file to run PHPStan. You can do it like this:

vendor/bin/phpstan-bodyscan run --env-file some-parameters.env

Debugging

Running PHPStan on a new project you don't know might crash. To save data from finished levels, we dump them to the bodyscan-log.txt file.

If the run crashes for any reason, the PHPStan error output is also dumped to the same file.


Happy coding!