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

Spurious PLE1507 error: Invalid type for initial os.getenv argument #6537

Closed
DimitriPapadopoulos opened this issue Aug 13, 2023 · 1 comment · Fixed by #6538
Closed

Spurious PLE1507 error: Invalid type for initial os.getenv argument #6537

DimitriPapadopoulos opened this issue Aug 13, 2023 · 1 comment · Fixed by #6538
Assignees

Comments

@DimitriPapadopoulos
Copy link
Contributor

DimitriPapadopoulos commented Aug 13, 2023

  • A minimal code snippet that reproduces the bug:
    import os
    
    
    def f(using_clear_path):
       return os.getenv("PATH_TEST" if using_clear_path else "PATH_ORIG")
  • The command you invoked:
    ruff --select PLE file.py
    
  • The current Ruff settings: no pyproject.toml file
  • The current Ruff version (ruff --version):
     ruff 0.0.284
    
@DimitriPapadopoulos DimitriPapadopoulos changed the title Invalid type for initial os.getenv argument PLE1507: Invalid type for initial os.getenv argument Aug 13, 2023
@DimitriPapadopoulos DimitriPapadopoulos changed the title PLE1507: Invalid type for initial os.getenv argument Spurious PLE1507 error: Invalid type for initial os.getenv argument Aug 13, 2023
@charliermarsh charliermarsh self-assigned this Aug 13, 2023
@charliermarsh
Copy link
Member

Thanks, fixing...

charliermarsh added a commit that referenced this issue Aug 13, 2023
## Summary

Closes #6537. We need to improve
the `PythonType` algorithm, so this also documents some of its
limitations as TODOs.
charliermarsh pushed a commit that referenced this issue Jan 31, 2024
)

## Summary

Just like #6537 and #6538 but for the `default` second parameter to
`getenv()`.

Also rename "BAD" to "BAR" in the tests, since those strings shouldn't
trigger the rule.

## Test Plan

Added passing and failing examples to `invalid_envvar_default.py`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants