Skip to content

Commit

Permalink
[FileState] Remove 'collect_block_lines'
Browse files Browse the repository at this point in the history
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
  • Loading branch information
Pierre-Sassoulas and DanielNoord committed Mar 8, 2023
1 parent 03bfeff commit 0db9441
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
5 changes: 5 additions & 0 deletions doc/whatsnew/fragments/8407.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
``modname`` and ``msg_store`` are now required to be given in ``FileState``.
``collect_block_lines`` has also been removed. ``Pylinter.current_name``
cannot be null anymore.

Refs #8407
20 changes: 0 additions & 20 deletions pylint/utils/file_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import collections
import sys
import warnings
from collections import defaultdict
from collections.abc import Iterator
from typing import TYPE_CHECKING, Dict
Expand Down Expand Up @@ -60,25 +59,6 @@ def __init__(
PyLinter.
"""

def collect_block_lines(
self, msgs_store: MessageDefinitionStore, module_node: nodes.Module
) -> None:
"""Walk the AST to collect block level options line numbers."""
warnings.warn(
"'collect_block_lines' has been deprecated and will be removed in pylint 3.0.",
DeprecationWarning,
stacklevel=2,
)
for msg, lines in self._module_msgs_state.items():
self._raw_module_msgs_state[msg] = lines.copy()
orig_state = self._module_msgs_state.copy()
self._module_msgs_state = {}
self._suppression_mapping = {}
self._effective_max_line_number = module_node.tolineno
for msgid, lines in orig_state.items():
for msgdef in msgs_store.get_message_definitions(msgid):
self._set_state_on_block_lines(msgs_store, module_node, msgdef, lines)

def _set_state_on_block_lines(
self,
msgs_store: MessageDefinitionStore,
Expand Down

0 comments on commit 0db9441

Please sign in to comment.