Skip to content

[pylint] Implement invalid-bool-return-type (E304)#10377

Merged
dhruvmanila merged 4 commits intoastral-sh:mainfrom
hikaru-kajita:invalid-bool-return
Mar 13, 2024
Merged

[pylint] Implement invalid-bool-return-type (E304)#10377
dhruvmanila merged 4 commits intoastral-sh:mainfrom
hikaru-kajita:invalid-bool-return

Conversation

@hikaru-kajita
Copy link
Contributor

@hikaru-kajita hikaru-kajita commented Mar 13, 2024

Summary

Implement E304 in the issue #970.
Link is here: https://pylint.readthedocs.io/en/stable/user_guide/messages/error/invalid-bool-returned.html
Throws an error when the returning value of __bool__ method is not boolean

Test Plan

I've written it in the invalid_return_type_bool.py.

Hi! Actually, this is my first pull request in my life, so please tell me if there is something wrong with the code.
(I used the code written in #4854, and slightly modified it.)
Thanks :)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! And welcome to the project :)

@dhruvmanila dhruvmanila added the rule Implementing or modifying a lint rule label Mar 13, 2024
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! If you're interested, I'd love to have a PR which updates the documentation and tests in a similar manner for the invalid-str-return-type rule.

@dhruvmanila dhruvmanila changed the title implement E304 invalid-bool-returned in pylint [pylint] Implement invalid-bool-return-type (E304) Mar 13, 2024
@dhruvmanila dhruvmanila merged commit c269c1a into astral-sh:main Mar 13, 2024
@hikaru-kajita
Copy link
Contributor Author

Thank you! If you're interested, I'd love to have a PR which updates the documentation and tests in a similar manner for the invalid-str-return-type rule.

I will work on it! Thank you :)

@hikaru-kajita hikaru-kajita deleted the invalid-bool-return branch March 14, 2024 00:55
dhruvmanila added a commit that referenced this pull request Mar 14, 2024
…#10400)

## Summary

Added some docs, and a little of test cases in
`invalid-str-return-type`, mentioned in
#10377 (review)

## Test Plan

On `invalid_return_type_str.py`.

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants