File tree 1 file changed +17
-7
lines changed
crates/ruff_workspace/src
1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -306,24 +306,34 @@ pub fn resolve_configuration(
306
306
) -> Result < Configuration > {
307
307
let mut seen = FxHashSet :: default ( ) ;
308
308
let mut stack = vec ! [ ] ;
309
- let mut next = Some ( fs:: normalize_path ( pyproject) ) ;
310
- while let Some ( path) = next {
309
+ let mut next = Some ( ( fs:: normalize_path ( pyproject) , None :: < PathBuf > ) ) ;
310
+ while let Some ( ( path, inherited_by ) ) = next {
311
311
if seen. contains ( & path) {
312
312
bail ! ( "Circular dependency detected in pyproject.toml" ) ;
313
313
}
314
314
315
315
// Resolve the current path.
316
- let options = pyproject:: load_options ( & path) ?;
316
+ let options = pyproject:: load_options ( & path) . map_err ( |err| match inherited_by {
317
+ Some ( f) => err. context ( format ! (
318
+ "Failed to load path {} inherited by {}" ,
319
+ path. display( ) ,
320
+ f. display( ) ,
321
+ ) ) ,
322
+ None => err,
323
+ } ) ?;
317
324
318
325
let project_root = relativity. resolve ( & path) ;
319
326
let configuration = Configuration :: from_options ( options, Some ( & path) , project_root) ?;
320
327
321
328
// If extending, continue to collect.
322
329
next = configuration. extend . as_ref ( ) . map ( |extend| {
323
- fs:: normalize_path_to (
324
- extend,
325
- path. parent ( )
326
- . expect ( "Expected pyproject.toml file to be in parent directory" ) ,
330
+ (
331
+ fs:: normalize_path_to (
332
+ extend,
333
+ path. parent ( )
334
+ . expect ( "Expected pyproject.toml file to be in parent directory" ) ,
335
+ ) ,
336
+ Some ( path. clone ( ) ) ,
327
337
)
328
338
} ) ;
329
339
You can’t perform that action at this time.
0 commit comments