Closed kczx3 closed 6 months ago
Feature is already available, you only have to use it: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-warnings-when-generating-the-exit-code
Note: you can use --runtime-set ...
instead of --config-set ...
if you only want to use it for a single run/specific command and not always.
Also note that you can set this via your custom ruleset as well using <config name="ignore_warnings_on_exit" value="1"/>
.
Ugh sorry 🤦♂️ I have a hard time navigating the documentation. Thought I looked everywhere
No worries, at least now you know.
Is your feature request related to a problem?
No
Describe the solution you'd like
I was hoping for a way to make the primary script only return a non-zero exit code if there are only
ERROR
s, regardless of the number ofWARNING
s. For my usecase, I would like warnings to still be emitted (so the-n
flag won't work here) but I don't want the process to exit with a code greater than zero. The reasoning here is that I use GitLab CI/CD and a non-zero exit code causes the job to fail. I don't want the job to fail if there are only warnings but I do still want them to be output. Hopefully this makes sense.src/Runner.php calls
$this->run()
and names the return value as $numErrors which isn't technically true asrun
actually adds the total errors and warnings for this value. Perhaps an additional command line flag could be added to flex this behavior.Additional context (optional)