mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 22:55:08 +00:00
Introduce a ruff_diagnostics
crate (#3409)
## Summary This PR moves `Diagnostic`, `DiagnosticKind`, and `Fix` into their own crate, which will enable us to further split up Ruff, since sub-linter crates (which need to implement functions that return `Diagnostic`) can now depend on `ruff_diagnostics` rather than Ruff.
This commit is contained in:
parent
08ec11a31e
commit
024caca233
349 changed files with 758 additions and 1003 deletions
|
@ -44,12 +44,12 @@ pub fn violation(violation: &ItemStruct) -> Result<TokenStream> {
|
|||
let explanation = get_docs(&violation.attrs)?;
|
||||
let violation = if explanation.trim().is_empty() {
|
||||
quote! {
|
||||
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#violation
|
||||
|
||||
impl From<#ident> for crate::registry::DiagnosticKind {
|
||||
impl From<#ident> for ruff_diagnostics::DiagnosticKind {
|
||||
fn from(value: #ident) -> Self {
|
||||
use crate::violation::Violation;
|
||||
use ruff_diagnostics::Violation;
|
||||
|
||||
Self {
|
||||
body: Violation::message(&value),
|
||||
|
@ -62,7 +62,7 @@ pub fn violation(violation: &ItemStruct) -> Result<TokenStream> {
|
|||
}
|
||||
} else {
|
||||
quote! {
|
||||
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#violation
|
||||
|
||||
impl #ident {
|
||||
|
@ -71,9 +71,9 @@ pub fn violation(violation: &ItemStruct) -> Result<TokenStream> {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<#ident> for crate::registry::DiagnosticKind {
|
||||
impl From<#ident> for ruff_diagnostics::DiagnosticKind {
|
||||
fn from(value: #ident) -> Self {
|
||||
use crate::violation::Violation;
|
||||
use ruff_diagnostics::Violation;
|
||||
|
||||
Self {
|
||||
body: Violation::message(&value),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue