fix: guard detail dict access in render.py and suppress repeated plugin load warnings#1
Closed
fix: guard detail dict access in render.py and suppress repeated plugin load warnings#1
Conversation
…mallet#78) Adds --by-language flag to scan and status subcommands that generates per-language score sections and scorecard images for mixed-language repos. Changes: - languages/_framework/resolution.py: add discover_repo_languages() helper that returns {lang: file_count} for all detected languages in a project - engine/_state/schema.py: add optional dimension_scores_by_language field to StateModel (backwards-compatible, default absent) - app/cli_support/parser_groups.py: add --by-language to scan + status parsers - app/commands/scan/scan_reporting_by_language.py: new module with show_per_language_score_blocks() for per-language CLI score output - app/commands/scan/scan.py: add by-language execution phase that: * detects all languages (requires >=2) * runs scan generation per language in an isolated temp state * stores dimension_scores_by_language in state * prints per-language score blocks * emits per-language scorecard PNGs (scorecard-{lang}.png or {lang} template) - app/output/scorecard.py: add language kwarg to generate_scorecard() — when set, uses that language's dimension scores from state - app/commands/status_cmd.py: --by-language reads stored per-language scores and prints them before the aggregate dimension table; JSON output includes dimension_scores_by_language when present Closes: peteromallet#140 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rnings (#210) Fix peteromallet#176: _render_item crashes with AttributeError when item['detail'] is a string instead of a dict. Add _item_detail() helper that always returns a dict, replacing all four item.get("detail", {}) call sites. Fix peteromallet#172: plugin load failures are re-logged on every subsequent load_all() call. Remove the _report_load_errors_for_load_all() call from the early-return path so errors are only emitted once. Also add a second-pass retry for plugins that failed due to circular-import errors — after the first pass all framework modules are fully initialised so the retry typically succeeds.
Owner
Author
|
Moved to upstream: peteromallet#177 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two reported issues — intended as upstream PRs for issues peteromallet#176 and peteromallet#172 in peteromallet/desloppify.
Fix peteromallet#176 — AttributeError crash in
desloppify next_render_iteminapp/commands/next_parts/render.pyassumesitem['detail']is always a dict, but it can be a string when findings come from certain scan states. This causes:Added a
_item_detail(item)helper that always returns a dict (returning{}for strings/None/missing), and replaced all fouritem.get("detail", {})call sites with it.Fix peteromallet#172 — Repeated plugin load-failure warnings on every command
Plugin load errors were re-logged on every subsequent
load_all()call. This caused noisy output like:appearing before normal command output on every invocation.
Changes:
_report_load_errors_for_load_all()call from the early-return path inload_all()— errors are now logged only once (on the initial load)generic.py) are fully initialised, so the retry typically succeedsTest plan
desloppify nextno longer crashes withAttributeErrorwhen a finding has a stringdetailfieldpython3 -m pytest desloppify/tests/lang/common/test_lang_discovery.py— all 4 tests pass🤖 Generated with Claude Code