We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
else
try
We have this function:
def is_literal(node) -> bool: try: ast.literal_eval(node) except ValueError: return False else: return True
It should raise:
5:9 WPS503 Found useless returning `else` statement return True
Because it should be consistent with if rule. So, the desired version is:
if
def is_literal(node) -> bool: try: ast.literal_eval(node) except ValueError: return False return True
The text was updated successfully, but these errors were encountered:
What about for? It has different else semantics.
for
Sorry, something went wrong.
Ok, here's the deal with for:
def wrapper(): for x in ...: if ...: break else: return 1 return 2
This is not the same as if, but still can be checked. How?
break
1
2
Here's the refactored version:
def wrapper(): for x in ...: if ...: return 2 return 1
The same about while
while
Closes #1866
4e55776
1f94c39
No branches or pull requests
We have this function:
It should raise:
Because it should be consistent with
if
rule. So, the desired version is:The text was updated successfully, but these errors were encountered: