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 21:38:28 +0200
committerGitHub <noreply@github.com>2022-04-07 21:38:28 +0200
commita3f5c47822e50d6afd629a6739fcb4c047f995b4 (patch)
treecc536a2cbca7c7d7e554d7441c55497dae54ed02 /pylint/config/arguments_manager.py
parent3690134ea670b12fa6d729c1ad06d87dba9567ed (diff)
downloadpylint-git-a3f5c47822e50d6afd629a6739fcb4c047f995b4.tar.gz
Deprecate ``load_provider_defaults`` and ``read_config_file`` (#6224)
Diffstat (limited to 'pylint/config/arguments_manager.py')
-rw-r--r--pylint/config/arguments_manager.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/pylint/config/arguments_manager.py b/pylint/config/arguments_manager.py
index b9c5e4979..08c8a46c5 100644
--- a/pylint/config/arguments_manager.py
+++ b/pylint/config/arguments_manager.py
@@ -433,13 +433,13 @@ class _ArgumentsManager:
)
printed = True
- # 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_provider_defaults(self):
+ def load_provider_defaults(self) -> None:
"""Initialize configuration using default values."""
+ warnings.warn(
+ "load_provider_defaults has been deprecated. Parsing of option defaults should be done "
+ "automatically by initializing an ArgumentsProvider.",
+ DeprecationWarning,
+ )
for provider in self.options_providers:
provider.load_defaults()
@@ -449,6 +449,10 @@ class _ArgumentsManager:
"""Read the configuration file but do not load it (i.e. dispatching
values to each option's provider)
"""
+ warnings.warn(
+ "read_config_file has been deprecated. It will be removed in pylint 3.0.",
+ DeprecationWarning,
+ )
if not config_file:
if verbose:
print(
@@ -479,7 +483,10 @@ class _ArgumentsManager:
print(f"Using config file '{config_file}'", file=sys.stderr)
def _parse_toml(self, config_file: Path, parser: configparser.ConfigParser) -> None:
- """Parse and handle errors of a toml configuration file."""
+ """Parse and handle errors of a toml configuration file.
+
+ TODO: Remove after read_config_file has been removed.
+ """
with open(config_file, mode="rb") as fp:
content = tomllib.load(fp)
try:
@@ -510,6 +517,11 @@ 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):
"""Dispatch values previously read from a configuration file to each
option's provider