Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i cant really rationalize this. i feel like it hacks the caching for whatever purpose. IMHO then
--no-diff
should be passed explicitly (ref #7681)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fear Psalm may be unable to refresh or recreate the baseline unless it has analyzed your whole codebase. It would make sense at least. So whenever your ask it to do that, it can't just analyze files that changed or were removed and launch the whole analysis.
You may have to choose between having a squeaky clean baseline and a fast analysis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not sure i follow, it seems psalm is able to recreate the baseline from cache just fine 🤔
i can confirm after
rm psalm-baseline.xml
psalm regenerates the same baseline file usingvendor/bin/psalm --set-baseline=psalm-baseline.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can also confirm after
rm psalm-baseline.xml
AND intentionally forcing an error (referenced an unknown class in src/ somewhere), the baseline is updated as expectedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can also confirm after fixing that error i get
Baseline for issue "UndefinedClass" has 1 extra entry. (see https://psalm.dev/316)
AND it's removed from the baseline fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's two things that can reduce the time of Psalm's analysis:
Both can be controlled through --no-cache and --no-diff (though I think --no-cache implies --no-diff).
I think you may have misinterpreted Psalm using the --no-diff mode when you ask it to regenerate baseline vs Psalm using no cache at all.
Could you make a few tests with --no-diff, --no-cache and --set-baseline to see if it matches your expectations?