diff --git a/doc/whatsnew/fragments/8407.breaking b/doc/whatsnew/fragments/8407.breaking new file mode 100644 index 0000000000..bb96c2f5dc --- /dev/null +++ b/doc/whatsnew/fragments/8407.breaking @@ -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 diff --git a/pylint/utils/file_state.py b/pylint/utils/file_state.py index 3370a67b2f..f849c98825 100644 --- a/pylint/utils/file_state.py +++ b/pylint/utils/file_state.py @@ -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 @@ -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,