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

Question: Is there a reason that invalid-envvar-default only checks os.getenv, not os.environ.get #10092

Open
harupy opened this issue Nov 22, 2024 · 2 comments
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@harupy
Copy link
Contributor

harupy commented Nov 22, 2024

is there a reason that invalid-envvar-default only checks os.getenv, not os.environ.get?

ENV_GETTERS = ("os.getenv",)

@Pierre-Sassoulas
Copy link
Member

No particular reasons, imo it's not a very good check as mypy does it better but I'm open to merging a PR.

@Pierre-Sassoulas Pierre-Sassoulas added Help wanted 🙏 Outside help would be appreciated, good for new contributors Good first issue Friendly and approachable by new contributors False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Nov 22, 2024
@harupy
Copy link
Contributor Author

harupy commented Nov 23, 2024

@Pierre-Sassoulas Thanks for the comment. I can take this one.

MichaReiser added a commit to astral-sh/ruff that referenced this issue Mar 13, 2025
…LW1508`) (#16674)

## Summary
This PR stabilizes the new behavior introduced in
#14512 to also detect defalut
value arguemnts to `os.environ.get` that have an invalid type (not
`str`).
There's an upstream issue for this behavior change
pylint-dev/pylint#10092 that was accepted and
a PR, but it hasn't been merged yet.

This behavior change was first shipped with Ruff 0.8.1 (Nov 22). 

There has only be one PR since the new behavior was introduced but it
was unrelated to the scope increase
(#14841).
MichaReiser added a commit to astral-sh/ruff that referenced this issue Mar 13, 2025
…LW1508`) (#16674)

## Summary
This PR stabilizes the new behavior introduced in
#14512 to also detect defalut
value arguemnts to `os.environ.get` that have an invalid type (not
`str`).
There's an upstream issue for this behavior change
pylint-dev/pylint#10092 that was accepted and
a PR, but it hasn't been merged yet.

This behavior change was first shipped with Ruff 0.8.1 (Nov 22). 

There has only be one PR since the new behavior was introduced but it
was unrelated to the scope increase
(#14841).
MichaReiser added a commit to astral-sh/ruff that referenced this issue Mar 13, 2025
…LW1508`) (#16674)

## Summary
This PR stabilizes the new behavior introduced in
#14512 to also detect defalut
value arguemnts to `os.environ.get` that have an invalid type (not
`str`).
There's an upstream issue for this behavior change
pylint-dev/pylint#10092 that was accepted and
a PR, but it hasn't been merged yet.

This behavior change was first shipped with Ruff 0.8.1 (Nov 22). 

There has only be one PR since the new behavior was introduced but it
was unrelated to the scope increase
(#14841).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants