Skip to content

Commit

Permalink
Include individual path checks in --verbose logging (#3489)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Mar 13, 2023
1 parent a6e998d commit 1e5db58
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/ruff/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub fn resolve_configuration(

// Resolve the current path.
let options = pyproject::load_options(&path)
.map_err(|err| anyhow!("Failed to parse `{}`: {}", path.to_string_lossy(), err))?;
.map_err(|err| anyhow!("Failed to parse `{}`: {}", path.display(), err))?;
let project_root = relativity.resolve(&path);
let configuration = Configuration::from_options(options, &project_root)?;

Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_cli/src/commands/add_noqa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn add_noqa(
match add_noqa_to_path(path, package, settings) {
Ok(count) => Some(count),
Err(e) => {
error!("Failed to add noqa to {}: {e}", path.to_string_lossy());
error!("Failed to add noqa to {}: {e}", path.display());
None
}
}
Expand Down
5 changes: 1 addition & 4 deletions crates/ruff_cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ pub fn run(
if cache.into() {
fn init_cache(path: &std::path::Path) {
if let Err(e) = cache::init(path) {
error!(
"Failed to initialize cache at {}: {e:?}",
path.to_string_lossy()
);
error!("Failed to initialize cache at {}: {e:?}", path.display());
}
}

Expand Down
4 changes: 3 additions & 1 deletion crates/ruff_cli/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ pub fn lint_path(
if let Some(messages) =
cache::get(path, package.as_ref(), &metadata, settings, autofix.into())
{
debug!("Cache hit for: {}", path.to_string_lossy());
debug!("Cache hit for: {}", path.display());
return Ok(Diagnostics::new(messages));
}
Some(metadata)
} else {
None
};

debug!("Checking: {}", path.display());

// Read the file from disk.
let contents = std::fs::read_to_string(path)?;

Expand Down

0 comments on commit 1e5db58

Please sign in to comment.