summaryrefslogtreecommitdiff
path: root/pylint/config/arguments_manager.py
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-07 23:43:46 +0200
committerGitHub <noreply@github.com>2022-04-07 23:43:46 +0200
commit09fa03ce551109213d03c146da90e992d0dd52fd (patch)
tree88516d1bd46de1f57ac1bc2a3cea173898b89b18 /pylint/config/arguments_manager.py
parent7fd200ce1f93a6ba8e68743d0cd32d1ff550dedf (diff)
downloadpylint-git-09fa03ce551109213d03c146da90e992d0dd52fd.tar.gz
Deprecate ``load_config_file``, ``load_configuration`` and ``load_configuration_from_config`` (#6227)
Diffstat (limited to 'pylint/config/arguments_manager.py')
-rw-r--r--pylint/config/arguments_manager.py34
1 files changed, 24 insertions, 10 deletions
diff --git a/pylint/config/arguments_manager.py b/pylint/config/arguments_manager.py
index 08c8a46c5..21d60b2ec 100644
--- a/pylint/config/arguments_manager.py
+++ b/pylint/config/arguments_manager.py
@@ -14,7 +14,7 @@ import os
import sys
import warnings
from pathlib import Path
-from typing import TYPE_CHECKING, Dict, List, Optional, TextIO, Tuple, Union
+from typing import TYPE_CHECKING, Any, Dict, List, Optional, TextIO, Tuple, Union
from pylint import utils
from pylint.config.argument import (
@@ -517,15 +517,14 @@ class _ArgumentsManager:
parser.add_section(section_name)
parser.set(section_name, option, value=value)
- # pylint: disable-next=fixme
- # TODO: Optparse: All methods below this line are copied to keep API-parity with
- # OptionsManagerMixIn. They should either be deprecated or moved above this line
- # to keep them in _ArgumentsManager
-
- def load_config_file(self):
+ def load_config_file(self) -> None:
"""Dispatch values previously read from a configuration file to each
option's provider
"""
+ warnings.warn(
+ "load_config_file has been deprecated. It will be removed in pylint 3.0.",
+ DeprecationWarning,
+ )
parser = self.cfgfile_parser
for section in parser.sections():
for option, value in parser.items(section):
@@ -534,16 +533,31 @@ class _ArgumentsManager:
except (KeyError, optparse.OptionError):
continue
- def load_configuration(self, **kwargs):
+ def load_configuration(self, **kwargs: Any) -> None:
"""Override configuration according to given parameters."""
- return self.load_configuration_from_config(kwargs)
+ warnings.warn(
+ "load_configuration has been deprecated. It will be removed in pylint 3.0.",
+ DeprecationWarning,
+ )
+ with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", category=DeprecationWarning)
+ return self.load_configuration_from_config(kwargs)
- def load_configuration_from_config(self, config):
+ def load_configuration_from_config(self, config: Dict[str, Any]) -> None:
+ warnings.warn(
+ "load_configuration_from_config has been deprecated. It will be removed in pylint 3.0.",
+ DeprecationWarning,
+ )
for opt, opt_value in config.items():
opt = opt.replace("_", "-")
provider = self._all_options[opt]
provider.set_option(opt, opt_value)
+ # pylint: disable-next=fixme
+ # TODO: Optparse: All methods below this line are copied to keep API-parity with
+ # OptionsManagerMixIn. They should either be deprecated or moved above this line
+ # to keep them in _ArgumentsManager
+
def load_command_line_configuration(self, args=None) -> List[str]:
"""Override configuration according to command line parameters.