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

Regression of false positive with e251 and type statement type variable defaults #15202

Closed
mikeshardmind opened this issue Dec 30, 2024 · 4 comments · Fixed by #15214
Closed
Labels
bug Something isn't working help wanted Contributions especially welcome python313 Related to Python 3.13

Comments

@mikeshardmind
Copy link

ruff version 0.8.4
python version 3.13

prior issue: #13699 prior PR: #13704

src\salamander\_type_stuff.py:37:20: E251 [*] Unexpected spaces around keyword / parameter equals
   |
37 | type Coro[T: object = Any] = Coroutine[None, None, T]
   |                    ^ E251
   |
   = help: Remove whitespace

src\salamander\_type_stuff.py:37:22: E251 [*] Unexpected spaces around keyword / parameter equals
   |
37 | type Coro[T: object = Any] = Coroutine[None, None, T]
   |                      ^ E251
   |
   = help: Remove whitespace

These are false positives.

Applying the fix leads to (correctly) identifying:

src\salamander\_type_stuff.py:37:20: E225 [*] Missing whitespace around operator
   |
37 | type Coro[T: object=Any] = Coroutine[None, None, T]
   |                    ^ E225
   |
   = help: Add missing whitespace

config is here if useful

@dhruvmanila dhruvmanila added bug Something isn't working python313 Related to Python 3.13 labels Dec 30, 2024
@MichaReiser MichaReiser added help wanted Contributions especially welcome and removed python313 Related to Python 3.13 labels Dec 30, 2024
@AlexWaygood AlexWaygood added the python313 Related to Python 3.13 label Dec 30, 2024
@InSyncWithFoo
Copy link
Contributor

I think the E225 error is also a false positive. The equal sign in this case is not an operator, same as the one for value parameter defaults (playground):

def _[T: int=bool](): ...
#           ^ E252 (correct), E225 (incorrect)
def _(t: int=True): ...
#           ^ E252 (correct)

@Garrett-R
Copy link

Garrett-R commented Jan 1, 2025

Here's a minimal working example of the original bug: playground.

I'll try to submit a PR for this one.

@InSyncWithFoo
Copy link
Contributor

InSyncWithFoo commented Jan 1, 2025

@Garrett-R I was already working on a fix, and I just submitted it since I didn't know you was working on one too (I read your comment via the mails, and GitHub doesn't notify users about edits...). I'm sorry; hope you don't mind.

@Garrett-R
Copy link

No prob! Actually hadn't started, still getting acquainted with Rust / Ruff and getting IDE nicely set up. 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Contributions especially welcome python313 Related to Python 3.13
Projects
None yet
6 participants