Skip to content

[flake8-pyi] Allow simple assignments to None in enum class scopes (PYI026)#11128

Merged
AlexWaygood merged 3 commits into
mainfrom
pyi-enums
Apr 24, 2024
Merged

[flake8-pyi] Allow simple assignments to None in enum class scopes (PYI026)#11128
AlexWaygood merged 3 commits into
mainfrom
pyi-enums

Conversation

@AlexWaygood

Copy link
Copy Markdown
Member

Fixes #11117

@AlexWaygood

Copy link
Copy Markdown
Member Author

I also deduplicated the two is_enum functions between flake8-slots and flake8-pyi, since the flake8-pyi one was way more complex than it needed to be, and was also missing an enum class that the flake8-slots function included.

@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 the bug Something isn't working label Apr 24, 2024
@github-actions

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -1 violations, +0 -0 fixes in 1 projects; 43 projects unchanged)

python/typeshed (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select E,F,FA,I,PYI,RUF,UP,W

- stdlib/uuid.pyi:12:5: PYI042 Type alias `unknown` should be CamelCase

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PYI042 1 0 1 0 0

@AlexWaygood

AlexWaygood commented Apr 24, 2024

Copy link
Copy Markdown
Member Author
- [stdlib/uuid.pyi:12:5:](https://github.com/python/typeshed/blob/d0f2be92aba2e007841eec073cb47d7f86722792/stdlib/uuid.pyi#L12) PYI042 Type alias `unknown` should be CamelCase

hmmm, seems like a good change but not the one I expected lol

@AlexWaygood

Copy link
Copy Markdown
Member Author

hmmm, seems like a good change but not the one I expected lol

Well, I confirmed locally that this fixes the false positive I was trying to fix, so I'll just add another test for the other fixed bug that the ecosystem check highlighted

@AlexWaygood

Copy link
Copy Markdown
Member Author

And, I can't repro the change the ecosystem is reporting locally either. Weird. Anyway, I'm pretty confident in this change, so I'll merge...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PYI026/type-alias-without-annotation false positives with None in Enum

2 participants