diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-05-01 19:56:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-01 19:56:15 +0200 |
commit | 76b853836801188667cf47f45b45493ef27d178c (patch) | |
tree | b7e842c4b2b1aefde1740f5d77f3b4b77578f742 | |
parent | e1769bd44631374eab4f9176f51cc64a7051f316 (diff) | |
download | pylint-git-76b853836801188667cf47f45b45493ef27d178c.tar.gz |
Disable fixme for internal uses before we make it optional in #3512 (#6482)
26 files changed, 25 insertions, 43 deletions
diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py index 31ed0703f..aafb0fb0a 100644 --- a/pylint/checkers/base_checker.py +++ b/pylint/checkers/base_checker.py @@ -189,7 +189,7 @@ class BaseChecker(_ArgumentsProvider): warnings.filterwarnings("ignore", category=DeprecationWarning) if isinstance(self, (BaseTokenChecker, BaseRawFileChecker)): default_scope = WarningScope.LINE - # TODO: 3.0: Remove deprecated if-statement # pylint: disable=fixme + # TODO: 3.0: Remove deprecated if-statement elif implements(self, (IRawChecker, ITokenChecker)): warnings.warn( # pragma: no cover "Checkers should subclass BaseTokenChecker or BaseRawFileChecker" diff --git a/pylint/checkers/classes/special_methods_checker.py b/pylint/checkers/classes/special_methods_checker.py index b3cb04383..cb714a787 100644 --- a/pylint/checkers/classes/special_methods_checker.py +++ b/pylint/checkers/classes/special_methods_checker.py @@ -288,7 +288,6 @@ class SpecialMethodsChecker(BaseChecker): if isinstance(node, astroid.bases.Generator): # Generators can be iterated. return True - # pylint: disable-next=fixme # TODO: 2.14: Should be covered by https://github.com/PyCQA/astroid/pull/1475 if isinstance(node, nodes.ComprehensionScope): # Comprehensions can be iterated. diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 15eb1fa72..d01899634 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -526,7 +526,6 @@ def _emit_no_member( def _determine_callable( callable_obj: nodes.NodeNG, ) -> tuple[CallableObjects, int, str]: - # pylint: disable=fixme # TODO: The typing of the second return variable is actually Literal[0,1] # We need typing on astroid.NodeNG.implicit_parameters for this # TODO: The typing of the third return variable can be narrowed to a Literal @@ -1828,7 +1827,6 @@ accessed. Python regular expressions are accepted.", self.add_message("unsupported-binary-operation", args=msg, node=node) break - # pylint: disable-next=fixme # TODO: This check was disabled (by adding the leading underscore) # due to false positives several years ago - can we re-enable it? # https://github.com/PyCQA/pylint/issues/6359 @@ -1837,7 +1835,6 @@ accessed. Python regular expressions are accepted.", """Detect TypeErrors for binary arithmetic operands.""" self._check_binop_errors(node) - # pylint: disable-next=fixme # TODO: This check was disabled (by adding the leading underscore) # due to false positives several years ago - can we re-enable it? # https://github.com/PyCQA/pylint/issues/6359 diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index cf4bf14de..78a84c773 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -1166,7 +1166,6 @@ def _supports_protocol( if protocol_callback(value): return True - # pylint: disable-next=fixme # TODO: 2.14: Should be covered by https://github.com/PyCQA/astroid/pull/1475 if isinstance(value, nodes.ComprehensionScope): return True diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index 6e9518704..0ad9b0c99 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -2200,7 +2200,6 @@ class VariablesChecker(BaseChecker): scope = node.scope() # FunctionDef subclasses Lambda due to a curious ontology. Check both. # See https://github.com/PyCQA/astroid/issues/291 - # pylint: disable-next=fixme # TODO: Revisit when astroid 3.0 includes the change if isinstance(scope, nodes.Lambda) and any( asmt.scope().parent_of(scope) for asmt in astmts diff --git a/pylint/config/arguments_manager.py b/pylint/config/arguments_manager.py index 7ceb04804..f5bd88e3e 100644 --- a/pylint/config/arguments_manager.py +++ b/pylint/config/arguments_manager.py @@ -80,7 +80,6 @@ class _ArgumentsManager: self._option_dicts: dict[str, OptionDict] = {} """All option dictionaries that have been registered.""" - # pylint: disable=fixme # TODO: 3.0: Remove deprecated attributes introduced to keep API # parity with optparse. Until '_maxlevel' with warnings.catch_warnings(): @@ -107,7 +106,7 @@ class _ArgumentsManager: @property def options_providers(self) -> list[ConfigProvider]: - # TODO: 3.0: Remove deprecated attribute. # pylint: disable=fixme + # TODO: 3.0: Remove deprecated attribute. warnings.warn( "options_providers has been deprecated. It will be removed in pylint 3.0.", DeprecationWarning, @@ -629,7 +628,7 @@ class _ArgumentsManager: def cb_set_provider_option(self, option, opt, value, parser): # pragma: no cover """DEPRECATED: Optik callback for option setting.""" - # TODO: 3.0: Remove deprecated method. # pylint: disable=fixme + # TODO: 3.0: Remove deprecated method. warnings.warn( "cb_set_provider_option has been deprecated. It will be removed in pylint 3.0.", DeprecationWarning, @@ -647,7 +646,7 @@ class _ArgumentsManager: def global_set_option(self, opt: str, value: Any) -> None: # pragma: no cover """DEPRECATED: Set option on the correct option provider.""" - # TODO: 3.0: Remove deprecated method. # pylint: disable=fixme + # TODO: 3.0: Remove deprecated method. warnings.warn( "global_set_option has been deprecated. You can use _arguments_manager.set_option " "or linter.set_option to set options on the global configuration object.", @@ -734,7 +733,7 @@ class _ArgumentsManager: optdict: None | str | OptionDict = "default_value", ) -> None: """Set an option on the namespace object.""" - # TODO: 3.0: Remove deprecated arguments. # pylint: disable=fixme + # TODO: 3.0: Remove deprecated arguments. if action != "default_value": warnings.warn( "The 'action' argument has been deprecated. You can use set_option " diff --git a/pylint/config/arguments_provider.py b/pylint/config/arguments_provider.py index 377f477f9..e07f44af5 100644 --- a/pylint/config/arguments_provider.py +++ b/pylint/config/arguments_provider.py @@ -20,7 +20,7 @@ class UnsupportedAction(Exception): """Raised by set_option when it doesn't know what to do for an action.""" def __init__(self, *args: object) -> None: - # TODO: 3.0: Remove deprecated exception # pylint: disable=fixme + # TODO: 3.0: Remove deprecated exception warnings.warn( "UnsupportedAction has been deprecated and will be removed in pylint 3.0", DeprecationWarning, @@ -50,7 +50,7 @@ class _ArgumentsProvider: @property def level(self) -> int: - # TODO: 3.0: Remove deprecated attribute # pylint: disable=fixme + # TODO: 3.0: Remove deprecated attribute warnings.warn( "The level attribute has been deprecated. It was used to display the checker in the help or not," " and everything is displayed in the help now. It will be removed in pylint 3.0.", @@ -60,7 +60,7 @@ class _ArgumentsProvider: @level.setter def level(self, value: int) -> None: - # TODO: 3.0: Remove deprecated attribute # pylint: disable=fixme + # TODO: 3.0: Remove deprecated attribute warnings.warn( "Setting the level attribute has been deprecated. It was used to display the checker in the help or not," " and everything is displayed in the help now. It will be removed in pylint 3.0.", @@ -70,7 +70,7 @@ class _ArgumentsProvider: @property def config(self) -> argparse.Namespace: - # TODO: 3.0: Remove deprecated attribute # pylint: disable=fixme + # TODO: 3.0: Remove deprecated attribute warnings.warn( "The checker-specific config attribute has been deprecated. Please use " "'linter.config' to access the global configuration object.", @@ -124,7 +124,7 @@ class _ArgumentsProvider: # pylint: disable-next=unused-argument def set_option(self, optname, value, action=None, optdict=None): # pragma: no cover """DEPRECATED: Method called to set an option (registered in the options list).""" - # TODO: 3.0: Remove deprecated method. # pylint: disable=fixme + # TODO: 3.0: Remove deprecated method. warnings.warn( "set_option has been deprecated. You can use _arguments_manager.set_option " "or linter.set_option to set options on the global configuration object.", diff --git a/pylint/config/callback_actions.py b/pylint/config/callback_actions.py index 761995399..e89879a5e 100644 --- a/pylint/config/callback_actions.py +++ b/pylint/config/callback_actions.py @@ -261,7 +261,6 @@ class _GenerateRCFileAction(_AccessRunObjectAction): values: str | Sequence[Any] | None, option_string: str | None = "--generate-rcfile", ) -> None: - # pylint: disable-next=fixme # TODO: 2.14: Deprecate this after discussion about this removal has been completed. with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) diff --git a/pylint/config/configuration_mixin.py b/pylint/config/configuration_mixin.py index e9f0d88ff..7854ff733 100644 --- a/pylint/config/configuration_mixin.py +++ b/pylint/config/configuration_mixin.py @@ -14,7 +14,7 @@ class ConfigurationMixIn(OptionsManagerMixIn, OptionsProviderMixIn): """ def __init__(self, *args, **kwargs): - # TODO: 3.0: Remove deprecated class # pylint: disable=fixme + # TODO: 3.0: Remove deprecated class warnings.warn( "ConfigurationMixIn has been deprecated and will be removed in pylint 3.0", DeprecationWarning, diff --git a/pylint/config/find_default_config_files.py b/pylint/config/find_default_config_files.py index c09576f83..a565a8c27 100644 --- a/pylint/config/find_default_config_files.py +++ b/pylint/config/find_default_config_files.py @@ -78,7 +78,6 @@ def find_default_config_files() -> Iterator[Path]: def find_pylintrc() -> str | None: """Search the pylint rc file and return its path if it finds it, else return None.""" - # pylint: disable-next=fixme # TODO: 3.0: Remove deprecated function warnings.warn( "find_pylintrc and the PYLINTRC constant have been deprecated. " diff --git a/pylint/config/option.py b/pylint/config/option.py index 255450977..5043fe765 100644 --- a/pylint/config/option.py +++ b/pylint/config/option.py @@ -172,7 +172,7 @@ class Option(optparse.Option): TYPE_CHECKER["py_version"] = _py_version_validator def __init__(self, *opts, **attrs): - # TODO: 3.0: Remove deprecated class # pylint: disable=fixme + # TODO: 3.0: Remove deprecated class warnings.warn( "Option has been deprecated and will be removed in pylint 3.0", DeprecationWarning, diff --git a/pylint/config/option_manager_mixin.py b/pylint/config/option_manager_mixin.py index ea5ebbeaf..0111263a3 100644 --- a/pylint/config/option_manager_mixin.py +++ b/pylint/config/option_manager_mixin.py @@ -64,7 +64,7 @@ class OptionsManagerMixIn: """Handle configuration from both a configuration file and command line options.""" def __init__(self, usage): - # TODO: 3.0: Remove deprecated class # pylint: disable=fixme + # TODO: 3.0: Remove deprecated class warnings.warn( "OptionsManagerMixIn has been deprecated and will be removed in pylint 3.0", DeprecationWarning, diff --git a/pylint/config/option_parser.py b/pylint/config/option_parser.py index bbed68036..b58fad3a4 100644 --- a/pylint/config/option_parser.py +++ b/pylint/config/option_parser.py @@ -19,7 +19,7 @@ def _level_options(group, outputlevel): class OptionParser(optparse.OptionParser): def __init__(self, option_class, *args, **kwargs): - # TODO: 3.0: Remove deprecated class # pylint: disable=fixme + # TODO: 3.0: Remove deprecated class warnings.warn( "OptionParser has been deprecated and will be removed in pylint 3.0", DeprecationWarning, diff --git a/pylint/config/options_provider_mixin.py b/pylint/config/options_provider_mixin.py index c7c2be9e9..5b20a290f 100644 --- a/pylint/config/options_provider_mixin.py +++ b/pylint/config/options_provider_mixin.py @@ -23,7 +23,7 @@ class OptionsProviderMixIn: level = 0 def __init__(self): - # TODO: 3.0: Remove deprecated class # pylint: disable=fixme + # TODO: 3.0: Remove deprecated class warnings.warn( "OptionsProviderMixIn has been deprecated and will be removed in pylint 3.0", DeprecationWarning, diff --git a/pylint/constants.py b/pylint/constants.py index 7b5081d64..de98fbee0 100644 --- a/pylint/constants.py +++ b/pylint/constants.py @@ -48,7 +48,6 @@ MSG_TYPES_STATUS = {"I": 0, "C": 16, "R": 8, "W": 4, "E": 2, "F": 1} MAIN_CHECKER_NAME = "master" USER_HOME = os.path.expanduser("~") -# pylint: disable-next=fixme # TODO: 3.0: Remove in 3.0 with all the surrounding code OLD_DEFAULT_PYLINT_HOME = ".pylint.d" DEFAULT_PYLINT_HOME = platformdirs.user_cache_dir("pylint") diff --git a/pylint/interfaces.py b/pylint/interfaces.py index 59bb07b46..a4d1288d8 100644 --- a/pylint/interfaces.py +++ b/pylint/interfaces.py @@ -73,7 +73,7 @@ def implements( interface: type[Interface] | tuple[type[Interface], ...], ) -> bool: """Does the given object (maybe an instance or class) implement the interface.""" - # TODO: 3.0: Remove deprecated function # pylint: disable=fixme + # TODO: 3.0: Remove deprecated function warnings.warn( "implements has been deprecated in favour of using basic " "inheritance patterns without using __implements__.", diff --git a/pylint/lint/parallel.py b/pylint/lint/parallel.py index 60610b02e..435bbb35e 100644 --- a/pylint/lint/parallel.py +++ b/pylint/lint/parallel.py @@ -56,7 +56,7 @@ def _worker_check_single_file( file_item: FileItem, ) -> tuple[ int, - # TODO: 3.0: Make this only str after deprecation has been removed # pylint: disable=fixme + # TODO: 3.0: Make this only str after deprecation has been removed str | None, str, str | None, diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index fd7e5d89c..e9195f86e 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -235,7 +235,6 @@ class PyLinter( options: Options = (), reporter: reporters.BaseReporter | reporters.MultiReporter | None = None, option_groups: tuple[tuple[str, str], ...] = (), - # pylint: disable-next=fixme # TODO: Deprecate passing the pylintrc parameter pylintrc: str | None = None, # pylint: disable=unused-argument ) -> None: @@ -314,7 +313,7 @@ class PyLinter( @property def option_groups(self) -> tuple[tuple[str, str], ...]: - # TODO: 3.0: Remove deprecated attribute # pylint: disable=fixme + # TODO: 3.0: Remove deprecated attribute warnings.warn( "The option_groups attribute has been deprecated and will be removed in pylint 3.0", DeprecationWarning, @@ -706,7 +705,6 @@ class PyLinter( """ self.initialize() if not isinstance(files_or_modules, (list, tuple)): - # pylint: disable-next=fixme # TODO: 3.0: Remove deprecated typing and update docstring warnings.warn( "In pylint 3.0, the checkers check function will only accept sequence of string", @@ -871,7 +869,7 @@ class PyLinter( return self.reporter.on_set_current_module(modname or "", filepath) if modname is None: - # TODO: 3.0: Remove all modname or ""'s in this method # pylint: disable=fixme + # TODO: 3.0: Remove all modname or ""'s in this method warnings.warn( ( "In pylint 3.0 modname should be a string so that it can be used to " @@ -899,7 +897,7 @@ class PyLinter( for c in _checkers if isinstance(c, checkers.BaseTokenChecker) and c is not self ] - # TODO: 3.0: Remove deprecated for-loop # pylint: disable=fixme + # TODO: 3.0: Remove deprecated for-loop for c in _checkers: with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) @@ -918,7 +916,7 @@ class PyLinter( rawcheckers = [ c for c in _checkers if isinstance(c, checkers.BaseRawFileChecker) ] - # TODO: 3.0: Remove deprecated if-statement # pylint: disable=fixme + # TODO: 3.0: Remove deprecated if-statement for c in _checkers: with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) @@ -1006,7 +1004,7 @@ class PyLinter( ast_node, walker, rawcheckers, tokencheckers ) - # TODO: 3.0: Remove unnecessary assertion # pylint: disable=fixme + # TODO: 3.0: Remove unnecessary assertion assert self.current_name self.stats.by_module[self.current_name]["statement"] = ( diff --git a/pylint/reporters/base_reporter.py b/pylint/reporters/base_reporter.py index 2d709b573..0b4507e5c 100644 --- a/pylint/reporters/base_reporter.py +++ b/pylint/reporters/base_reporter.py @@ -50,7 +50,6 @@ class BaseReporter: def set_output(self, output: TextIO | None = None) -> None: """Set output stream.""" - # pylint: disable-next=fixme # TODO: 3.0: Remove deprecated method warn( "'set_output' will be removed in 3.0, please use 'reporter.out = stream' instead", diff --git a/pylint/reporters/text.py b/pylint/reporters/text.py index c32ac0ecc..a60903e2e 100644 --- a/pylint/reporters/text.py +++ b/pylint/reporters/text.py @@ -130,7 +130,6 @@ def colorize_ansi( :return: the ANSI escaped string """ - # pylint: disable-next=fixme # TODO: 3.0: Remove deprecated typing and only accept MessageStyle as parameter if not isinstance(msg_style, MessageStyle): warnings.warn( @@ -257,7 +256,6 @@ class ColorizedTextReporter(TextReporter): ) = None, ) -> None: super().__init__(output) - # pylint: disable-next=fixme # TODO: 3.0: Remove deprecated typing and only accept ColorMappingDict as color_mapping parameter if color_mapping and not isinstance( list(color_mapping.values())[0], MessageStyle diff --git a/pylint/testutils/checker_test_case.py b/pylint/testutils/checker_test_case.py index 135a24a5a..51760fa4d 100644 --- a/pylint/testutils/checker_test_case.py +++ b/pylint/testutils/checker_test_case.py @@ -21,7 +21,6 @@ from pylint.utils import ASTWalker class CheckerTestCase: """A base testcase class for unit testing individual checker classes.""" - # pylint: disable-next=fixme # TODO: Figure out way to type this as type[BaseChecker] while also # setting self.checker correctly. CHECKER_CLASS: Any @@ -79,7 +78,6 @@ class CheckerTestCase: assert expected_msg.line == gotten_msg.line, msg assert expected_msg.col_offset == gotten_msg.col_offset, msg if PY38_PLUS: - # pylint: disable=fixme # TODO: 3.0: Remove deprecated missing arguments and remove the warning if not expected_msg.end_line == gotten_msg.end_line: warnings.warn( # pragma: no cover diff --git a/pylint/testutils/unittest_linter.py b/pylint/testutils/unittest_linter.py index 57f23bd6e..2b1af2516 100644 --- a/pylint/testutils/unittest_linter.py +++ b/pylint/testutils/unittest_linter.py @@ -38,7 +38,6 @@ class UnittestLinter(PyLinter): self, msgid: str, line: int | None = None, - # pylint: disable=fixme # TODO: Make node non optional node: nodes.NodeNG | None = None, args: Any = None, @@ -104,6 +104,8 @@ disable= too-few-public-methods, # handled by black format, + # We anticipate #3512 where it will become optional + fixme, [REPORTS] diff --git a/tests/pyreverse/test_diadefs.py b/tests/pyreverse/test_diadefs.py index 059f756bc..01457802c 100644 --- a/tests/pyreverse/test_diadefs.py +++ b/tests/pyreverse/test_diadefs.py @@ -88,7 +88,7 @@ def test_option_values( def test_default_values() -> None: """Test default values for package or class diagrams.""" - # TODO : should test difference between default values for package or class diagrams pylint: disable=fixme + # TODO : should test difference between default values for package or class diagrams class TestDefaultDiadefGenerator: diff --git a/tests/test_regr.py b/tests/test_regr.py index a2c7a9f5f..80492ae78 100644 --- a/tests/test_regr.py +++ b/tests/test_regr.py @@ -122,7 +122,6 @@ def test_check_package___init__(finalize_linter: PyLinter) -> None: assert checked == ["__init__"] -# pylint: disable-next=fixme # TODO: 3.0: Test are broken because of property shenanigans of config attribute # Re-enable after some of the old attributes have been removed after deprecation period @pytest.mark.xfail diff --git a/tests/test_self.py b/tests/test_self.py index 5e8a40c2d..a186174f1 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -253,7 +253,6 @@ class TestRunTC: def test_parallel_execution_missing_arguments(self) -> None: self._runtest(["-j 2", "not_here", "not_here_too"], code=1) - # pylint: disable-next=fixme # TODO: PY3.7: Turn off abbreviations in ArgumentsManager after 3.7 support has been dropped # argparse changed behaviour with abbreviations on/off in 3.8+ so we can't @pytest.mark.xfail |