phpstan-baseline-analysis icon indicating copy to clipboard operation
phpstan-baseline-analysis copied to clipboard

Support filtering of baselines

Open staabm opened this issue 2 years ago • 1 comments
trafficstars

atm the tool is able to analyze existing baselines and provide a summary as a result, grouped into categories:

Overall-Errors: 41
  Classes-Cognitive-Complexity: 70
  Deprecations: 2
  Invalid-Phpdocs: 5
  Unknown-Types: 1
  Anonymous-Variables: 4
  Native-Property-Type-Coverage: 1
  Native-Param-Type-Coverage: 27
  Native-Return-Type-Coverage: 4
  Unused-Symbols: 3

it would be great if I could filter existing baselines, based on category, and get back a new baseline. this would allow me to work with focus on a certain problem area, without manually searching the existing full-project-baseline


example 1 (which outputs all filtered content on stdout)

phpstan-baseline-analyze '*phpstan-baseline.neon' --filter=Deprecations

example 2(which outputs the content into new-baseline.neon)

phpstan-baseline-analyze '*phpstan-baseline.neon' --filter=Invalid-Phpdocs > new-baseline.neon

the result should be rendered in neon-format, like the default PHPStan baseline, so we can further process it with whatever tool which supports the default phpstan baseline format

staabm avatar Oct 02 '23 06:10 staabm

Additional ideas

  • regenerate/filter existing baselines so all errors machting the filters will be deleted from the baseline. That way a regular phpstan analysis will match these errors
  • filter by phpstan native error identifiers

staabm avatar Oct 12 '23 11:10 staabm