Repository navigation
Issue 3241: CLI tool to explain violations - #3256
Conversation
sobolevn
left a comment
There was a problem hiding this comment.
Thanks! There's a lot of work ahead, this is not a full review :)
I will look again tomorrow.
|
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 |
sobolevn
left a comment
There was a problem hiding this comment.
Thank you! Looks like that this is the ~last review round :)
…nts (formatter.py also affected). Move from using hardcoded module names to module discovery with glob.
sobolevn
left a comment
There was a problem hiding this comment.
I saw some new things to improve 😊
| universal_newlines=True, | ||
| encoding=encoding, | ||
| env=os.environ, | ||
| shell=True, |
There was a problem hiding this comment.
why do we need shell= and env=?
There was a problem hiding this comment.
Marking as not really resolved. I think that we might need to use shell=True because wps is not locatable without the PATH, right?
sobolevn
left a comment
There was a problem hiding this comment.
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.
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
# Conflicts: # wemake_python_styleguide/cli/application.py # wemake_python_styleguide/cli/commands/base.py # wemake_python_styleguide/cli/commands/explain/command.py
|
|
||
| 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.
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.mdRelated 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.