mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
Add --extend-select command line argument
Implement `--extend-select` command line argument following what was done for `--extend-ignore` in !233. This option can be used to selectively add individual codes without overriding the default list entirely. Addresses the remaining item of issue #1061.
This commit is contained in:
parent
9815f49cc4
commit
f98afbf7d9
6 changed files with 85 additions and 17 deletions
|
|
@ -105,6 +105,7 @@ def register_default_options(option_manager):
|
|||
- ``--max-doc-length``
|
||||
- ``--indent-size``
|
||||
- ``--select``
|
||||
- ``--extend-select``
|
||||
- ``--disable-noqa``
|
||||
- ``--show-source``
|
||||
- ``--statistics``
|
||||
|
|
@ -272,6 +273,18 @@ def register_default_options(option_manager):
|
|||
" For example, ``--select=E4,E51,W234``. (Default: %(default)s)",
|
||||
)
|
||||
|
||||
add_option(
|
||||
"--extend-select",
|
||||
metavar="errors",
|
||||
default="",
|
||||
parse_from_config=True,
|
||||
comma_separated_list=True,
|
||||
help=(
|
||||
"Comma-separated list of errors and warnings to add to the list "
|
||||
"of selected ones. For example, ``--extend-select=E4,E51,W234``."
|
||||
),
|
||||
)
|
||||
|
||||
add_option(
|
||||
"--disable-noqa",
|
||||
default=False,
|
||||
|
|
|
|||
|
|
@ -162,7 +162,14 @@ class DecisionEngine:
|
|||
)
|
||||
self.enabled_extensions = tuple(options.enable_extensions)
|
||||
self.all_selected = tuple(
|
||||
sorted(self.selected + self.enabled_extensions, reverse=True)
|
||||
sorted(
|
||||
itertools.chain(
|
||||
self.selected,
|
||||
options.extend_select,
|
||||
self.enabled_extensions,
|
||||
),
|
||||
reverse=True,
|
||||
)
|
||||
)
|
||||
self.ignored = tuple(
|
||||
sorted(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue