-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[pylint
] Implement invalid-bytes-returned
(E0308
)
#10959
[pylint
] Implement invalid-bytes-returned
(E0308
)
#10959
Conversation
0317d41
to
f7cb7d4
Compare
CodSpeed Performance ReportMerging #10959 will not alter performanceComparing Summary
|
|
visitor.returns | ||
}; | ||
|
||
for stmt in returns { |
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.
Should this rule and the other invalid-*-returned rules also flag the case where the method has no return statement
class Test:
def __bytes__(self):
print("nope")
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 added this case as well. If this becomes the consensus, I can also add it to the already included bool (E0304) and str (E0307) cases.
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.
@MichaReiser As it turned out, the no-return case is not that simple: if there is just a pass/ellipsis/raise statement, then this rule should not raise. However, if there is e.g. a print statement and a raise statement, then it should raise - see the tests for examples.
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 changed this to use is_stub
for detecting the other cases.
a84894a
to
197b5fc
Compare
pylint
] Implement invalid-bytes-returned
(E0308
)
6eb9545
to
ced76b9
Compare
Add pylint rule invalid-bytes-returned (PLE0308)
See #970 for rules
Test Plan:
cargo test