Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include individual path checks in --verbose logging #3489

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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))?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separately: pretty sure we want to be using .display when constructing user-facing paths?

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 @@ -45,10 +45,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