Split the output renderers into per-domain files#25
Merged
Conversation
output/table.go (715 lines) and output/json.go (252 lines) were two shared monoliths that every domain's rendering had to be threaded through. They're now per-domain files: output/<domain>.go owns that domain's table renderer, JSON report struct, and JSON writer (iam, storage, orphans, cost, network, certs, tags, drift, compliance, lambda, k8s, secrets, audit, inventory, quota, compare, platform). Shared infrastructure moved to: - style.go — lipgloss styles, colorSeverity, formatTags, truncate - jsoncore.go — writeJSON Adding a domain now adds one file instead of editing two shared files. sarif.go is left intact as the cohesive SARIF concern. This is a pure code reorganization with no behavior change, verified two ways: line-conservation (869 non-import code lines in the old files, 869 in the new files, sorted-identical) and the unchanged output test suite (table/json/sarif round-trips) passing. Sub-item 9b of the output-renderer cleanup. The original "runtime FindingRenderer registry" was reframed after empirical review — commands dispatch type-specifically, the renderers have heterogeneous signatures, and the one generic consumer already routes through compare.NormalizeReport, so a uniform registry would cost type safety with no caller that needs it.
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.
What
output/table.go(715 lines) andoutput/json.go(252 lines) were two shared monoliths every domain's rendering threaded through. They're now per-domain files:output/<domain>.goowns that domain's table renderer + JSON report struct + writer (iam, storage, orphans, cost, network, certs, tags, drift, compliance, lambda, k8s, secrets, audit, inventory, quota, compare, platform). Shared infrastructure moved to:style.go— lipgloss styles,colorSeverity,formatTags,truncatejsoncore.go—writeJSONAdding a domain now adds one file instead of editing two shared files.
sarif.gois left intact as the cohesive SARIF concern.Pure move — verified two ways
outputtest suite (table/json/sarif round-trips) passes, plustask build/go test ./.../go vet/golangci-lintall green.Scope note
This is sub-item 9b. The original "runtime
FindingRendererregistry" was reframed after empirical review — commands dispatch type-specifically (compile-time-safe), the renderers have heterogeneous signatures (IAM principal counts, audit*Report, compareCompareResult), and the one generic consumer (report) already routes throughcompare.NormalizeReport— so a uniformany-typed registry would trade type safety for indirection with no caller that needs it. The per-domain file split is the achievable maintainability win.