laminas / laminas-continuous-integration-action

GitHub Action for running a QA check
BSD 3-Clause "New" or "Revised" License
19 stars 19 forks source link

Improvements to reporting of psalm baselined errors #152

Open Xerkus opened 1 year ago

Xerkus commented 1 year ago

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

Psalm baseline feature has a significant downside that it could allow reported issues to be silenced without proper review or consideration. Extra care is required to review baseline diff and while added entries might look innocuous enough they might be pointing at a real problem visible in context.

Proper review currently requires checking component locally, resetting the baseline changes and then running the psalm. Occasionally due to runtime PHP version differences psalm will report differently which further complicates review.

I suggest we introduce two new additional psalm jobs.


Job to report newly baselined psalm errors in the current PR

No failure psalm job that would checkout targeted branch baseline to run against with the exception of explicitly ignoring unused baseline entries.

This job would be an important review tool that would allow to see exactly which problems were baselined by a given PR without having to guess from baseline diff or having to checkout code and run psalm locally.

I think this job should report found errors as check annotations on the PR as well, although with reduced severity - notice instead of error. Check annotations with the current beta feature are shown in context even for files that were not directly changed by the PR. This allows to view error in context without having to navigate to the code in a separate tab.

GHA check annotation on unchanged files

To distinguish real psalm errors from baselined errors this job should rewrite github formatted psalm output to report as Notice instead of Warning or Error. Custom output formatter would be right way to do it but simple sed will work just as fine, until and unless github changes format. See GHA docs: Setting a notice message and Psalm GithubActionsReport formatter

In slack discussion @Ocramius expressed skepticism about usefulness of annotations on pull request Files Changed tab over the visual noise they create. I believe annotations should be utilized for a couple reasons:


Job to report all psalm baselined errors in action log

No failure --ignore-baseline run with default output formater that would not show in PR as failure or as PR annotations. This job would allow to see in action log exactly which issues are currently baselined.

Bonus points for reporting total number of errors found as check notice message to be displayed as annotation on PR with something like 152 baselined psalm errors found. The way github shows annotations with "View workflow job for this annotation" button would serve as a way to increase awareness for contributors and link directly at reported baselined errors without getting in the way.