Skip to content

Commit

Permalink
bugfix257 Reinitialize linter for each file.
Browse files Browse the repository at this point in the history
- I've called this Option3 in the comments of dalance#257.
- Clone of `config` might be avoided, but this is the lowest-effort change.
  • Loading branch information
DaveMcEwan committed Jun 28, 2023
1 parent b306465 commit 78ee835
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ pub fn run_opt_config(printer: &mut Printer, opt: &Opt, config: Config) -> Resul
not_obsolete = false;
}

let mut linter = Linter::new(config);
for plugin in &opt.plugins {
linter.load(&plugin)?;
}

let mut defines = HashMap::new();
for define in &opt.defines {
let mut define = define.splitn(2, '=');
Expand Down Expand Up @@ -251,6 +246,12 @@ pub fn run_opt_config(printer: &mut Printer, opt: &Opt, config: Config) -> Resul
let mut all_pass = true;

for path in &files {

let mut linter = Linter::new(config.clone());
for plugin in &opt.plugins {
linter.load(&plugin)?;
}

let mut pass = true;
if opt.preprocess_only {
match preprocess(&path, &defines, &includes, false, opt.ignore_include) {
Expand Down

0 comments on commit 78ee835

Please sign in to comment.