Allow NoReturn-like functions for __str__, __len__, etc.#11017
Merged
charliermarsh merged 2 commits intomainfrom Apr 18, 2024
Merged
Allow NoReturn-like functions for __str__, __len__, etc.#11017charliermarsh merged 2 commits intomainfrom
NoReturn-like functions for __str__, __len__, etc.#11017charliermarsh merged 2 commits intomainfrom
Conversation
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF100 | 1 | 1 | 0 | 0 | 0 |
| PLE0307 | 1 | 0 | 1 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+1 -8 violations, +0 -0 fixes in 6 projects; 38 projects unchanged)
PlasmaPy/PlasmaPy (+0 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- src/plasmapy/particles/particle_class.py:174:9: PLE0304 `__bool__` does not return `bool`
apache/airflow (+0 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- tests/models/test_mappedoperator.py:76:13: PLE0304 `__bool__` does not return `bool`
ibis-project/ibis (+0 -3 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- ibis/common/deferred.py:101:9: PLE0304 `__bool__` does not return `bool` - ibis/expr/types/core.py:166:9: PLE0304 `__bool__` does not return `bool` - ibis/expr/types/relations.py:831:9: PLE0303 `__len__` does not return a non-negative integer
pandas-dev/pandas (+0 -2 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- pandas/core/arrays/base.py:483:9: PLE0303 `__len__` does not return a non-negative integer - pandas/core/base.py:349:9: PLE0303 `__len__` does not return a non-negative integer
zulip/zulip (+0 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- zerver/lib/validator.py:684:9: PLE0307 `__str__` does not return `str`
indico/indico (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ indico/util/passwords.py:69:25: RUF100 [*] Unused `noqa` directive (unused: `PLE0307`)
Changes by rule (4 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLE0304 | 4 | 0 | 4 | 0 | 0 |
| PLE0303 | 3 | 0 | 3 | 0 | 0 |
| RUF100 | 1 | 1 | 0 | 0 | 0 |
| PLE0307 | 1 | 0 | 1 | 0 | 0 |
AlexWaygood
approved these changes
Apr 18, 2024
crates/ruff_linter/resources/test/fixtures/pylint/invalid_return_type_str.py
Outdated
Show resolved
Hide resolved
…rn_type_str.py Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
bea614d to
aa5051d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
If the method always raises, we shouldn't raise a diagnostic for "returning a value of the wrong type".
Closes #11016.