Skip to content
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

Fix flake8-return warnings #4169

Merged
merged 4 commits into from
Feb 7, 2024
Merged

Conversation

DimitriPapadopoulos
Copy link
Contributor

Summary of changes

Fix flake8-return issues reported by ruff 0.1.9.

Pull Request Checklist

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review January 5, 2024 20:59
@abravalheri
Copy link
Contributor

Thank you very much @DimitriPapadopoulos .

Should flake8-return be added to the ruff configuration as well after these fixes?

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented Jan 6, 2024

Yes, it could be added. Some rules should be disabled though. I have not fixed such issues:

if ...:
    return ...
else:
    return ...

Thanks to the symmetry, I find the above more readable than:

if ...:
    return ...
return ...

It's your call...

RET502 Do not implicitly `return None` in function able to return non-`None` value
RET502 Do not implicitly `return None` in function able to return non-`None` value
RET503 Missing explicit `return` at the end of function able
       to return non-`None` value
RET504 Unnecessary assignment to `...` before `return` statement
@abravalheri
Copy link
Contributor

Thank you very much @DimitriPapadopoulos, let's merge this for now...
Later we can add the flake8-return.

Some rules should be disabled though.

I am not sure about this. I am more keen to keep the linter configuration as dry as possible, ideally just working out of the box.

@abravalheri abravalheri merged commit 259af91 into pypa:main Feb 7, 2024
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants