-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Extend invalid-envvar-default (PLW1508)
to detect os.environ.get
#14512
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLW1508 | 40 | 40 | 0 | 0 | 0 |
Should I update the doc to mention both |
Is this a change to align the rule with the upstream rule? I think we should gate this behind preview, considering that it extends the scope of the rule (even though it is in the rule's intent) |
No, pylint only checks
Sounds good. How can I gate it behind preview? |
I think I've figured it out. |
@MichaReiser updated the code. |
@@ -1,6 +1,5 @@ | |||
--- | |||
source: crates/ruff_linter/src/rules/pylint/mod.rs | |||
snapshot_kind: text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try updating your local cargo insta
version running cargo install cargo-insta --force
?
invalid-envvar-default (PLW1508)
to flag os.environ.get
os.environ.get
in invalid-envvar-default (PLW1508)
os.environ.get
in invalid-envvar-default (PLW1508)
invalid-envvar-default (PLW1508)
to detect os.environ.get
...s/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap
Outdated
Show resolved
Hide resolved
…es__pylint__tests__PLW1508_invalid_envvar_default.py.snap
...snapshots/ruff_linter__rules__pylint__tests__preview__PLW1508_invalid_envvar_default.py.snap
Show resolved
Hide resolved
…es__pylint__tests__preview__PLW1508_invalid_envvar_default.py.snap
The extension seem useful in my view and it makes sense that I wonder if there's a reason for pylint not supporting I think it would be great to open an upstream issue first before we deviate unnecessarily. |
Sounds good. Let me file a ticket. |
Filed pylint-dev/pylint#10092. |
Thank you @harupy Let's give them a few days. I'm all in for merging if we don't hear back from them in a few days. In case I forget to check in, feel free to ping me! |
Pylint upstream is okay with supporting this, although they generally recommend using a type checker, which makes sense. |
Summary
Fix
invalid-envvar-default (PLW1508)
to flagos.environ.get
.Test Plan
New test case