-
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
Stabilise rules RUF024 and RUF026 #12026
Conversation
Generally looks reasonable (though we should review the ecosystem results when we can). |
0506cc5
to
f8807c2
Compare
could also be considered very-opinionated, but I'm not sure if this should prevent us from stabilizing rules (I don't think we should implement new once until we figured out rule categorization). |
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR1701 | 11 | 0 | 11 | 0 | 0 |
RUF024 | 1 | 1 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -11 violations, +0 -0 fixes in 2 projects; 48 projects unchanged)
apache/airflow (+0 -3 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- airflow/providers/microsoft/azure/hooks/msgraph.py:327:12: PLR1701 [*] Merge `isinstance` calls: `isinstance(data, (BytesIO, bytes, str))` - airflow/serialization/pydantic/dag.py:45:9: PLR1701 [*] Merge `isinstance` calls - airflow/serialization/pydantic/taskinstance.py:70:8: PLR1701 [*] Merge `isinstance` calls: `isinstance(x, (BaseOperator, MappedOperator))`
demisto/content (+0 -8 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- Packs/ANYRUN/Integrations/ANYRUN/ANYRUN.py:196:16: PLR1701 Merge `isinstance` calls: `isinstance(val, dict | list)` - Packs/AWS-GuardDuty/Integrations/AWSGuardDutyEventCollector/AWSGuardDutyEventCollector.py:33:12: PLR1701 Merge `isinstance` calls: `isinstance(obj, date | datetime)` - Packs/Base/Scripts/DBotMLFetchData/DBotMLFetchData.py:187:23: PLR1701 Merge `isinstance` calls: `isinstance(x, bool | str)` - Packs/Base/Scripts/DBotMLFetchData/DBotMLFetchData.py:192:37: PLR1701 Merge `isinstance` calls: `isinstance(v, bool | str)` - Packs/Base/Scripts/DBotTrainClustering/DBotTrainClustering.py:422:8: PLR1701 Merge `isinstance` calls: `isinstance(obj, list | str)` - Packs/BluecatAddressManager/Integrations/BluecatAddressManager/BluecatAddressManager.py:256:12: PLR1701 Merge `isinstance` calls - Packs/ExpanseV2/Scripts/ExpanseEvidenceDynamicSection/ExpanseEvidenceDynamicSection.py:15:8: PLR1701 Merge `isinstance` calls: `isinstance(v, float | int | str)` - Packs/TOPdesk/Integrations/TOPdesk/TOPdesk.py:577:16: PLR1701 Merge `isinstance` calls: `isinstance(value, bool | str)`
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR1701 | 11 | 0 | 11 | 0 | 0 |
For now, I've struck the following rules (all authored by me 😭) off the list:
These rules are all working as designed, but they're all quite opinionated. Right now, it seems like promoting them to stable would be too disruptive for users who select the entire |
And I've now struck off RUF025 for similar reasons. Somewhat opinionated; has a fair few ecosystem hits; we can maybe consider it separately, but not for this PR... |
Summary
Stabilise the following rules in the
RUF
category for Ruff v0.5:mutable-fromkeys-value
unnecessary-dict-comprehension
default-factory-kwarg
parenthesize-chained-operators
unsorted-dunder-all
unsorted-dunder-slots
These rules have been in the preview category for several minor releases, and were released to users >90 days ago. There are no open issues about any of them, and there have not been any open issues about any of them for several months. I skimmed over the implementations for all of them, and they all look reasonable to me (except for one test fixture for
RUF026
that wasn't testing what it was meant to be testing -- I fix that here as part of this PR).Test Plan
cargo test