Show visual indication when score is below --fail-under threshold#10856
Show visual indication when score is below --fail-under threshold#10856danielalanbates wants to merge 2 commits intopylint-dev:mainfrom
Conversation
When the score is below the --fail-under threshold, the evaluation output now includes a message indicating that the score is below the configured threshold. Previously, pylint would exit with code 16 but give no visual indication in the terminal output. Closes pylint-dev#8503 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Thank you for working on pylint. As for all llm generated MR this seems sensible but we need to check it in detail to make sure it's the right place to do this. In this case there's probably another place where the under threshold condition is checked that I feel could work better but maybe the reporting is not imbricated with the exit logic even if everything happens in pylinter. I'm on mobile so i'll check later.
This comment has been minimized.
This comment has been minimized.
|
Some tests need to be updated, see https://pylint.readthedocs.io/en/stable/development_guide/contributor_guide/tests/index.html |
jacobtylerwalls
left a comment
There was a problem hiding this comment.
Once the tests are passing, this LGTM
|
Thank you for the review! Glad it helps. 🙏 |
|
👋 Do you plan to update the failing tests? |
The test was using the default fail-under threshold of 10. With the new visual indication feature (score < threshold shows a message), the existing test output broke because 0.00 < 10. Set fail-under to -10 in the test since it is testing multi-format output, not the fail-under threshold feature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Sorry for the delay in reviewing, thank you for working on pylint again.
| if note is not None and note < self.config.fail_under: | ||
| msg += ( | ||
| f"\nYour score {note:.2f} is below the" | ||
| f" fail-under threshold of {self.config.fail_under}" | ||
| ) | ||
|
|
There was a problem hiding this comment.
Imo this should go in run.py:
Lines 248 to 253 in 4f62b34
There's already a check done here, let's keep this logic in one place.
|
Thank you for the review! Glad it helps. 🙏 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10856 +/- ##
=======================================
Coverage 96.03% 96.04%
=======================================
Files 177 177
Lines 19621 19630 +9
=======================================
+ Hits 18844 18853 +9
Misses 777 777
🚀 New features to boost your workflow:
|
|
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 1f48a1b |
Summary
--fail-underthreshold, the evaluation output now includes a visual message:Your score X.XX is below the fail-under threshold of Y.YBefore:
After:
Closes #8503
Test plan
test_fail_undertests pass (exit codes unchanged)test_fail_onparametrized tests pass (20 cases)test_fail_under_visual_indicationtest verifies the message is shown when score < thresholdThis PR was created with the assistance of Claude Opus 4.6 by Anthropic. Happy to make any adjustments! Reviewed and submitted by a human.