Skip to content

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

Merged
charliermarsh merged 7 commits into
astral-sh:mainfrom
tibor-reiss:add-E0305-invalid-index-returned
Apr 19, 2024
Merged

charliermarsh merged 7 commits into
astral-sh:mainfrom
tibor-reiss:add-E0305-invalid-index-returned

Conversation

@tibor-reiss

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

Copy link
Copy Markdown
Contributor

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."

@codspeed

codspeed Bot commented Apr 15, 2024 •

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Apr 15, 2024 •

Copy link
Copy Markdown
Contributor

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."

@charliermarsh charliermarsh left a comment

Copy link
Copy Markdown
Member

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
KotlinIsland pushed a commit to KotlinIsland/basedpython that referenced this pull request May 1, 2026
Add pylint rule invalid-length-returned (PLE0303)

See astral-sh/ruff#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](astral-sh/ruff#10962)
invalid-index-returned), ruff will raise, compared to pylint which will
not raise."
KotlinIsland pushed a commit to KotlinIsland/basedpython that referenced this pull request May 1, 2026
Add pylint rule invalid-hash-returned (PLE0309)

See astral-sh/ruff#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](astral-sh/ruff#10962)
invalid-index-returned), ruff will raise, compared to pylint which will
not raise."
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.

2 participants