Extend pragma comment cases (#7687)

## Summary

Extends the pragma comment detection in the formatter to support
case-insensitive `noqa` (as supposed by Ruff), plus a variety of other
pragmas (`isort:`, `nosec`, etc.).

Also extracts the detection out into the trivia crate so that we can
reuse it in the linter (see:
https://github.com/astral-sh/ruff/issues/7471).

## Test Plan

`cargo test`
This commit is contained in:
Charlie Marsh 2023-09-28 14:55:19 -04:00 committed by GitHub
parent 46b85ab0a9
commit f62b4c801f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 11 deletions

View file

@ -1,10 +1,12 @@
mod comment_ranges;
mod cursor;
mod pragmas;
pub mod textwrap;
mod tokenizer;
mod whitespace;
pub use comment_ranges::CommentRanges;
pub use cursor::*;
pub use pragmas::*;
pub use tokenizer::*;
pub use whitespace::*;