Skip to content
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

Merged
merged 1 commit into from
Oct 15, 2022

Conversation

atugushev
Copy link
Contributor

Resolves #223.

Comment on lines 57 to 60
**{
key: getattr(error, error_attr)
for key, error_attr in MAPPING_KEYS.items()
},
Copy link
Member

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

Copy link
Contributor Author

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.

@@ -7,6 +7,7 @@
from flake8.plugins.finder import LoadedPlugin

LOG = logging.getLogger(__name__)
DEFAULT_REPORTER = "default"
Copy link
Member

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 27ae1ba.

@@ -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]
Copy link
Member

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

Copy link
Contributor Author

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?

f"mapping keys ({', '.join(sorted(MAPPING_KEYS))}). "
f"For example, "
f"``--format=pylint`` or ``--format='%%(path)s %%(code)s'``. "
f"(Default: {DEFAULT_REPORTER})."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%(default)s

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! Addressed in 27ae1ba.

Comment on lines 417 to 418
assert "(default, pylint, quiet-filename, quiet-nothing)" in output
assert "(code, col, path, row, text)" in output
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile asottile merged commit 09a75e8 into PyCQA:main Oct 15, 2022
@atugushev atugushev deleted the format-option-help branch October 15, 2022 20:23
@asottile asottile added this to the 6.0.0 milestone Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display list of available formatters with help for --format
2 participants