Clarify the target of no-else elif suggestions - #11362
Open
Jokasa7 wants to merge 2 commits into
Open
Conversation
Make the shared no-else action identify the first following elif, and document the multi-elif transformation and local-disable tradeoff for no-else-return.\n\nCloses pylint-dev#9274
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11362 +/- ##
=======================================
Coverage 96.42% 96.42%
=======================================
Files 178 178
Lines 20131 20136 +5
=======================================
+ Hits 19412 19417 +5
Misses 719 719
🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
Pierre-Sassoulas
requested changes
Aug 29, 2026
Pierre-Sassoulas
left a comment
Member
There was a problem hiding this comment.
Thank you for tackling this one! I think this is too verbose, let's change the message content for something clearer but let's not details too much either.
Contributor
|
🤖 Effect of this PR on checked open source code: 🤖 Effect on astropy: Changed messages: Details- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "continue", remove the leading "el" from "elif"
+ Unnecessary "elif" after "continue", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "return", remove the leading "el" from "elif"
+ Unnecessary "elif" after "return", replace only that "elif" with "if"
^^^^^^ ^^^ ^ ^^^^^^^^^^- Unnecessary "elif" after "raise", remove the leading "el" from "elif"
+ Unnecessary "elif" after "raise", replace only that "elif" with "if"
...This comment was truncated because GitHub allows only 65536 characters in a comment. This comment was generated for commit 6a00b57 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Changes
Description
The
no-else-returndiagnostic is emitted on the precedingif, while itssuggestion refers to an
eliflater in the chain. In a chain with more than oneelif, the previous wording—remove the leading "el" from "elif"—did not makeit clear which keyword should change. That ambiguity is the source of the
unsafe-looking transformation reported in #9274.
This change makes the suggested edit explicit: replace only the first
eliffollowing the reported branch with
if. The checker uses the same suggestionbuilder for
no-else-return,no-else-raise,no-else-break, andno-else-continue, so the corresponding functional expectations are updatedtogether. Detection, message location, confidence, message IDs, and local
suppression behavior are unchanged.
The
no-else-returndocumentation now uses a multi-elifexample in which thefirst non-returning branch falls through. Its corrected form changes only the
targeted
elifand keeps the laterelif/elsechain attached. Additionalguidance explains that a later Pylint run may report another independently
redundant branch, and that retaining an exhaustive-looking chain can be a valid
readability choice handled with a local disable.
Validation:
python -m pytest tests/test_functional.py -k "no_else_return or no_else_raise or no_else_break or no_else_continue"— 4 passedpython -m pytest doc/test_messages_documentation.py— 852 passed, 2 skippedsphinx-build -T -W -j auto --keep-going -b html -d _build/doctrees -D language=en . _build/html— build succeededpre-commit run --all-files— all hooks passedgit diff --check— passedCloses #9274
AI assistance was used for issue and code-path research and for drafting. I
reviewed the final diff and ran the validation listed above.