mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Respect NO_COLOR flags in --show-source (#2750)
This commit is contained in:
parent
acb70520f8
commit
0040991778
1 changed files with 6 additions and 4 deletions
|
@ -7,16 +7,18 @@ use std::path::Path;
|
|||
use annotate_snippets::display_list::{DisplayList, FormatOptions};
|
||||
use annotate_snippets::snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation};
|
||||
use anyhow::Result;
|
||||
use colored::control::SHOULD_COLORIZE;
|
||||
use colored::Colorize;
|
||||
use itertools::{iterate, Itertools};
|
||||
use serde::Serialize;
|
||||
use serde_json::json;
|
||||
|
||||
use ruff::fs::relativize_path;
|
||||
use ruff::logging::LogLevel;
|
||||
use ruff::message::{Location, Message};
|
||||
use ruff::registry::Rule;
|
||||
use ruff::settings::types::SerializationFormat;
|
||||
use ruff::{fix, notify_user};
|
||||
use serde::Serialize;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::diagnostics::Diagnostics;
|
||||
|
||||
|
@ -560,7 +562,7 @@ fn print_message<T: Write>(stdout: &mut T, message: &Message) -> Result<()> {
|
|||
fold: false,
|
||||
}],
|
||||
opt: FormatOptions {
|
||||
color: true,
|
||||
color: SHOULD_COLORIZE.should_colorize(),
|
||||
..FormatOptions::default()
|
||||
},
|
||||
};
|
||||
|
@ -623,7 +625,7 @@ fn print_grouped_message<T: Write>(
|
|||
fold: false,
|
||||
}],
|
||||
opt: FormatOptions {
|
||||
color: true,
|
||||
color: SHOULD_COLORIZE.should_colorize(),
|
||||
..FormatOptions::default()
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue