Skip to content

Conversation

@DimitriPapadopoulos
Copy link
Contributor

Summary of changes

Fix flake8-return issues reported by ruff 0.1.9.

Pull Request Checklist

@DimitriPapadopoulos DimitriPapadopoulos force-pushed the return branch 2 times, most recently from 7a63703 to 7b3e3f3 Compare January 5, 2024 20:27
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the return branch 3 times, most recently from 694b3ae to 323dff5 Compare January 5, 2024 20:51
@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
@DimitriPapadopoulos DimitriPapadopoulos deleted the return branch February 7, 2024 14:01
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.

2 participants