I am trying to run PyLint and need a setup where it only fails if the SEVERITY='ERROR' and also I still want to see and logs as in all severity level messages. I tried with --fail-on=E but it still fails. I run the command below:
pipenv run python3 -m pylint --fail-on=E src/app src/backend --output-format=teamcity.pylint_reporter.TeamCityReporter
Currently I get this error: Error 28
Is there a way to achieve this?
The pylint exit code is byte encoded depending on what was raised:
Fatal (1)
Error (2)
Warning (4)
Convention (8)
Refactor (16)
Information (NA)
See https://pylint.readthedocs.io/en/latest/user_guide/messages/index.html
It means in your case an okay output would be 4 (warning only), 8 (convention only), 12 (warning and convention), 16 (refactor only), 20 (warning and refactor), 24 (convention and refactor), or 28 (convention refactor and warning).
It might still fail when other messages are printed because all messages lower the score. The default behaviour is: if the score is less than 10, the exit code will be non-zero — see --fail-under:
Specify a score threshold under which the program will exit with error.
Default: 10
To get it to only fail on errors, but still show other messages, try this:
pylint src/app --fail-under 5 --fail-on E
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With