From 47e3021fc3d5c750ccbcf223a7c00096a78e4262 Mon Sep 17 00:00:00 2001 From: ChuckBuilds Date: Tue, 14 Jul 2026 16:31:43 -0400 Subject: [PATCH] fix: address Codacy findings in the Composer blueprint - Dropped a pointless f-string prefix (no placeholders) on the default plugin description. - Replaced two bare except:pass/continue blocks (manifest.json listing, config_schema.json parsing) with a logged warning before falling through to the same skip-this-entry behavior -- same control flow, now visible in logs instead of silent. Skipped as false positives (verified against actual usage, not fixed): - Jinja2 Environment(autoescape=False) -- this env renders manager.py.j2, a Python source-code generator, never HTML; autoescaping would corrupt generated code. Flagged by a generic XSS rule that assumes all Jinja2 environments render HTML. - "Flask route directly returning a formatted string" on _as_rgb_filter -- that's a Jinja *filter* function, not a Flask route. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ --- web_interface/blueprints/composer.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web_interface/blueprints/composer.py b/web_interface/blueprints/composer.py index a6e19374..68642a84 100644 --- a/web_interface/blueprints/composer.py +++ b/web_interface/blueprints/composer.py @@ -509,7 +509,7 @@ def _generate_plugin_files(data: dict) -> dict: 'name': plugin_name, 'version': version, 'author': author, - 'description': metadata.get('description', f'Custom plugin created with LEDMatrix Plugin Composer'), + 'description': metadata.get('description', 'Custom plugin created with LEDMatrix Plugin Composer'), 'category': metadata.get('category', 'custom'), 'tags': ['composer', 'custom'], 'entry_point': 'manager.py', @@ -721,7 +721,8 @@ def list_plugins(): continue try: manifest = json.loads(manifest_path.read_text()) - except Exception: + except Exception as e: + logger.warning("Skipping %s: unreadable manifest.json (%s)", entry.name, e) continue has_state = (entry / '_composer_state.json').exists() results.append({ @@ -808,8 +809,8 @@ def load_plugin(plugin_id): 'default': prop.get('default', ''), 'description': prop.get('description', ''), }) - except Exception: - pass + except Exception as e: + logger.warning("Failed to parse config_schema.json for %s: %s", plugin_id, e) manifest = {} if manifest_path.exists():