From ce78825f6627eb7e727365a7b7e48ac716c52b20 Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Sat, 18 Feb 2023 18:00:19 +0100 Subject: [PATCH] woodpecker: add static analysis --- .woodpecker.yml | 3 +++ verify-configs.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 5d8f1a3..fffc15e 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,6 +6,7 @@ pipeline: - pip install -U platformio - pio run -e bike -e bike_ble - pio run -e bike -e bike_ble --target buildfs + - pio check -e bike -e bike_ble build_esp32: group: build image: python @@ -13,6 +14,7 @@ pipeline: - pip install -U platformio - pio run -e esp32 -e esp32_wifi -e esp32_bluetooth - pio run -e esp32 -e esp32_wifi -e esp32_bluetooth --target buildfs + - pio check -e esp32 -e esp32_wifi -e esp32_bluetooth build_8266: group: build image: python @@ -20,3 +22,4 @@ pipeline: - pip install -U platformio - pio run -e esp8266 -e esp8266_wifi - pio run -e esp8266 -e esp8266_wifi --target buildfs + - pio check -e esp8266 -e esp8266_wifi diff --git a/verify-configs.py b/verify-configs.py index 6ddfa82..6b695bf 100644 --- a/verify-configs.py +++ b/verify-configs.py @@ -2,12 +2,13 @@ Import("env") import fnmatch import os +import json def verify_json(source, target, env): for root, dirnames, files in os.walk("data"): for file in files: if file.endswith(".json"): - if (env.Execute("json_verify < " + root + '/' + file)): - Exit(1) + print("Validating " + root + '/' + file + '...') + json.load(open(root + '/' + file, 'r')) env.AddPreAction("buildfs", verify_json)