Skip to content

Detect permutations in redundant open modes#14255

Merged
charliermarsh merged 2 commits intomainfrom
charlie/redundant-open-mode
Nov 11, 2024
Merged

Detect permutations in redundant open modes#14255
charliermarsh merged 2 commits intomainfrom
charlie/redundant-open-mode

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

Closes #14235.

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

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
@github-actions
Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

@dscorbett
Copy link
Copy Markdown

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

@charliermarsh charliermarsh merged commit 5bf4759 into main Nov 11, 2024
@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