-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Ruff 0.13 #20194
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
Ruff 0.13 #20194
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| AIR311 | 2318 | 2318 | 0 | 0 | 0 |
| RUF059 | 980 | 980 | 0 | 0 | 0 |
| RUF043 | 548 | 548 | 0 | 0 | 0 |
| SIM117 | 430 | 0 | 0 | 430 | 0 |
| AIR002 | 204 | 204 | 0 | 0 | 0 |
| I001 | 36 | 22 | 14 | 0 | 0 |
| PYI061 | 21 | 21 | 0 | 0 | 0 |
| AIR301 | 17 | 17 | 0 | 0 | 0 |
| PTH211 | 12 | 12 | 0 | 0 | 0 |
| PYI059 | 10 | 10 | 0 | 0 | 0 |
| ANN201 | 4 | 2 | 2 | 0 | 0 |
| RUF100 | 4 | 0 | 4 | 0 | 0 |
| AIR302 | 2 | 2 | 0 | 0 | 0 |
| AIR312 | 2 | 2 | 0 | 0 | 0 |
| D212 | 2 | 1 | 1 | 0 | 0 |
| B017 | 2 | 2 | 0 | 0 | 0 |
| UP038 | 1 | 0 | 1 | 0 | 0 |
Linter (preview)
✅ ecosystem check detected no linter changes.
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
Lee-W
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took a look at the airflow part again. Looks goo!
The tests looked good. For the docs, I added a `## See also` section pointing to the closely-related F841 (unused-variable) and the corresponding section to F841 pointing back to RUF059. It seems like you'd probably want both of these active or at least to know about the other when reading the docs.
Summary -- Rule and test/snapshot updated, the docs look good My one hesitation here is that we could hold off stabilizing the rule until its fix is also ready for stabilization, but this is also the only preview PTH rule, so I think it's okay to stabilize the rule and later (probably in the next minor release) stabilize the fixes together.
## Summary closes #7710 ## Test Plan It is is removal so i don't think we have to add tests otherwise i have followed test plan mentioned in contributing.md --------- Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
## Summary This PR Removes deprecated UP038 as per instructed in #18727 closes #18727 ## Test Plan I have run tests non of them failing One Question i have is do we have to document that UP038 is removed? --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
This one has been a bit contentious in the past. It usually uncovers ~700 ecosystem hits. See: - #16657 - #16690 But I think there's consensus that it's okay to merge as-is. We'd love an autofix since it's so common, but we can't reliably tell what a user meant. The pattern is ambiguous after all 😆 This is the first rule that actually needed its test case relocated, but the docs looked good.
This stabilizes the behavior introduced in #16565 which (roughly) tries to match an import like `import a.b.c` to an actual directory path `a/b/c` in order to label it as first-party, rather than simply looking for a directory `a`. Mainly this affects the sorting of imports in the presence of namespace packages, but a few other rules are affected as well.
- **Stabilize `airflow3-suggested-update` (`AIR311`)** - **Stabilize `airflow3-suggested-to-move-to-provider` (`AIR312`)** - **Stabilize `airflow3-removal` (`AIR301`)** - **Stabilize `airflow3-moved-to-provider` (`AIR302`)** - **Stabilize `airflow-dag-no-schedule-argument` (`AIR002`)** I put this all in one PR to make it easier to double check with @Lee-W before we merge this. I also made a few minor documentation changes and updated one error message that I want to make sure are okay. But for the most part this just moves the rules from `RuleGroup::Preview` to `RuleGroup::Stable`! Fixes #17749
Introduced in #19100. Removed gating, updated tests, removed warning(s), and updated documentation.
<!-- Thank you for contributing to Ruff/ty! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? --> ## Summary Closes #18349 After this change: - All deprecated rules are deselected by default - They are only selected if the user specifically selects them by code, e.g. `--select UP038` - Thus, `--select ALL --select UP --select UP0` won't select the deprecated rule UP038 - Documented the change in version policy. From now on, deprecating a rule should increase the minor version ## Test Plan Integration tests in "integration_tests.rs" Also tested with a temporary test package: ``` ~> ../../ruff/target/debug/ruff.exe check --select UP038 warning: Rule `UP038` is deprecated and will be removed in a future release. warning: Detected debug build without --no-cache. UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` --> main.py:2:11 | 1 | def main(): 2 | print(isinstance(25, (str, int))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: Convert to `X | Y` Found 1 error. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). ~> ../../ruff/target/debug/ruff.exe check --select UP03 warning: Detected debug build without --no-cache. All checks passed! ~> ../../ruff/target/debug/ruff.exe check --select UP0 warning: Detected debug build without --no-cache. All checks passed! ~> ../../ruff/target/debug/ruff.exe check --select UP warning: Detected debug build without --no-cache. All checks passed! ~> ../../ruff/target/debug/ruff.exe check --select ALL # warnings and errors, but because of other errors, UP038 was deselected ```
Summary
Release branch for Ruff 0.13.0
Breaking changes
Behavior changes
flake8-simplify] Stabilize fix safety ofmultiple-with-statements(SIM117) #20270pylint] Stabilize adding U+061C tobidirectional-unicode(PLE2502) #20276pylint] Stabilize ignoring__init__.pyforuseless-import-alias(PLC0414) #20271pygrep-hooks] Stabilize usingAsyncMockmethods ininvalid-mock-access(PGH005) #20272flake8-commas] Stabilize support for trailing comma checks in type parameter lists (COM812,COM819) #20275flake8-bugbear] Stabilize support for non-context-manager calls inassert-raises-exception(B017) #20274flake8-errmsg] Stabilize extendingraw-string-in-exception(EM101) to support byte strings #20273Recoded rules
Deprecated rules
Changed rules
Removed rules
pandas-vet] Removepandas-df-variable-name(PD901) #19223pyupgrade] Removenon-pep604-isinstance(UP038) #19156Stabilized rules
long-sleep-not-forever(ASYNC116) #20244unused-unpacked-variable(RUF059) #20233os-symlink(PTH211) #20229useless-class-metaclass-type(UP050) #20230generic-not-last-base-class(PYI059) #20246redundant-none-literal(PYI061) #20236f-string-number-format(FURB116) #20247pytest-raises-ambiguous-pattern(RUF043) #20253airflow3-suggested-update(AIR311)airflow3-suggested-to-move-to-provider(AIR312)airflow3-removal(AIR301)airflow3-moved-to-provider(AIR302)airflow-dag-no-schedule-argument(AIR002)New or improved fixes
Deferred stabilizations
TODOs
emptyfirst commit (random whitespace change to get a baseline ecosystem check executable)Tests
Ruff invocations on examples to verify that behavior has been stabilized correctly.