Skip to content

Commit b444fff

Browse files
Raise AssertionError for uncovered fallback case
Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent 18cc751 commit b444fff

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ exclude_lines =
2020

2121
# Abstract methods are not executed during pytest runs
2222
raise NotImplementedError()
23+
24+
# Fallback cases which should never be executed
25+
raise AssertionError

pylint/checkers/variables.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,9 @@ def _inferred_to_define_name_raise_or_return(
686686
case nodes.If():
687687
pass
688688
case _:
689-
return False
689+
# The function is only called for Try, With, For, While, Match and
690+
# If nodes. All of which are being handled above.
691+
raise AssertionError
690692

691693
# Be permissive if there is a break or a continue
692694
if any(node.nodes_of_class(nodes.Break, nodes.Continue)):

0 commit comments

Comments
 (0)