From 6cbf7ac0148da1c5f10d6a722e357c52c560d75e Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 14 May 2026 14:42:44 -0400 Subject: [PATCH] fix: resolve 8 new Codacy issues introduced by PR changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shellcheck SC2034: - first_time_install.sh: 'type' loop variable also unused in the wifi status loop (we previously fixed 'device' → '_' but left 'type'). Changed to '_ _ state' since neither device nor type is referenced. ESLint no-undef: - app.js: typeof guards don't satisfy no-undef; added updateSystemStats to the /* global */ declaration alongside showNotification. nosec annotation: - web_interface/app.py: app.run(host='0.0.0.0') line changed when we fixed debug=True, giving it a new issue ID. Re-added # nosec B104. pyflakes F401: - scripts/dev/test_pillow_compat.py: ImageFilter was imported but never used in the smoke test. Removed from the import. Codacy API suppressions (false positives on changed lines): - disk_cache.py 0o660 chmod (2x): lines changed when # nosec B103 was added, producing new Semgrep issue IDs. Re-suppressed. - pages_v3.py raw-html-concat: Semgrep does not recognise escape() as a sanitizer; the escape() call IS the correct fix. - app.py flask 0.0.0.0: same line as B104 above; Semgrep rule also re-suppressed. Co-Authored-By: Claude Sonnet 4.6 --- first_time_install.sh | 2 +- scripts/dev/test_pillow_compat.py | 2 +- web_interface/app.py | 2 +- web_interface/static/v3/app.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/first_time_install.sh b/first_time_install.sh index 4b9ac4a6..2c46ed7f 100644 --- a/first_time_install.sh +++ b/first_time_install.sh @@ -1475,7 +1475,7 @@ echo "WiFi Connection Status:" if command -v nmcli >/dev/null 2>&1; then WIFI_STATUS=$(nmcli -t -f DEVICE,TYPE,STATE device status 2>/dev/null | grep -i wifi || echo "") if [ -n "$WIFI_STATUS" ]; then - echo "$WIFI_STATUS" | while IFS=':' read -r _ type state; do + echo "$WIFI_STATUS" | while IFS=':' read -r _ _ state; do if [ "$state" = "connected" ]; then SSID=$(nmcli -t -f active,ssid device wifi 2>/dev/null | grep "^yes:" | cut -d: -f2 | head -1) if [ -n "$SSID" ]; then diff --git a/scripts/dev/test_pillow_compat.py b/scripts/dev/test_pillow_compat.py index ce0dfdd6..590d632c 100755 --- a/scripts/dev/test_pillow_compat.py +++ b/scripts/dev/test_pillow_compat.py @@ -23,7 +23,7 @@ def check(label, fn): def main(): - from PIL import Image, ImageDraw, ImageFont, ImageFilter + from PIL import Image, ImageDraw, ImageFont import PIL print(f"Pillow {PIL.__version__} on Python {sys.version.split()[0]}\n") diff --git a/web_interface/app.py b/web_interface/app.py index 393fef17..57286300 100644 --- a/web_interface/app.py +++ b/web_interface/app.py @@ -742,4 +742,4 @@ if __name__ == '__main__': # long-lived /api/v3/stream/* SSE connections don't starve other requests. # Debug mode is off by default; opt in with FLASK_DEBUG=1 in the environment. _debug = _os.environ.get('FLASK_DEBUG', '0') == '1' - app.run(host='0.0.0.0', port=5000, debug=_debug, threaded=True) + app.run(host='0.0.0.0', port=5000, debug=_debug, threaded=True) # nosec B104 - intentional; local network device diff --git a/web_interface/static/v3/app.js b/web_interface/static/v3/app.js index 4fe1ed46..56b8c985 100644 --- a/web_interface/static/v3/app.js +++ b/web_interface/static/v3/app.js @@ -1,4 +1,4 @@ -/* global showNotification */ +/* global showNotification, updateSystemStats */ // LED Matrix v3 JavaScript // Additional helpers for HTMX and Alpine.js integration