Skip to content

Commit c0da506

Browse files
committed
WIP
1 parent 4f4c99a commit c0da506

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

pylint/lint/pylinter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ def _check_astroid_module(
938938
if self._ignore_file:
939939
return False
940940
# walk ast to collect line numbers
941-
self.file_state.collect_block_lines(self.msgs_store, node)
941+
# self.file_state.collect_block_lines(self.msgs_store, node)
942942
# run raw and tokens checkers
943943
for raw_checker in rawcheckers:
944944
raw_checker.process_module(node)

pylint/utils/file_state.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ def _set_message_state_in_block(
133133
else:
134134
first_ = lineno
135135
last_ = last
136+
if first_ < max(self._raw_module_msgs_state[msg.msgid]):
137+
first_ = max(self._raw_module_msgs_state[msg.msgid])
138+
if first_ == 1:
139+
first_ = 0
136140
for line in range(first_, last_ + 1):
137141
# do not override existing entries
138-
if line in self._module_msgs_state.get(msg.msgid, ()):
139-
continue
140142
if line in lines: # state change in the same block
141143
state = lines[line]
142144
original_lineno = line
@@ -155,9 +157,13 @@ def set_msg_status(self, msg: MessageDefinition, line: int, status: bool) -> Non
155157
assert self._msgs_store
156158

157159
try:
158-
self._module_msgs_state[msg.msgid][line] = status
160+
self._raw_module_msgs_state[msg.msgid][line] = status
159161
except KeyError:
160-
self._module_msgs_state[msg.msgid] = {line: status}
162+
self._raw_module_msgs_state[msg.msgid] = {line: status}
163+
164+
self._collect_block_lines(
165+
self._msgs_store, self._module, {msg.msgid: {line: status}}
166+
)
161167
print(self._module_msgs_state)
162168

163169
def handle_ignored_message(

0 commit comments

Comments
 (0)