Skip to content

[flake8-pyi] Stabilize: include all python file types for PYI006#15340

Merged
MichaReiser merged 2 commits intoruff-0.9from
micha/sys-version-comparison
Jan 8, 2025
Merged

[flake8-pyi] Stabilize: include all python file types for PYI006#15340
MichaReiser merged 2 commits intoruff-0.9from
micha/sys-version-comparison

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Jan 8, 2025

Summary

Stabilizes the behavior changes introduced in #14059

PYI006 and PYI066 now also apply to non stub files.

Test plan

There are no open or recently closed issues around PYI006 or PYI066

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Jan 8, 2025
);
}
} else {
fn bad_version_info_comparison(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff here looks misleading. All I did is to remove the outermost if

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2025

ruff-ecosystem results

Linter (stable)

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

pytest-dev/pytest (+1 -0 violations, +0 -0 fixes)

+ testing/_py/test_local.py:21:12: PYI006 Use `<` or `>=` for `sys.version_info` comparisons

Changes by rule (1 rules affected)

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

Linter (preview)

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

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

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

- airflow/decorators/condition.py:32:35: TC008 [*] Remove quotes from type alias
- airflow/decorators/condition.py:33:35: TC008 [*] Remove quotes from type alias

latchbio/latch (+0 -2 violations, +0 -0 fixes)

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

- src/latch/ldata/_transfer/upload.py:30:32: TC008 [*] Remove quotes from type alias
- src/latch/ldata/_transfer/upload.py:31:35: TC008 [*] Remove quotes from type alias

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
TC008 4 0 4 0 0

@MichaReiser
Copy link
Member Author

MichaReiser commented Jan 8, 2025

I'd like to have a second opinion on a few ecosystem results. There are instances where the sys.version check is part of an and or or condition. Should the rule still apply in those cases?

Rewriting some of those just feels slightly more awkward

@MichaReiser MichaReiser added this to the v0.9 milestone Jan 8, 2025
@AlexWaygood
Copy link
Member

I'd like to have a second opinion on a few ecosystem results. There are instances where the sys.version check is part of an and or or condition. Should the rule still apply in those cases?

That's a great catch. No, I don't think it should apply in those cases. Let's hold off on stabilising the PYI066 change, in that case.

@MichaReiser
Copy link
Member Author

I created an issue to follow up on PYI066 (#15347) and are about to roll back the PYI066 changes

@MichaReiser MichaReiser changed the title [flake8-pyi] Stabilize: include all python file types for PYI006 and PYI066 [flake8-pyi] Stabilize: include all python file types for PYI006 Jan 8, 2025
@MichaReiser MichaReiser force-pushed the micha/sys-version-comparison branch from 83edadf to d043583 Compare January 8, 2025 12:33
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@MichaReiser MichaReiser merged commit d3bfa4c into ruff-0.9 Jan 8, 2025
@MichaReiser MichaReiser deleted the micha/sys-version-comparison branch January 8, 2025 13:08
@MichaReiser MichaReiser mentioned this pull request Jan 8, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants