mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 05:51:03 -05:00
Print warning when running debug builds without --no-cache (#1549)
This commit is contained in:
@@ -46,8 +46,8 @@ pub fn run(
|
||||
|
||||
if paths.is_empty() {
|
||||
one_time_warning!(
|
||||
"{} {}",
|
||||
"warning:".yellow().bold(),
|
||||
"{}: {}",
|
||||
"warning".yellow().bold(),
|
||||
"No Python files found under the given path(s)"
|
||||
);
|
||||
return Ok(Diagnostics::default());
|
||||
@@ -196,8 +196,8 @@ pub fn add_noqa(
|
||||
|
||||
if paths.is_empty() {
|
||||
one_time_warning!(
|
||||
"{} {}",
|
||||
"warning:".yellow().bold(),
|
||||
"{}: {}",
|
||||
"warning".yellow().bold(),
|
||||
"No Python files found under the given path(s)"
|
||||
);
|
||||
return Ok(0);
|
||||
@@ -270,8 +270,8 @@ pub fn show_files(
|
||||
|
||||
if paths.is_empty() {
|
||||
one_time_warning!(
|
||||
"{} {}",
|
||||
"warning:".yellow().bold(),
|
||||
"{}: {}",
|
||||
"warning".yellow().bold(),
|
||||
"No Python files found under the given path(s)"
|
||||
);
|
||||
return Ok(());
|
||||
|
||||
@@ -29,6 +29,7 @@ use ::ruff::settings::{pyproject, Settings};
|
||||
use ::ruff::updates;
|
||||
use anyhow::Result;
|
||||
use clap::{CommandFactory, Parser};
|
||||
use colored::Colorize;
|
||||
use notify::{recommended_watcher, RecursiveMode, Watcher};
|
||||
use path_absolutize::path_dedot;
|
||||
|
||||
@@ -172,13 +173,29 @@ pub(crate) fn inner_main() -> Result<ExitCode> {
|
||||
};
|
||||
let cache = !cli.no_cache;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
if cache {
|
||||
// `--no-cache` doesn't respect code changes, and so is often confusing during
|
||||
// development.
|
||||
eprintln!(
|
||||
"{}: debug build without --no-cache.",
|
||||
"warning".yellow().bold()
|
||||
);
|
||||
}
|
||||
|
||||
let printer = Printer::new(&format, &log_level, &autofix, &violations);
|
||||
if cli.watch {
|
||||
if !matches!(autofix, fixer::Mode::None) {
|
||||
eprintln!("Warning: --fix is not enabled in watch mode.");
|
||||
eprintln!(
|
||||
"{}: --fix is not enabled in watch mode.",
|
||||
"warning".yellow().bold()
|
||||
);
|
||||
}
|
||||
if format != SerializationFormat::Text {
|
||||
eprintln!("Warning: --format 'text' is used in watch mode.");
|
||||
eprintln!(
|
||||
"{}: --format 'text' is used in watch mode.",
|
||||
"warning".yellow().bold()
|
||||
);
|
||||
}
|
||||
|
||||
// Perform an initial run instantly.
|
||||
|
||||
Reference in New Issue
Block a user