From 800323071589c92cffbab7bbd8ff3dfb5f002316 Mon Sep 17 00:00:00 2001 From: Muntashir Al-Islam Date: Tue, 25 Mar 2025 01:37:31 -0700 Subject: [PATCH] Improve lint.php Signed-off-by: Muntashir Al-Islam --- scripts/lint.php | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/scripts/lint.php b/scripts/lint.php index b2b0219..afe9566 100644 --- a/scripts/lint.php +++ b/scripts/lint.php @@ -1,19 +1,22 @@ $value) { + if (!in_array($key, SUPPORTED_BL_KEYS, true)) { + fprintf($lint_writer, "Invalid field: " . $key . "\n"); + ++$error_count; + } + } // `id` is a string if (gettype($item['id']) != 'string') { fprintf($lint_writer, "Expected `id` field to be a string, found: " . gettype($item['id']) . "\n"); @@ -188,6 +194,13 @@ function validate_bloatware_item(array $item): int { function validate_suggestion_item(array $item): int { global $lint_writer; $error_count = 0; + // Check if the keys are valid + foreach ($item as $key => $value) { + if (!in_array($key, SUPPORTED_SUG_KEYS, true)) { + fprintf($lint_writer, "Invalid field: " . $key . "\n"); + ++$error_count; + } + } // `id` is a string if (gettype($item['id']) != 'string') { fprintf($lint_writer, "Expected `id` field to be a string, found: " . gettype($item['id']) . "\n");