-
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
Fix invalid-envvar-default (PLW1508)
to flag os.environ.get
#14512
base: main
Are you sure you want to change the base?
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. |
if checker.settings.preview.is_enabled() { | ||
matches!( | ||
qualified_name.segments(), | ||
["os", "getenv"] | ["os", "environ", "get"] | ||
) | ||
} else { | ||
matches!(qualified_name.segments(), ["os", "getenv"]) | ||
} |
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.
Is there a simpler way to write this?
Summary
Fix
invalid-envvar-default (PLW1508)
to flagos.environ.get
.Test Plan
New test case