You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is worth it, it just causes a lot of churn indenting/dedenting things for no real reason. The elif technically is redundant if the previous if always returns, but it makes it more clear that they're mutually exclusive, and might cause bugs in future if someone removes one of the returns. This also causes symmetric if-else checks to become non-symmetric now, which might be confusing to the reader.
I agree with @TeamSpen210 that this doesn't really help anything. It doesn't make things clearer (unlike flake8-commas) and removes semantics. Looking through the error codes listed on https://pypi.org/project/flake8-return/ (I'm sure ruff implements them smarter, ofc):
R501 conflicts with mypy nvm, I was confusing this with implicit None return w/ a return type like None | int. I guess this is useful for standardization reasons, but I don't really like it.
R502/R503 is just type checking
R504 is potentially useful, but in general assigning to a variable is useful because it allows us to show a nicer name in tracebacks. (maybe we could just enable this? I'm not too sure)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this pull request, we enable ruff's
flake8-returnrule and fix all the new issues from doing this.