in tools/sdk-lints/src/lint.rs [52:79]
fn name(&self) -> &str;
fn files_to_check(&self) -> anyhow::Result<Vec<PathBuf>>;
fn check_all(&self) -> anyhow::Result<Vec<LintError>>
where
Self: Check,
{
let mut errors = vec![];
for path in self
.files_to_check()
.with_context(|| format!("failed to load file list for {}", self.name()))?
{
let new_errors = self
.check(&path)
.with_context(|| format!("error linting {}", &path.display()))?
.into_iter()
.map(|lint| lint.at_location(path.clone()));
errors.extend(new_errors);
}
if errors.len() == 0 {
eprintln!("{}...OK!", self.name())
} else {
eprintln!("Errors for {}:", self.name());
for error in &errors {
eprintln!(" {}", error)
}
}
Ok(errors)
}