-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
Issue 3241: CLI tool to explain violations #3256
Conversation
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.
Thanks! There's a lot of work ahead, this is not a full review :)
I will look again tomorrow.
wemake_python_styleguide/cli/commands/explain/message_formatter.py
Outdated
Show resolved
Hide resolved
wemake_python_styleguide/cli/commands/explain/message_formatter.py
Outdated
Show resolved
Hide resolved
wemake_python_styleguide/cli/commands/explain/violation_loader.py
Outdated
Show resolved
Hide resolved
Please, rebase your PR. |
Add explain command
# Conflicts: # CHANGELOG.md # docs/pages/usage/cli.rst # wemake_python_styleguide/cli/application.py # wemake_python_styleguide/cli/commands/base.py # wemake_python_styleguide/cli/commands/explain/command.py # wemake_python_styleguide/cli/commands/explain/message_formatter.py # wemake_python_styleguide/cli/commands/explain/violation_loader.py
Add explain command (with code review and updated docs)
# Conflicts: # CHANGELOG.md # docs/pages/usage/cli.rst # poetry.lock # tests/test_cli/test_explain.py # wemake_python_styleguide/cli/application.py # wemake_python_styleguide/cli/cli_app.py # wemake_python_styleguide/cli/commands/explain/message_formatter.py # wemake_python_styleguide/cli/commands/explain/violation_loader.py # wemake_python_styleguide/cli/output.py
# Conflicts: # tests/test_cli/test_explain.py
Applied all changes except removing |
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.
Thank you! Looks like that this is the ~last review round :)
wemake_python_styleguide/cli/commands/explain/message_formatter.py
Outdated
Show resolved
Hide resolved
wemake_python_styleguide/cli/commands/explain/violation_loader.py
Outdated
Show resolved
Hide resolved
wemake_python_styleguide/cli/commands/explain/violation_loader.py
Outdated
Show resolved
Hide resolved
…nts (formatter.py also affected). Move from using hardcoded module names to module discovery with glob.
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 saw some new things to improve 😊
universal_newlines=True, | ||
encoding=encoding, | ||
env=os.environ, | ||
shell=True, |
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.
why do we need shell=
and env=
?
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.
Marking as not really resolved. I think that we might need to use shell=True
because wps
is not locatable without the PATH
, right?
wemake_python_styleguide/cli/commands/explain/message_formatter.py
Outdated
Show resolved
Hide resolved
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.
We are almost there! This is going to be an amazing feature, thanks a lot to your for delivering it! 👍
universal_newlines=True, | ||
encoding=encoding, | ||
env=os.environ, | ||
shell=True, |
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.
Marking as not really resolved. I think that we might need to use shell=True
because wps
is not locatable without the PATH
, right?
Also thought about a slight improvement: we can add a shorthand for |
I don't think that adding some shorthands is actually a good thing :) |
…textwrap library. Add typed arguments for subcommands
# Conflicts: # tests/test_cli/test_explain.py # tests/test_cli/test_explain_internals.py # wemake_python_styleguide/cli/cli_app.py # wemake_python_styleguide/cli/commands/explain/message_formatter.py
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.
Thanks!
# Conflicts: # wemake_python_styleguide/cli/application.py # wemake_python_styleguide/cli/commands/base.py # wemake_python_styleguide/cli/commands/explain/command.py
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.
Thank you!
|
||
def get_violation_submodules() -> Collection[ModuleType]: | ||
"""Get all possible violation submodules.""" | ||
return _safely_get_all_submodules(_VIOLATION_MODULE_BASE) |
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 we really need _safely_get_all_submodules
? It is used in a single place, but all this function does is calling _safely_get_all_submodules
So, let's just remove _safely_get_all_submodules
and move all code to get_violation_submodules
You did a great job here, awesome feature! Thanks a lot for your patience during the review time :) |
I have made things!
Checklist
CHANGELOG.md
Related issues
#3241 CLI tool to explain issues
🙏 Please, if you or your company is finding wemake-python-styleguide valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/wemake-python-styleguide. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.