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

Use baseline mtime instead of current time

Open mwikberg-virta opened this issue 11 months ago • 4 comments

Added flag --mtime to use the baseline file modification timestamp as the date instead of "now", because it makes much more sense when you need to generate multiple reports from the same repository or want to track actual changes to the baseline

mwikberg-virta avatar Dec 05 '24 12:12 mwikberg-virta

Which problem should this PR solve? Would https://github.com/staabm/phpstan-baseline-analysis/pull/91 also work for you?

staabm avatar Dec 05 '24 12:12 staabm

The problem is that all JSON files got the same (current) date, so the graph is not very useful

[
  {
    "phpstan-baseline.neon": {
      "Date": "Fri, 29 Nov 2024 17:01:16 +0000",
      "Overall-Errors": 4062,
      "Classes-Cognitive-Complexity": 0,
      "Deprecations": 44,
      "Invalid-Phpdocs": 37,
      "Unknown-Types": 3,
      "Anonymous-Variables": 0,
      "Native-Property-Type-Coverage": 0,
      "Native-Param-Type-Coverage": 0,
      "Native-Return-Type-Coverage": 0,
      "Unused-Symbols": 0
    }
  }
]

image

versus

image

with the correct dates..

The ksort was also needed to make sure the data is displayed correctly.. Otherwise data points were rendered in some very weird random order, which makes no sense for a graph that should have time as one axis

mwikberg-virta avatar Dec 05 '24 13:12 mwikberg-virta

At least I guess that the actual modification time of the baseline is more correct than "now" in most cases? It could maybe be optional though...

mwikberg-virta avatar Dec 05 '24 13:12 mwikberg-virta

did you check whether the fix from https://github.com/staabm/phpstan-baseline-analysis/pull/91 would work for you? (without the modifications of this PRs here)

staabm avatar Dec 14 '24 06:12 staabm