Skip to content

Commit bb4512f

Browse files
committed
Root exclusions in the server to project root
1 parent b8430bd commit bb4512f

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

crates/ruff_server/src/resolve.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ fn is_document_excluded(
5959
) -> bool {
6060
if let Some(exclusion) = match_any_exclusion(
6161
path,
62+
&resolver_settings.project_root,
6263
&resolver_settings.exclude,
6364
&resolver_settings.extend_exclude,
6465
linter_settings.map(|s| &*s.exclude),

crates/ruff_workspace/src/resolver.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ impl std::fmt::Display for ExclusionKind {
778778
/// any of the exclusion criteria.
779779
pub fn match_any_exclusion(
780780
path: &Path,
781+
project_root: &Path,
781782
exclude: &GlobSet,
782783
extend_exclude: &GlobSet,
783784
lint_exclude: Option<&GlobSet>,
@@ -804,6 +805,11 @@ pub fn match_any_exclusion(
804805
}
805806
}
806807
}
808+
if path == project_root {
809+
// Bail out; we'd end up past the project root on the next iteration
810+
// (excludes etc. are thus "rooted" to the project).
811+
break;
812+
}
807813
}
808814
None
809815
}

0 commit comments

Comments
 (0)