-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
base: master
Are you sure you want to change the base?
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3256 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 348 356 +8
Lines 11537 11747 +210
Branches 795 803 +8
==========================================
+ Hits 11537 11747 +210 ☔ View full report in Codecov by Sentry. |
Added more tests, coverage now is 100%. Also spotted an issue with |
|
||
def _is_a_violation(class_object) -> bool: | ||
"""Dumb check if class is a violation class.""" | ||
return hasattr(class_object, 'code') |
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 can use isinstance
with BaseViolation, it would be more correct.
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.
There are some subclasses of BaseViolation that are not actual violation classes. So that hasattr check is needed anyway
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.