mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-08-01 16:58:06 +00:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e319540c6e
commit
47e3021fc3
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user