Split add_noqa process into distinctive edit generation and edit application stages (#11265)

## Summary

`--add-noqa` now runs in two stages: first, the linter finds all
diagnostics that need noqa comments and generate edits on a per-line
basis. Second, these edits are applied, in order, to the document.

A public-facing function, `generate_noqa_edits`, has also been
introduced, which returns noqa edits generated on a per-diagnostic
basis. This will be used by `ruff server` for noqa comment quick-fixes.

## Test Plan

Unit tests have been updated.
This commit is contained in:
Jane Lewis 2024-05-10 16:16:52 -07:00 committed by GitHub
parent 0726e82342
commit 890cc325d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 320 additions and 74 deletions

View file

@ -5,6 +5,7 @@
//!
//! [Ruff]: https://github.com/astral-sh/ruff
pub use noqa::generate_noqa_edits;
#[cfg(feature = "clap")]
pub use registry::clap_completion::RuleParser;
#[cfg(feature = "clap")]