communicate that --select is usually unnecessary

This commit is contained in:
Anthony Sottile 2022-12-14 12:55:37 -05:00
parent 780f64fdd2
commit 837e81948b
5 changed files with 17 additions and 10 deletions

View file

@ -607,13 +607,14 @@ Options and their Descriptions
:ref:`Go back to index <top>`
**You usually do not need to specify this option as the default includes
all installed plugin codes.**
Specify the list of error codes you wish |Flake8| to report. Similarly to
:option:`--ignore`. You can specify a portion of an error code to get all
that start with that string. For example, you can use ``E``, ``E4``,
``E43``, and ``E431``.
This defaults to: ``E,F,W,C90``
Command-line example:
.. prompt:: bash
@ -649,6 +650,9 @@ Options and their Descriptions
.. versionadded:: 4.0.0
**You usually do not need to specify this option as the default includes
all installed plugin codes.**
Specify a list of codes to add to the list of selected ones. Similar
considerations as in :option:`--select` apply here with regard to the
value.

View file

@ -16,7 +16,6 @@ EXCLUDE = (
"*.egg",
)
IGNORE = ("E121", "E123", "E126", "E226", "E24", "E704", "W503", "W504")
SELECT = ("E", "F", "W", "C90")
MAX_LINE_LENGTH = 79
INDENT_SIZE = 4

View file

@ -297,9 +297,11 @@ def register_default_options(option_manager: OptionManager) -> None:
parse_from_config=True,
comma_separated_list=True,
help=(
f"Comma-separated list of error codes to enable. "
f"For example, ``--select=E4,E51,W234``. "
f"(Default: {','.join(defaults.SELECT)})"
"Limit the reported error codes to codes prefix-matched by this "
"list. "
"You usually do not need to specify this option as the default "
"includes all installed plugin codes. "
"For example, ``--select=E4,E51,W234``."
),
)
@ -309,8 +311,10 @@ def register_default_options(option_manager: OptionManager) -> None:
parse_from_config=True,
comma_separated_list=True,
help=(
"Comma-separated list of error codes to add to the list "
"of selected ones. For example, ``--extend-select=E4,E51,W234``."
"Add additional error codes to the default ``--select``. "
"You usually do not need to specify this option as the default "
"includes all installed plugin codes. "
"For example, ``--extend-select=E4,E51,W234``."
),
)

View file

@ -88,7 +88,7 @@ class DecisionEngine:
self.selected = _select_ignore(
option=options.select,
default=defaults.SELECT,
default=(),
extended_default=options.extended_default_select,
extend=options.extend_select,
)

View file

@ -14,7 +14,7 @@ def create_options(**kwargs):
kwargs.setdefault("ignore", None)
kwargs.setdefault("extend_select", None)
kwargs.setdefault("extend_ignore", None)
kwargs.setdefault("extended_default_select", [])
kwargs.setdefault("extended_default_select", ["C90", "F", "E", "W"])
kwargs.setdefault("extended_default_ignore", [])
kwargs.setdefault("disable_noqa", False)
return argparse.Namespace(**kwargs)