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

Detect permutations in redundant open modes #14255

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Closes #14235.

@charliermarsh charliermarsh added the bug Something isn't working label Nov 11, 2024
@dscorbett
Copy link

I think this implementation can change runtime behavior. If the mode string is invalid, like t or UU or r?, this new fix can make it valid, whereas it previously would raise a ValueError.

@charliermarsh charliermarsh force-pushed the charlie/redundant-open-mode branch from 73bbe9e to cfbfa86 Compare November 11, 2024 00:59
Copy link
Contributor

github-actions bot commented Nov 11, 2024

ruff-ecosystem results

Linter (stable)

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

apache/airflow (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ dev/breeze/src/airflow_breeze/utils/console.py:86:16: UP015 [*] Unnecessary open mode parameters, use "a+"

pandas-dev/pandas (+0 -0 violations, +0 -0 fixes)


Changes by rule (1 rules affected)

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

Linter (preview)

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

apache/airflow (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ dev/breeze/src/airflow_breeze/utils/console.py:86:16: UP015 [*] Unnecessary open mode parameters, use "a+"

Changes by rule (1 rules affected)

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

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@charliermarsh
Copy link
Member Author

Should we just ignore invalid codes entirely? There's a separate rule for them.

@dscorbett
Copy link

Yes, I think UP015 should detect invalid modes as invalid and ignore them.

@charliermarsh charliermarsh merged commit 5bf4759 into main Nov 11, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/redundant-open-mode branch November 11, 2024 03:48
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.

UP015 false negatives for many redundant open modes
2 participants