API: group prettyReport files by generator with fileLimit option#143
Merged
API: group prettyReport files by generator with fileLimit option#143
Conversation
- Add filesByGenerator to GenerationReport, populated per-generator in executeGenerators - Render prettyReport as per-generator sections with file counts and loc totals - Fall back to an "other" group for any files not attributed to a generator
- When a generator produces more than fileLimit files (default 20), aggregate by directory with file count and loc per dir instead of listing every file - Keeps per-file listing for smaller groups
- Show one decimal for kloc below 10k (e.g. 1.5 kloc) to avoid up-to-33% rounding error on small buckets
- Drop redundant filesByGenerator field. Merge grouping into filesGenerated as Record<generator, Record<path, content>> so content and generator attribution live in one place - prettyReport iterates the nested shape directly; no extra maps or per-path bookkeeping - executeGenerators merges output into filesGenerated[gen.name] so repeated calls with the same generator name (e.g. two .introspection(...)) accumulate instead of overwriting - Fix stale debug log (result.filesGenerated.length was always undefined) to count across generators - Update docs/guides/testing-generators.md to show the new access pattern
- Access files as result.filesGenerated[<generator>] (with non-null assertion since a generator may not have run) - Introduce a local \`files\` constant per describe block to keep assertions readable - Update file-count for introspection TypeSchema output (45 → 44) now that the implicit ir-report README.md lives under filesGenerated["ir-report"] - Regenerate introspection snapshots to reflect the introspection-only file list (README.md moved out)
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.
Report structure
filesByGenerator: Record<string, string[]>toGenerationReport, populated per-generator inexecuteGenerators.prettyReportrenders one section per generator with its own file count and loc total; unattributed files fall into anothergroup.New
fileLimitoptionprettyReport(report, { fileLimit })— default20.fileLimit, files are aggregated by directory (count + loc per dir) instead of listing every file, keeping the output compact for large generators.LOC formatting precision
formatLocno longer collapses everything>= 1000to an integer kloc (which was up to ~33% off for small buckets).< 1000→N loc1000–9999→N.N kloc(one decimal)>= 10000→N klocBefore / after
Before:
After (small group — listed per file):