Skip to content

Commit

Permalink
chore: use meaningful name
Browse files Browse the repository at this point in the history
  • Loading branch information
shulaoda committed Jan 26, 2025
1 parent 3c1652d commit 1e6f76f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
// <https://docs.rs/ignore/latest/ignore/overrides/struct.OverrideBuilder.html#method.add>
let pattern = format!("!{pattern}");
override_builder.add(&pattern).unwrap();
builder.add(&pattern).unwrap();
}
}
if !oxlintrc.ignore_patterns.is_empty() {
Expand All @@ -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
Expand All @@ -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() {
Expand All @@ -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();
Expand Down

0 comments on commit 1e6f76f

Please sign in to comment.