[flake8-commas] Add support for trailing comma checks in type parameter lists (COM812, COM819)#19390
Conversation
|
|
We probably have to gate this behind preview. Did you have a chance to look through the ecosystem results. Do the changes look correct to you? |
|
Yes, the ecosystem changes look to be correct, from what I can tell. I also gave a shot at implementing the preview, but I'm not sure if I did it correctly. I would appreciate a review! |
ntBre
left a comment
There was a problem hiding this comment.
Thanks! I haven't gone through all of the snapshots yet, but I had a couple of comments on the code in an initial pass.
This is kind of a note to myself for later, but we'll want to double check that the ecosystem check doesn't change on stable for a preview change. It looks like it didn't rerun after you added the preview gate, but hopefully it will run again after any additional commits.
crates/ruff_linter/src/rules/flake8_commas/rules/trailing_commas.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_commas/rules/trailing_commas.rs
Outdated
Show resolved
Hide resolved
|
It looks like the ecosystem check didn't rerun. Maybe we can manually rerun it? |
|
The ecosystem results were updated 10h ago. That would suggest that they did run? |
|
Maybe there was a queue of ecosystem checks yesterday afternoon. It hadn't updated when I checked after the last commit here yesterday either. I see it now though! My suggestion might have been slightly misleading about your old preview check. We'll need both the new Then hopefully all the ecosystem changes will show up in the |
crates/ruff_linter/src/rules/flake8_commas/rules/trailing_commas.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_commas/rules/trailing_commas.rs
Outdated
Show resolved
Hide resolved
…as.rs Co-authored-by: Brent Westbrook <[email protected]>
…as.rs Co-authored-by: Brent Westbrook <[email protected]>
|
Appreciate the suggestions, I think I was confusing myself with this part 😆 |
There was a problem hiding this comment.
Thanks. I think you may have missed a couple of the key parts of my patch suggestion. There were still a lot of unexpected differences between the preview and non-preview snapshots, which I saw locally by diffing them. Hopefully we'll get #19351 at some point and this will be easier to see directly in PRs.
I made a couple of tweaks and then confirmed that
diff crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__preview__COM81_syntax_error.py.snap
was totally empty and that
diff crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__preview__COM81.py.snap
only showed modifications at the end of the file, where the new cases were added.
I think that will also cut down on the ecosystem changes. I'll double check that and then merge this.
flake8_commas] Add support for trailing comma checks in type parameter lists for COM812 and COM819flake8-commas] Add support for trailing comma checks in type parameter lists (COM812,COM819)
|
That actually entirely cleared the ecosystem changes 😅 I hadn't noticed before that they were all related to the slice change, not actual type parameters, but that's the case for all the ones I clicked through just now. |
flake8-commas] Add support for trailing comma checks in type parameter lists (COM812,COM819)flake8-commas] Add support for trailing comma checks in type parameter lists (COM812, COM819)
Summary -- I noticed while reviewing #19390 that in `check_tokens` we were still passing around an extra `LinterSettings`, despite all of the same functions also receiving a `LintContext` with its own settings. This PR adds the `LintContext::settings` method and calls that instead of using the separate `LinterSettings`. Test Plan -- Existing tests
) Summary -- I noticed while reviewing #19390 that in `check_tokens` we were still passing around an extra `LinterSettings`, despite all of the same functions also receiving a `LintContext` with its own settings. This PR adds the `LintContext::settings` method and calls that instead of using the separate `LinterSettings`. Test Plan -- Existing tests
Summary
Fixes #18844
I'm not too sure if the solution is as simple as the way I implemented it, but I'm curious to see if we are covering all cases correctly here.