Skip to content

feat: per-language scorecards for mixed-language repositories#171

Open
xliry wants to merge 1 commit intopeteromallet:mainfrom
xliry:feat/per-language-scorecards
Open

feat: per-language scorecards for mixed-language repositories#171
xliry wants to merge 1 commit intopeteromallet:mainfrom
xliry:feat/per-language-scorecards

Conversation

@xliry
Copy link

@xliry xliry commented Feb 28, 2026

Summary

Implements per-language scorecard generation for mixed-language repositories (fixes #140).

Changes

  • languages/_framework/resolution.py: Added discover_repo_languages() helper that returns {lang: file_count} for all detected languages
  • engine/_state/schema.py: Added optional dimension_scores_by_language field to StateModel (backwards-compatible)
  • app/cli_support/parser_groups.py: Added --by-language flag to both scan and status subparsers
  • app/commands/scan/scan_reporting_by_language.py (new): Per-language CLI score output module
  • app/commands/scan/scan.py: Added by-language execution phase — detects languages, runs per-language scans, stores results, prints score blocks, emits per-language scorecard PNGs
  • app/output/scorecard.py: Added language keyword arg to generate_scorecard() — uses per-language dimension scores when set
  • app/commands/status_cmd.py: --by-language reads stored per-language scores from state

Usage

# Scan and generate per-language scorecards
desloppify scan --path . --by-language

# Custom badge path with {lang} template
desloppify scan --path . --by-language --badge-path scorecard-{lang}.png

# View per-language breakdown in status
desloppify status --by-language

Acceptance Criteria

  • In a repo with >=2 detected languages, --by-language outputs distinct score blocks per language
  • Each language block follows current score-reporting contract (overall/objective/strict/verified + dimensions)
  • Aggregate + per-language outputs are both available and clearly labeled
  • Per-language scorecard images generated (e.g. scorecard-go.png, scorecard-python.png)
  • status --by-language shows per-language breakdown
  • State interactions are deterministic (per-language scores in dimension_scores_by_language, global scores unchanged)
  • Backwards-compatible schema change (new optional key, absent in existing states)

Closes #140

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: per-language scorecards for mixed-language repositories

1 participant