Commit aa7c25c
committed
Customize where the
Summary
--
This is a more general alternative to #23043 that more closely follows Micha's
[suggestion]. I sort of prefer this approach because it gives the diagnostic
author full control of the order of sub-diagnostics. On the other hand, it feels
a bit too "clever" for the current usage, which achieves the same effect as the
simpler #23043. So I'm curious to get others' thoughts.
I still think the ideal solution long-term would be to combine the diff
rendering with the sub-diagnostic holding the fix title, but that would be much
more involved than either of these PRs.
As I noted in the summary for #23043, the main motivation for the defer
machinery is that [RUF064] has a bunch of early returns mixed in with its `info`
additions, so it was a big pain to add a `help` diagnostic before each return.
We may at least want a `deferred_help` helper instead of the two closures used
here, if we do take this approach.
[suggestion]: https://github.com/astral-sh/ruff/pull/19900/changes/BASE..ab685c16a8c01bb33f054698d2f32bb023d07429#r2276500131
[RUF064]: https://github.com/astral-sh/ruff/blob/4a32a96740bb7327a3f554b7f6d6675cb2ea797e/crates/ruff_linter/src/rules/ruff/rules/non_octal_permissions.rs#L120-L145
Test Plan
--
Updated snapshots for `RUF064` and `ISC004`.fix_title sub-diagnostic appears1 parent f1f21f7 commit aa7c25c
5 files changed
Lines changed: 121 additions & 31 deletions
File tree
- crates/ruff_linter/src
- checkers/ast
- rules
- flake8_implicit_str_concat
- rules
- snapshots
- ruff
- rules
- snapshots
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
421 | 422 | | |
422 | 423 | | |
423 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
424 | 439 | | |
425 | 440 | | |
426 | 441 | | |
| |||
3367 | 3382 | | |
3368 | 3383 | | |
3369 | 3384 | | |
| 3385 | + | |
3370 | 3386 | | |
3371 | 3387 | | |
3372 | 3388 | | |
| |||
3386 | 3402 | | |
3387 | 3403 | | |
3388 | 3404 | | |
| 3405 | + | |
3389 | 3406 | | |
3390 | 3407 | | |
3391 | 3408 | | |
3392 | 3409 | | |
3393 | 3410 | | |
3394 | 3411 | | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
3395 | 3445 | | |
3396 | 3446 | | |
3397 | 3447 | | |
| |||
3433 | 3483 | | |
3434 | 3484 | | |
3435 | 3485 | | |
| 3486 | + | |
| 3487 | + | |
3436 | 3488 | | |
3437 | 3489 | | |
3438 | 3490 | | |
| |||
3447 | 3499 | | |
3448 | 3500 | | |
3449 | 3501 | | |
| 3502 | + | |
| 3503 | + | |
3450 | 3504 | | |
3451 | 3505 | | |
3452 | 3506 | | |
| |||
3508 | 3562 | | |
3509 | 3563 | | |
3510 | 3564 | | |
| 3565 | + | |
| 3566 | + | |
| 3567 | + | |
| 3568 | + | |
| 3569 | + | |
| 3570 | + | |
| 3571 | + | |
| 3572 | + | |
| 3573 | + | |
| 3574 | + | |
| 3575 | + | |
| 3576 | + | |
| 3577 | + | |
| 3578 | + | |
| 3579 | + | |
| 3580 | + | |
| 3581 | + | |
| 3582 | + | |
| 3583 | + | |
| 3584 | + | |
| 3585 | + | |
| 3586 | + | |
3511 | 3587 | | |
3512 | 3588 | | |
3513 | 3589 | | |
| |||
3592 | 3668 | | |
3593 | 3669 | | |
3594 | 3670 | | |
3595 | | - | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
3596 | 3675 | | |
3597 | 3676 | | |
3598 | 3677 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | 62 | | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | 86 | | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | 111 | | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | 136 | | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| |||
0 commit comments