Conversation
|
b78c67e to
26b2137
Compare
|
The PR summary is a bit confusing because it isn't clear to me when/if you're speaking about the ruff or linter (It may be too late for this but I liked what @BurntSushi did early on in his refactor: He renamed the old |
| settings, | ||
| source_type, | ||
| source_kind.as_ipy_notebook().map(Notebook::cell_offsets), | ||
| source_file.clone(), |
There was a problem hiding this comment.
Can't we pass the file by reference instead of cloning everywhere?
|
Oh sorry, this PR is all about the old I think you might be right about it being a bit late. My plan after this and #18051 is to delete |
MichaReiser
left a comment
There was a problem hiding this comment.
I feel bad saying this because this must have taken you a lot of time but I feel a bit concerned about introducing a new required argument for every lint rule.
Could we take inspiration from InferContext::report_lint and e.g. introduce a checker.report_violation(violation, range) that returns a DiagnosticGuard that automatically injects the file and pushes the diagnostic on drop?
I didn't review all call sites to get a good sense if this works in all cases but it would avoid passing file everywhere
No worries, I was concerned about that too. I'll take a look at It definitely won't work everywhere, at least as a method on |
I'm fine passing |
|
I'm going to go ahead and close this one instead of trying to rebase onto #18051. I'll put up a second attempt with a new |
Summary
As the title says, this PR adds a
SourceFilefield toruff_diagnostics::Diagnostic. After #18051, this will be the main piece of information present inMessageand not inruff_diagnostics::Diagnostic, so this PR will facilitate replacingruff_diagnostics::DiagnosticwithMessage.The essential code changes are very small:
source_file: SourceFilefield toruff_diagnostics::Diagnosticsource_file: SourceFilefield toCheckerOther than that, the changes are just plumbing
SourceFilearguments through functions to get them toruff_diagnostics::Diagnostic::newcalls.Test Plan
Existing tests