Repository navigation
PHPStan extensions and SARIF reporting format #9432
llaville
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
When you have a project that included some PHPStan extensions
For example : https://github.com/llaville/php-compatinfo-db/blob/master/vendor-bin/phpstan/composer.json that install official PHPStan Doctrine Extension
The best way is to use the official extension-installer
The Question is : How to tell MegaLinter to use local PHPStan extension(s) when reportig results in SARIF format
The Reason is: Autoloader(s) from your local project and MegaLinter are not shared/does not communicate by default
MegaLinter already support the PHPStan extension-installer, and are capable to print SARIF reports (for PHP_CodeSniffer, PHPLint, and PHPStan) via https://github.com/llaville/sarif-php-converters
This is just a question to put to RIGHT parameters in your projects.
Into your
.mega-linter.ymlconfig file, or give it on MegaLinter invocation with environment variable (-e PHP_PHPSTAN_ARGUMENTS) define where is your project AutoloaderNote
In my context (project example), I've a custom Autoloader, in place of standard Composer
vendor/autoload.phpCaution
If you specify
-e SARIF_REPORTER=true, don't forget to define the sarif formatter service into yourphpstan.neonconfig fileOr any other custom formatter : Learn more with https://llaville.github.io/sarif-php-converters/1.8/converter/phpstan/
Otherwise, PHPStan will reply to you by this error
Error formatter "sarif" not found. Available error formatters are: teamcity, gitlab, raw, junit, checkstyle, github, table, json, prettyJson,All reactions