-
-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display list of available formatters with help for --format
#1624
Conversation
src/flake8/formatting/default.py
Outdated
**{ | ||
key: getattr(error, error_attr) | ||
for key, error_attr in MAPPING_KEYS.items() | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is over-DRY for little-to-no benefit and turns off the type checker for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's unfriendly to the type checker. Addressed in 5f14bc5. Let me know if you have any other ideas.
src/flake8/plugins/reporter.py
Outdated
@@ -7,6 +7,7 @@ | |||
from flake8.plugins.finder import LoadedPlugin | |||
|
|||
LOG = logging.getLogger(__name__) | |||
DEFAULT_REPORTER = "default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unrelated and an unhelpful "constant"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 27ae1ba.
src/flake8/main/options.py
Outdated
@@ -104,7 +107,9 @@ def __str__(self) -> str: | |||
return "auto" if self.is_auto else str(self.n_jobs) | |||
|
|||
|
|||
def register_default_options(option_manager: OptionManager) -> None: | |||
def register_default_options( | |||
option_manager: OptionManager, formatter_names: List[str] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding an argument here makes this harder to untangle later -- it also doesn't feel like the right place to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've refactored out it a bit in 2d456db. What do you think?
src/flake8/main/options.py
Outdated
f"mapping keys ({', '.join(sorted(MAPPING_KEYS))}). " | ||
f"For example, " | ||
f"``--format=pylint`` or ``--format='%%(path)s %%(code)s'``. " | ||
f"(Default: {DEFAULT_REPORTER})." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%(default)s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! Addressed in 27ae1ba.
tests/integration/test_main.py
Outdated
assert "(default, pylint, quiet-filename, quiet-nothing)" in output | ||
assert "(code, col, path, row, text)" in output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kinda weak assertions -- it would be better to assert the actual text rather than in
if the messaging is important
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you suggest checking the whole flake --help
output?
5fa7d0e
to
9400c14
Compare
9400c14
to
48b2919
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolves #223.