Skip to content

Commit fee5cd1

Browse files
fixes auto-run js checks in tidy
1 parent 51ff895 commit fee5cd1

File tree

1 file changed

+13
-13
lines changed
  • src/tools/tidy/src/extra_checks

1 file changed

+13
-13
lines changed

src/tools/tidy/src/extra_checks/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -720,21 +720,21 @@ impl ExtraCheckArg {
720720
if !self.auto {
721721
return true;
722722
}
723-
let ext = match self.lang {
724-
ExtraCheckLang::Py => ".py",
725-
ExtraCheckLang::Cpp => ".cpp",
726-
ExtraCheckLang::Shell => ".sh",
727-
ExtraCheckLang::Js => ".js",
723+
match self.lang {
728724
ExtraCheckLang::Spellcheck => {
729-
for dir in SPELLCHECK_DIRS {
730-
if Path::new(filepath).starts_with(dir) {
731-
return true;
732-
}
733-
}
734-
return false;
725+
SPELLCHECK_DIRS.iter().any(|dir| Path::new(filepath).starts_with(dir))
735726
}
736-
};
737-
filepath.ends_with(ext)
727+
lang => {
728+
let exts: &[&str] = match lang {
729+
ExtraCheckLang::Py => &[".py"],
730+
ExtraCheckLang::Cpp => &[".cpp"],
731+
ExtraCheckLang::Shell => &[".sh"],
732+
ExtraCheckLang::Js => &[".js", ".ts"],
733+
ExtraCheckLang::Spellcheck => unreachable!(),
734+
};
735+
exts.iter().any(|ext| filepath.ends_with(ext))
736+
}
737+
}
738738
}
739739

740740
fn has_supported_kind(&self) -> bool {

0 commit comments

Comments
 (0)