-
-
Notifications
You must be signed in to change notification settings - Fork 378
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
1731 Forbid returning too long tuples #1939
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1939 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 120 118 -2
Lines 6394 6210 -184
Branches 1424 1382 -42
==========================================
- Hits 6394 6210 -184
Continue to review full report at Codecov.
|
@@ -369,6 +369,9 @@ | |||
#: Maximum length of ``yield`` ``tuple`` expressions. | |||
MAX_LEN_YIELD_TUPLE: Final = 5 | |||
|
|||
#: Maximum length of ``return`` ``tuple`` expressions. | |||
MAX_LEN_RETURN_TUPLE: Final = 5 |
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 think that we should unify this setting into a single one. How about MAX_LEN_TUPLE_OUTPUT
?
|
||
|
||
@final | ||
class TooLongReturnTupleViolation(ASTViolation): |
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.
Let's rename the existing Yield
violation. I think that there's no need to create a new one.
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.
Okay.
Are there any docs in which cases changing violations or some parts of public API is ok?
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.
All done. I am not sure about naming through.
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.
Are there any docs in which cases changing violations or some parts of public API is ok?
We don't consider our code to be a part of our API, because no one in their sane minds would use it. This is a CLI tool, so only UX changes are 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.
I just am confused by the comment lines in constants.py
. There is a separation between constants public for "end-user" and internal which are not documented. So I do not get, what these lines are talking about if it is not about API.
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!
from wemake_python_styleguide.violations.complexity import ( | ||
TooLongYieldTupleViolation, | ||
TooLongFunctionOutputTupleViolation, |
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.
Let's name it TooLongOutputTupleViolation
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.
Done. Also renamed test file accordingly.
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.
Awesome! Thanks!
I am going to release 0.15.3
and then merge this PR into 0.16
I have made things!
This PR extends
TooLongYieldTupleViolation
realization this way:MAX_LEN_RETURN_TUPLE
). I am not sure how do they work, but doc says they are a public API. So I decided I should not rename constant to cover both cases, to not to break API.Checklist
CHANGELOG.md
Related issues