Skip to content

Commit e2109c1

Browse files
authored
Improve debug printing for resolving origin of config settings (#8729)
## Summary When running ruff in verbose mode with `-v`, the first debug logs show where the config settings are taken from. For example: ``` ❯ ruff check ./some_file.py -v [2023-11-17][00:16:25][ruff_cli::resolve][DEBUG] Using pyproject.toml (parent) at /Users/vince/demo/ruff.toml ``` This threw me off for a second because I knew I had no python project there, and therefore no `pyproject.toml` file. Then I realised it was actually reading a `ruff.toml` file (obvious when you read the whole print I suppose) and that the pyproject.toml is a hardcoded string in the debug log. I think it would be nice to tweak the wording slightly so it is clear that the settings don't neccessarily have to come from a `pyproject.toml` file.
1 parent 1fcccf8 commit e2109c1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

crates/ruff_cli/src/resolve.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn resolve(
4343
{
4444
let settings = resolve_root_settings(&pyproject, Relativity::Cwd, overrides)?;
4545
debug!(
46-
"Using user specified pyproject.toml at {}",
46+
"Using user-specified configuration file at: {}",
4747
pyproject.display()
4848
);
4949
return Ok(PyprojectConfig::new(
@@ -63,7 +63,10 @@ pub fn resolve(
6363
.as_ref()
6464
.unwrap_or(&path_dedot::CWD.as_path()),
6565
)? {
66-
debug!("Using pyproject.toml (parent) at {}", pyproject.display());
66+
debug!(
67+
"Using configuration file (via parent) at: {}",
68+
pyproject.display()
69+
);
6770
let settings = resolve_root_settings(&pyproject, Relativity::Parent, overrides)?;
6871
return Ok(PyprojectConfig::new(
6972
PyprojectDiscoveryStrategy::Hierarchical,
@@ -77,7 +80,10 @@ pub fn resolve(
7780
// end up the "closest" `pyproject.toml` file for every Python file later on, so
7881
// these act as the "default" settings.)
7982
if let Some(pyproject) = pyproject::find_user_settings_toml() {
80-
debug!("Using pyproject.toml (cwd) at {}", pyproject.display());
83+
debug!(
84+
"Using configuration file (via cwd) at: {}",
85+
pyproject.display()
86+
);
8187
let settings = resolve_root_settings(&pyproject, Relativity::Cwd, overrides)?;
8288
return Ok(PyprojectConfig::new(
8389
PyprojectDiscoveryStrategy::Hierarchical,

0 commit comments

Comments
 (0)