Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 7, 2024
1 parent aa2ab2b commit 17de0a4
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions prospector/tools/pylint/linter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import sys
import warnings
from pathlib import Path

from packaging import version as packaging_version
from pylint import version as pylint_version
from pylint.config.config_file_parser import _ConfigurationFileParser
from pylint.config.config_initialization import _order_all_first
from pylint.config.exceptions import _UnrecognizedOptionError
from pylint.lint import PyLinter
from pylint.utils import _splitstrip, utils

Expand Down Expand Up @@ -35,68 +32,10 @@ def config_from_file(self, config_file=None):
if "load-plugins" in config_data:
self.load_plugin_modules(utils._splitstrip(config_data["load-plugins"]))

unrecognized_options_message = None
# First we parse any options from a configuration file
try:
self._parse_configuration_file(config_args)
except _UnrecognizedOptionError as exc:
unrecognized_options_message = ", ".join(exc.options)

# Then, if a custom reporter is provided as argument, it may be overridden
# by file parameters, so we re-set it here. We do this before command line
# parsing, so it's still overridable by command line options
# if reporter:
# self.set_reporter(reporter)

# Set the current module to the command line
# to allow raising messages on it
self.set_current_module(config_file)

# Now we parse any options from the command line, so they can override
# the configuration file
# args_list = _order_all_first(args_list, joined=True)
# parsed_args_list = self._parse_command_line_configuration(args_list)

# Remove the positional arguments separator from the list of arguments if it exists
# try:
# parsed_args_list.remove("--")
# except ValueError:
# pass

# Check if there are any options that we do not recognize
unrecognized_options: list[str] = []
# for opt in parsed_args_list:
# if opt.startswith("--"):
# unrecognized_options.append(opt[2:])
# elif opt.startswith("-"):
# unrecognized_options.append(opt[1:])
if unrecognized_options:
msg = ", ".join(unrecognized_options)
try:
self._arg_parser.error(f"Unrecognized option found: {msg}")
except SystemExit:
sys.exit(32)

# Now that config file and command line options have been loaded
# with all disables, it is safe to emit messages
if unrecognized_options_message is not None:
self.set_current_module(str(config_file) if config_file else "")
self.add_message("unrecognized-option", args=unrecognized_options_message, line=0)

# TODO: Change this to be checked only when upgrading the configuration
for exc_name in self.config.overgeneral_exceptions:
if "." not in exc_name:
warnings.warn_explicit(
f"'{exc_name}' is not a proper value for the 'overgeneral-exceptions' option. "
f"Use fully qualified name (maybe 'builtins.{exc_name}' ?) instead. "
"This will cease to be checked at runtime when the configuration "
"upgrader is released.",
category=UserWarning,
filename="pylint: Command line or configuration file",
lineno=1,
module="pylint",
)

self._emit_stashed_messages()

# Set the current module to configuration as we don't know where
Expand Down

0 comments on commit 17de0a4

Please sign in to comment.