vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.55k stars 661 forks source link

Add possibility to move all inline suppressions to baseline #8301

Open DanielBadura opened 2 years ago

DanielBadura commented 2 years ago

Hello :wave:

Im currently working on a larger project where initially inline suppresses where used to ignore some psalm errors. Now the decision was made to use instead a baseline to get a better feeling how much if off and to track it in a single source. Best case would be now to migrate the suppressions into the baseline, but AFAIK this is not automatically possible.

Do you think this would be beneficial? Is it even technical possible right now? Or maybe best case: There is already something like that which i did oversee?

psalm-github-bot[bot] commented 2 years ago

Hey @DanielBadura, can you reproduce the issue on https://psalm.dev ?

orklah commented 2 years ago

Hi! To be sure I understood, what you want to achieve is basically to remove each @psalm-suppress from the code and then re-run psalm in --set-baseline mode, correct?

I'm not sure it would be possible in one swipe (because I think Psalm will read suppression before removing them and baselining will only add non-suppressed issues). However, it should be pretty simple to create a small plugin that just removes suppressions and then re-run psalm after that

DanielBadura commented 2 years ago

Yeah thats what i want to achieve. If it's a 2 step progress it would be fine. So it sounds as if there is already something that removes all suppresses?

orklah commented 2 years ago

It doesn't exists but I don't think it would be very difficult to create