From 28a489ad21679caee6576b0a59520a4c58efca00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Piotrowski?= Date: Wed, 25 Oct 2023 12:37:11 +0200 Subject: [PATCH] Store flatpak-builder-lint output as JSON --- Cargo.toml | 2 +- src/review/diagnostics.rs | 2 +- src/review/validation.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ec19468..23964a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,4 +15,4 @@ log = "0.4.20" ostree = { version = "0.19.1", features = ["v2021_5"] } reqwest = { version = "0.11.22", features = ["json", "blocking"] } serde = { version = "1.0.188", features = ["derive"] } -serde_json = "1.0.107" +serde_json = { version = "1.0.107", features = ["raw_value"] } diff --git a/src/review/diagnostics.rs b/src/review/diagnostics.rs index c8d9b54..8b583ff 100644 --- a/src/review/diagnostics.rs +++ b/src/review/diagnostics.rs @@ -19,7 +19,7 @@ pub enum DiagnosticInfo { /// The appstream file is missing or couldn't be read. FailedToLoadAppstream { path: String, error: String }, /// There is a problem in one of the appstream files. - FlatpakBuilderLint { stdout: String, stderr: String }, + FlatpakBuilderLint { stdout: serde_json::value::Value, stderr: String }, /// The app is FOSS, but a URL for the build's CI log was not given or is not a valid URL. MissingBuildLogUrl, /// A screenshot in appstream does not point to the flathub screenshot mirror. diff --git a/src/review/validation.rs b/src/review/validation.rs index db9212e..c7904a6 100644 --- a/src/review/validation.rs +++ b/src/review/validation.rs @@ -78,7 +78,7 @@ fn run_flatpak_builder_lint(refstring: &str) -> Result if !output.status.success() { Ok(vec![ValidationDiagnostic::new( DiagnosticInfo::FlatpakBuilderLint { - stdout: String::from_utf8_lossy(&output.stdout).to_string(), + stdout: serde_json::from_slice::(&output.stdout).unwrap(), stderr: String::from_utf8_lossy(&output.stderr).to_string(), }, Some(refstring.to_string()),