From 9eee47a8e9bcd031ab2cf045dc82ef01a010619a Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Tue, 13 Jul 2021 17:38:53 +0000 Subject: [PATCH] Validate infra configs on presubmit Try to parse json files on presubmit and add warning it if unable to parse. R=apolito@google.com Bug: 1223923 Change-Id: I67ab4702cb9b995aace6527f4a04f1a1068db7d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3019692 Auto-Submit: Josip Sokcevic Commit-Queue: Anthony Polito Reviewed-by: Anthony Polito --- PRESUBMIT.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index ad837c987..7aba7c604 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -70,7 +70,9 @@ def DepotToolsPylint(input_api, output_api): def CommonChecks(input_api, output_api, tests_to_skip_list): input_api.SetTimeout(TEST_TIMEOUT_S) - results = [] + file_filter = lambda x: x.LocalPath() == 'infra/config/recipes.cfg' + results = input_api.canned_checks.CheckJsonParses(input_api, output_api, + file_filter=file_filter) # The tests here are assuming this is not defined, so raise an error # if it is.