Skip to content

Allow failing when score is affected by Information warning #5318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pylint/lint/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,13 @@ def __init__(
# We need to make sure we return a failing exit code in this case.
# So we use self.linter.msg_status if that is non-zero, otherwise we just return 1.
sys.exit(self.linter.msg_status or 1)
elif score_value is not None and score_value >= linter.config.fail_under:
sys.exit(0)
elif score_value is not None:
if score_value >= linter.config.fail_under:
sys.exit(0)
else:
# We need to make sure we return a failing exit code in this case.
# So we use self.linter.msg_status if that is non-zero, otherwise we just return 1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the 1 here. Is it really necessary ? Shouldn't it be 32 because if self.linter.msg_status is 0 then there is only Informational messages ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do the same on L414. 32 corresponds to usage error so that also doesn't make much sense. We don't have a good code for Information..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, it's another issue entirely.

sys.exit(self.linter.msg_status or 1)
else:
sys.exit(self.linter.msg_status)

Expand Down