mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 15:15:33 +00:00
Add a --show-fixes
flag to include applied fixes in output (#2707)
This commit is contained in:
parent
c399b3e6c1
commit
1666e8ba1e
14 changed files with 332 additions and 122 deletions
|
@ -75,9 +75,14 @@ pub struct CheckArgs {
|
|||
show_source: bool,
|
||||
#[clap(long, overrides_with("show_source"), hide = true)]
|
||||
no_show_source: bool,
|
||||
/// Show an enumeration of all autofixed lint violations.
|
||||
#[arg(long, overrides_with("no_show_fixes"))]
|
||||
show_fixes: bool,
|
||||
#[clap(long, overrides_with("show_fixes"), hide = true)]
|
||||
no_show_fixes: bool,
|
||||
/// Avoid writing any fixed files back; instead, output a diff for each
|
||||
/// changed file to stdout.
|
||||
#[arg(long)]
|
||||
#[arg(long, conflicts_with = "show_fixes")]
|
||||
pub diff: bool,
|
||||
/// Run in watch mode by re-running whenever files change.
|
||||
#[arg(short, long)]
|
||||
|
@ -380,6 +385,7 @@ impl CheckArgs {
|
|||
fix_only: resolve_bool_arg(self.fix_only, self.no_fix_only),
|
||||
force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude),
|
||||
format: self.format,
|
||||
show_fixes: resolve_bool_arg(self.show_fixes, self.no_show_fixes),
|
||||
update_check: resolve_bool_arg(self.update_check, self.no_update_check),
|
||||
},
|
||||
)
|
||||
|
@ -438,6 +444,7 @@ pub struct Overrides {
|
|||
pub fix_only: Option<bool>,
|
||||
pub force_exclude: Option<bool>,
|
||||
pub format: Option<SerializationFormat>,
|
||||
pub show_fixes: Option<bool>,
|
||||
pub update_check: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -492,6 +499,9 @@ impl ConfigProcessor for &Overrides {
|
|||
if let Some(show_source) = &self.show_source {
|
||||
config.show_source = Some(*show_source);
|
||||
}
|
||||
if let Some(show_fixes) = &self.show_fixes {
|
||||
config.show_fixes = Some(*show_fixes);
|
||||
}
|
||||
if let Some(target_version) = &self.target_version {
|
||||
config.target_version = Some(*target_version);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue