mirror of https://github.com/astral-sh/ruff
Check if toml file is parsed, program crashes otherwise without
information. If not parsed, use default
This commit is contained in:
parent
64df4eb311
commit
0dc79db0c8
|
|
@ -13,13 +13,17 @@ pub fn load_config<'a>(paths: impl IntoIterator<Item = &'a Path>) -> Result<(Pat
|
|||
match find_project_root(paths) {
|
||||
Some(project_root) => match find_pyproject_toml(&project_root) {
|
||||
Some(path) => {
|
||||
match parse_pyproject_toml(&path) {
|
||||
Ok(pyproject) => {
|
||||
debug!("Found pyproject.toml at: {}", path.to_string_lossy());
|
||||
let pyproject = parse_pyproject_toml(&path)?;
|
||||
let config = pyproject
|
||||
.tool
|
||||
.and_then(|tool| tool.ruff)
|
||||
.unwrap_or_default();
|
||||
Ok((project_root, config))
|
||||
},
|
||||
Err(_) => Ok(Default::default())
|
||||
}
|
||||
}
|
||||
None => Ok(Default::default()),
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue