Skip to content

feat: add console output options, sorting and debug summary - #12

Merged
floriankraemer merged 3 commits into
mainfrom
feat/console-output
Nov 12, 2026
Merged

floriankraemer merged 3 commits into
mainfrom
feat/console-output

Conversation

@floriankraemer

Copy link
Copy Markdown
Owner

Summary

  • analyse prints Config: and Cache: header lines, Found N files. Starting analysis., and a progress line on stderr only when running on a terminal.
  • Tables per class (Class:/File:, classes sorted by name) or a single All Methods (N total) table with a leading Class column (groupByClass).
  • Columns follow showDetailedCognitiveMetrics, showHalsteadComplexity, showCyclomaticComplexity and showUnderstandability; showOnlyMethodsExceedingThreshold hides methods at or below scoreThreshold.
  • Colors through picocli Ansi AUTO (off without a terminal, NO_COLOR honoured) from the score, Halstead and risk thresholds.
  • --sort-by (all PHP fields plus understandability), --sort-order asc|desc with the PHP validation messages; the sorted order is passed on to the reports.
  • --debug prints stage timings (config, discovery, analysis, sorting, output) and statistics (files found/analysed/failed, methods, cache hits/misses); the clock is injectable.
  • TextTable now pads cells by one space and ignores ANSI codes when measuring widths, so the churn table changes slightly too.
  • Docs: README and docs/Configuration.md describe the console options; the "not yet applied" note is reduced to customReporters.
  • The extra columns of baseline deltas and coverage have a marked hook in ResultTableBuilder.columns().

Test plan

  • ./mvnw -B verify green (JaCoCo line 96.7%, branch 97.0%; PIT 636 of 638 mutations killed)
  • ApprovalTests golden files for default, all metrics, cyclomatic only, Halstead only, understandability, minimal, without detail columns, single table, threshold filter and sorted single table
  • Sorter unit tests for every field, both directions, case handling, tie-break, invalid field and order
  • E2E tests for the header lines, progress, colors with Ansi forced on, sort validation, sorted report order and the debug summary with a fixed ticker
  • Smoke test of the jar on a pseudo-terminal: colors and progress appear, NO_COLOR removes the colors

Print the Config/Cache header, the file count and a progress line on a
terminal. Render one table per class or a single table, with the columns
chosen by the show* settings, colored by their thresholds. Add --sort-by,
--sort-order and --debug with per-stage timings and statistics.
Strip trailing zeros from weights, draw row separators only for tables
with multi-line body cells, and share the terminal check between the init
and analyse commands.
Write the progress line to the terminal itself, only when interactive, and
clear it before warnings and failures. Count East Asian wide characters
as two columns and combining marks as none when aligning tables.
@floriankraemer
floriankraemer merged commit 377c1a7 into main Nov 12, 2026
1 check passed
@floriankraemer
floriankraemer deleted the feat/console-output branch November 12, 2026 18:37
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.

1 participant