jongracecox/pylint-exit

Question regarding the need for this tool

Closed this issue · 2 comments

Hi!

I discover your tool thanks to a colleague.

I don't quite understand its usefulness, given Pylint current behaviour regarding exit codes:
https://github.com/PyCQA/pylint/blob/main/pylint/lint/run.py#L398

It seems perfectly Unix-compliant to me, and does not match your project description:

Pylint uses bit-encoded exit codes to convey the results of the pylint review, which means it will return with a non-zero return code even when the pylint scoring was successful.

Pylint uses exit codes to convey the results of scoring (https://pylint.pycqa.org/en/latest/user_guide/usage/run.html#exit-codes). This means that, while a zero exit code means a successful run with no linting issues found, a non-zero exit code doesn't always mean that the pylint call failed - it instead means that one or more linting errors were detected. This can make it difficult to interpret results in a CI pipeline. For example, if you wanted to fail your CI pipeline only when fatal or error level linting errors occurred you would need to bit-decode the return code to identify whether those errors had occurred, which is difficult to do in shell script.

Line 398 in run.py doesn't exist any more, but I wonder, were you referring to the config.fail_under configuration that was added? This appears [in the what's new section of the docs]:(https://github.com/PyCQA/pylint/blob/214201a07aef7068013ff3af1c3cbd479ac39146/doc/whatsnew/2/2.8/full.rst)

Run will not fail if score exactly equals config.fail_under.

If so, this is used to ensure an exit code of zero based on the score, not on the type of linting errors found, so doesn't do the same thing.

If there is an alternative way of doing this that I'm not aware of please let me know.

Thank you for your answer

I did not use this tool in the end, and your answer was very clear & detailed

Closing this now