vimeo / psalm

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

add cli stop-on-violation option #7670

Open cklm opened 2 years ago

cklm commented 2 years ago

We are using Psalm as part of our ci-pipeline. It would save time and resources, when there would be a cli-option "stop-on-violation", which just exits when the first error is thrown (we don't care in the pipeline, if one or multiple errors are found). phpCsFixer has something similar for that: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/usage.rst

Thanks for considering!

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

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

weirdan commented 2 years ago

The current implementation of baseline prevents that, as the baseline is consulted during issue output after analysis is complete.

cklm commented 2 years ago

@weirdan thanks for clarification. Maybe as an option, when no baseline is used?

weirdan commented 2 years ago

You can achieve this already (if you don't care about pretty output) by setting throwExceptionOnError to true.