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) {
|
match find_project_root(paths) {
|
||||||
Some(project_root) => match find_pyproject_toml(&project_root) {
|
Some(project_root) => match find_pyproject_toml(&project_root) {
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
debug!("Found pyproject.toml at: {}", path.to_string_lossy());
|
match parse_pyproject_toml(&path) {
|
||||||
let pyproject = parse_pyproject_toml(&path)?;
|
Ok(pyproject) => {
|
||||||
let config = pyproject
|
debug!("Found pyproject.toml at: {}", path.to_string_lossy());
|
||||||
.tool
|
let config = pyproject
|
||||||
.and_then(|tool| tool.ruff)
|
.tool
|
||||||
.unwrap_or_default();
|
.and_then(|tool| tool.ruff)
|
||||||
Ok((project_root, config))
|
.unwrap_or_default();
|
||||||
|
Ok((project_root, config))
|
||||||
|
},
|
||||||
|
Err(_) => Ok(Default::default())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None => Ok(Default::default()),
|
None => Ok(Default::default()),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue