From 1e6f76f42325a8dc6eb5f677a2d466b3342d68ed Mon Sep 17 00:00:00 2001 From: shulaoda Date: Sun, 26 Jan 2025 22:54:15 +0800 Subject: [PATCH] chore: use meaningful name --- apps/oxlint/src/lint.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/oxlint/src/lint.rs b/apps/oxlint/src/lint.rs index adfc1efe3716f..d9813b7c379b2 100644 --- a/apps/oxlint/src/lint.rs +++ b/apps/oxlint/src/lint.rs @@ -82,17 +82,17 @@ impl Runner for LintRunner { } let mut oxlintrc = config_search_result.unwrap(); - let mut builder = None; + let mut override_builder = None; if !ignore_options.no_ignore { - let mut override_builder = OverrideBuilder::new(&self.cwd); + let mut builder = OverrideBuilder::new(&self.cwd); if !ignore_options.ignore_pattern.is_empty() { for pattern in &ignore_options.ignore_pattern { // Meaning of ignore pattern is reversed // let pattern = format!("!{pattern}"); - override_builder.add(&pattern).unwrap(); + builder.add(&pattern).unwrap(); } } if !oxlintrc.ignore_patterns.is_empty() { @@ -101,11 +101,11 @@ impl Runner for LintRunner { Self::adjust_ignore_patterns(&self.cwd, &oxlint_wd, oxlintrc.ignore_patterns); for pattern in &oxlintrc.ignore_patterns { let pattern = format!("!{pattern}"); - override_builder.add(&pattern).unwrap(); + builder.add(&pattern).unwrap(); } } - let override_builder = override_builder.build().unwrap(); + let builder = builder.build().unwrap(); // The ignore crate whitelists explicit paths, but priority // should be given to the ignore file. Many users lint @@ -124,13 +124,13 @@ impl Runner for LintRunner { if path.is_dir() { true } else { - !(override_builder.matched(p, false).is_ignore() + !(builder.matched(p, false).is_ignore() || ignore.matched(path, false).is_ignore()) } }); } - builder = Some(override_builder); + override_builder = Some(builder); } if paths.is_empty() { @@ -144,7 +144,7 @@ impl Runner for LintRunner { paths.push(self.cwd.clone()); } - let walker = Walk::new(&paths, &ignore_options, builder); + let walker = Walk::new(&paths, &ignore_options, override_builder); let paths = walker.with_extensions(Extensions(extensions)).paths(); let number_of_files = paths.len();