Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

compliance: Add temporary allowlist (#54644)

Finn Evers9e435c0fd607
diff --git a/tooling/compliance/src/git.rs b/tooling/compliance/src/git.rs
index ed2ff137f3c..aeea0b2f267 100644
--- a/tooling/compliance/src/git.rs
+++ b/tooling/compliance/src/git.rs
@@ -273,7 +273,7 @@ impl CommitDetails {
&self.title
}
- pub(crate) fn sha(&self) -> &CommitSha {
+ pub fn sha(&self) -> &CommitSha {
&self.sha
}
diff --git a/tooling/compliance/src/report.rs b/tooling/compliance/src/report.rs
index 7d115672028..4de67a0010a 100644
--- a/tooling/compliance/src/report.rs
+++ b/tooling/compliance/src/report.rs
@@ -53,6 +53,12 @@ impl<R: ToString> ReportEntry<R> {
}
}
+impl ReportEntry<ReviewResult> {
+ pub fn is_unknown_error(&self) -> bool {
+ matches!(self.reason, Err(ReviewFailure::Other(_)))
+ }
+}
+
impl ReportEntry<ReviewFailure> {
fn issue_kind(&self) -> IssueKind {
match self.reason {
@@ -115,7 +121,7 @@ impl ReportSummary {
.count(),
errors: entries
.iter()
- .filter(|entry| matches!(entry.reason, Err(ReviewFailure::Other(_))))
+ .filter(|entry| entry.is_unknown_error())
.count(),
}
}
diff --git a/tooling/xtask/src/tasks/compliance.rs b/tooling/xtask/src/tasks/compliance.rs
index 5a4b03a961d..f4ae8593e32 100644
--- a/tooling/xtask/src/tasks/compliance.rs
+++ b/tooling/xtask/src/tasks/compliance.rs
@@ -18,6 +18,10 @@ pub(crate) struct ComplianceArgs {
mode: ComplianceMode,
}
+const IGNORE_LIST: &[&str] = &[
+ "75fa566511e3ae7d03cfd76008512080291bd81d", // GitHub nuked this PR out of orbit
+];
+
#[derive(Subcommand)]
pub(crate) enum ComplianceMode {
// Check compliance for all commits between two version tags
@@ -133,6 +137,10 @@ async fn check_compliance_impl(args: ComplianceArgs) -> Result<()> {
summary.prs_with_errors()
);
+ let all_errors_known = report.errors().all(|error| {
+ error.is_unknown_error() && IGNORE_LIST.contains(&error.commit.sha().as_str())
+ });
+
for report in report.errors() {
if let Some(pr_number) = report.commit.pr_number()
&& let Ok(pull_request) = client.get_pull_request(&Repository::ZED, pr_number).await
@@ -163,6 +171,14 @@ async fn check_compliance_impl(args: ComplianceArgs) -> Result<()> {
"Compliance check failed, found {} commits not reviewed",
summary.not_reviewed
)),
+ ReportReviewSummary::MissingReviewsWithErrors if all_errors_known => {
+ println!(
+ "Compliance check failed with {} unreviewed commits, but all errors are known.",
+ summary.not_reviewed
+ );
+
+ Ok(())
+ }
ReportReviewSummary::MissingReviewsWithErrors => Err(anyhow::anyhow!(
"Compliance check failed with {} unreviewed commits and {} other issues",
summary.not_reviewed,