Skip to content

Commit f272ae8

Browse files
aatlePierre-Sassoulas
authored andcommitted
Enable possibly-used-before-assignment
1 parent 2139a23 commit f272ae8

File tree

8 files changed

+7
-1
lines changed

8 files changed

+7
-1
lines changed

pylint/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def table_lines_from_stats(
110110
("error", "NC"),
111111
]
112112

113+
# pylint: disable=possibly-used-before-assignment
113114
for index, value in enumerate(new):
114115
new_value = value[1]
115116
old_value = old[index][1]

pylint/checkers/refactoring/implicit_booleaness_checker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def _check_compare_to_str_or_zero(self, node: nodes.Compare) -> None:
222222
error_detected = True
223223
op = op_1
224224
if error_detected:
225+
# pylint: disable=possibly-used-before-assignment
225226
original = f"{op_1.as_string()} {op_2} {op_3.as_string()}"
226227
suggestion = (
227228
op.as_string()

pylint/checkers/similar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ def stripped_lines(
596596
the line
597597
:return: the collection of line/line number/line type tuples
598598
"""
599+
# pylint: disable=possibly-used-before-assignment
599600
if ignore_imports or ignore_signatures:
600601
tree = astroid.parse("".join(lines))
601602
if ignore_imports:

pylint/checkers/typecheck.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,7 @@ def visit_subscript(self, node: nodes.Subscript) -> None:
21352135
msg = "unsupported-delete-operation"
21362136

21372137
if isinstance(node.value, nodes.SetComp):
2138+
# pylint: disable-next=possibly-used-before-assignment
21382139
self.add_message(msg, args=node.value.as_string(), node=node.value)
21392140
return
21402141

pylint/testutils/_primer/primer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def __init__(self, primer_directory: Path, json_path: Path) -> None:
105105
command_class = RunCommand
106106
elif self.config.command == "compare":
107107
command_class = CompareCommand
108+
# pylint: disable-next=possibly-used-before-assignment
108109
self.command = command_class(self.primer_directory, self.packages, self.config)
109110

110111
def run(self) -> None:

pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ disable=
109109
# We anticipate #3512 where it will become optional
110110
fixme,
111111
consider-using-assignment-expr,
112-
possibly-used-before-assignment,
113112

114113

115114
[REPORTS]

tests/message/unittest_message.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def build_message(
5353
expected = (
5454
"2:5:6: E1234: Duplicate keyword argument %r in %s call (duplicate-keyword-arg)"
5555
)
56+
# pylint: disable=possibly-used-before-assignment
5657
e1234 = build_message(e1234_message_definition, e1234_location_values)
5758
w1234 = build_message(w1234_message_definition, w1234_location_values)
5859
assert e1234.location == e1234_location_values

tests/test_check_parallel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ def test_map_reduce(self, num_files: int, num_jobs: int, num_checkers: int) -> N
603603
files=file_infos,
604604
)
605605
stats_check_parallel = linter.stats
606+
# pylint: disable=possibly-used-before-assignment
606607
assert str(stats_single_proc.by_msg) == str(
607608
stats_check_parallel.by_msg
608609
), "Single-proc and check_parallel() should return the same thing"

0 commit comments

Comments
 (0)