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-12 12:56:42 +0200
committerGitHub <noreply@github.com>2022-04-12 12:56:42 +0200
commit03cfbf3df1d20ba1bfd445c59f18c906e8dd8a62 (patch)
treeee5c4d6fff9e1d6630b7ee31151e141df08ba4c8 /pylint/config/arguments_manager.py
parent575628a8736bdd60042bc27ca0ab33fa828e199b (diff)
downloadpylint-git-03cfbf3df1d20ba1bfd445c59f18c906e8dd8a62.tar.gz
Use ``namespace`` in ``PyLinter`` and the functional config tests (#6271)
* Use callback actions in ``PyLinter`` * Turn off ``optparse`` command line parsing * No longer emit ``bad-configuration-section`` Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'pylint/config/arguments_manager.py')
-rw-r--r--pylint/config/arguments_manager.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/pylint/config/arguments_manager.py b/pylint/config/arguments_manager.py
index 6aba68eb3..2a07d999f 100644
--- a/pylint/config/arguments_manager.py
+++ b/pylint/config/arguments_manager.py
@@ -456,7 +456,8 @@ class _ArgumentsManager:
if verbose:
print(f"Using config file '{config_file}'", file=sys.stderr)
- def _parse_toml(self, config_file: Path, parser: configparser.ConfigParser) -> None:
+ @staticmethod
+ def _parse_toml(config_file: Path, parser: configparser.ConfigParser) -> None:
"""DEPRECATED: Parse and handle errors of a toml configuration file.
TODO: Remove after read_config_file has been removed.
@@ -472,10 +473,6 @@ class _ArgumentsManager:
# TOML has rich types, convert values to
# strings as ConfigParser expects.
if not isinstance(values, dict):
- # This class is a mixin: add_message comes from the `PyLinter` class
- self.add_message( # type: ignore[attr-defined] # pylint: disable=no-member
- "bad-configuration-section", line=0, args=(section, values)
- )
continue
for option, value in values.items():
if isinstance(value, bool):
@@ -546,7 +543,7 @@ class _ArgumentsManager:
value = getattr(options, attr, None)
if value is None:
continue
- setattr(config, attr, value)
+ setattr(config, attr, value) # pragma: no cover # Handled by argparse.
return args
def help(self, level: Optional[int] = None) -> str:
@@ -560,8 +557,9 @@ class _ArgumentsManager:
return self._arg_parser.format_help()
# pylint: disable-next=fixme
- # TODO: Optparse: Refactor and potentially deprecate cb_set_provider_option
- def cb_set_provider_option(self, option, opt, value, parser):
+ # TODO: Optparse: Deprecate cb_set_provider_option
+ # Currently uncovered.
+ def cb_set_provider_option(self, option, opt, value, parser): # pragma: no cover
"""Optik callback for option setting."""
if opt.startswith("--"):
# remove -- on long option