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

[pylint] Implement invalid-index-returned (PLE0305) #10962

Merged

Conversation

tibor-reiss
Copy link
Contributor

@tibor-reiss tibor-reiss commented Apr 15, 2024

Add pylint rule invalid-index-returned (PLE0305)

See #970 for rules

Test Plan: cargo test

TBD: from the description: "Note: Strictly speaking bool is a subclass of int, thus returning True/False is valid. However, a DeprecationWarning (DeprecationWarning: __index__ returned non-int (type bool)) for such cases was already introduced, thus this is a conscious difference between the original pylint rule and the current ruff implementation."

Copy link

codspeed-hq bot commented Apr 15, 2024

CodSpeed Performance Report

Merging #10962 will not alter performance

Comparing tibor-reiss:add-E0305-invalid-index-returned (ad9d443) with main (97acf1d)

Summary

✅ 30 untouched benchmarks

Copy link

github-actions bot commented Apr 15, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@tibor-reiss tibor-reiss force-pushed the add-E0305-invalid-index-returned branch from 1a265f0 to f025b0d Compare April 16, 2024 18:11
charliermarsh pushed a commit that referenced this pull request Apr 18, 2024
Add pylint rule invalid-length-returned (PLE0303)

See #970 for rules

Test Plan: `cargo test`

TBD: from the description: "Strictly speaking `bool` is a subclass of
`int`, thus returning `True`/`False` is valid. To be consistent with
other rules (e.g.
[PLE0305](#10962)
invalid-index-returned), ruff will raise, compared to pylint which will
not raise."
@tibor-reiss tibor-reiss force-pushed the add-E0305-invalid-index-returned branch from 8704a3f to 04fe643 Compare April 18, 2024 18:19
@tibor-reiss tibor-reiss force-pushed the add-E0305-invalid-index-returned branch from 04fe643 to 98865bf Compare April 18, 2024 18:24
charliermarsh pushed a commit that referenced this pull request Apr 19, 2024
Add pylint rule invalid-hash-returned (PLE0309)

See #970 for rules

Test Plan: `cargo test`

TBD: from the description: "Strictly speaking `bool` is a subclass of
`int`, thus returning `True`/`False` is valid. To be consistent with
other rules (e.g.
[PLE0305](#10962)
invalid-index-returned), ruff will raise, compared to pylint which will
not raise."
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Thanks!

@charliermarsh charliermarsh added rule Implementing or modifying a lint rule preview Related to preview mode features labels Apr 19, 2024
@charliermarsh charliermarsh changed the title [pylint] Implement invalid-index-returned (PLE0305) [pylint] Implement invalid-index-returned (PLE0305) Apr 19, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) April 19, 2024 03:38
@charliermarsh charliermarsh merged commit 27902b7 into astral-sh:main Apr 19, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants