Uh oh!
There was an error while loading. Please reload this page.
refactor(reports): split src/reports.sh into a src/reports/ module - #937
Merged
Conversation
Third module under ADR-010, and the first built to the amended `index.sh`
convention from the start. 434 lines and 18 functions become six files behind a
`source`-only entry point.
The seam is the one the file already had: a shared result store, and one writer
per output format.
reports/collect.sh the 7 _BASHUNIT_REPORTS_TEST_* arrays, is_enabled,
add_test and the six add_test_* wrappers
reports/junit.sh __xml_escape, generate_junit_xml
reports/tap.sh __tap_message, generate_report_tap
reports/json.sh __json_escape, generate_report_json
reports/gha.sh __gha_encode, print_gha_annotations, generate_gha_log
reports/html.sh generate_report_html
All 12 internal call edges stay inside their file: no writer calls another, and
each escaper is used by exactly one format, so each travels with its format
rather than into a shared helpers file. Layering is collect -> {junit, tap,
json, gha, html}, one level deep. The responsibility map was posted on #931
before any code moved.
A relocation. The non-blank line multiset differs only by the new shebangs,
module headers and aggregator `source` lines, and the function count is 18
before and after. The built artifact is not byte-identical this time -- grouping
each format's functions together reorders definitions relative to the old
single-file order -- but the sorted code content of the artifact is identical,
and reordering top-level function definitions is safe because the entrypoint
sources every file before anything is invoked. Verified there is no file-scope
statement outside collect.sh's array initialisers.
The file-wide `# shellcheck disable=SC2155` moved to the two files that actually
trigger it (junit.sh, html.sh) rather than being dropped or applied to all six.
Related #931
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 freeto 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.
🤔 Background
Related #931
Third module under ADR-010, and the first built to the amended
index.shconvention from the start. The responsibility map was posted on #931 before any code moved.💡 Changes
The seam is the one the file already had — a shared result store, and one writer per output format:
reports/collect.sh_BASHUNIT_REPORTS_TEST_*arrays,is_enabled,add_test, the sixadd_test_*wrappersreports/junit.sh__xml_escape,generate_junit_xmlreports/tap.sh__tap_message,generate_report_tapreports/json.sh__json_escape,generate_report_jsonreports/gha.sh__gha_encode,print_gha_annotations,generate_gha_logreports/html.shgenerate_report_htmlAll 12 internal call edges stay inside their file: no writer calls another, and each escaper is used by exactly one format, so each travels with its format rather than into a shared helpers file. Layering is
collect → {junit, tap, json, gha, html}, one level deep.The file-wide
# shellcheck disable=SC2155moved to the two files that actually trigger it (junit.sh,html.sh) rather than being dropped or blanket-applied to all six.✅ Verification
A relocation: the non-blank line multiset differs only by the new shebangs, module headers and aggregator
sourcelines; function count is 18 before and after.The built artifact is not byte-identical this time — grouping each format's functions together reorders definitions relative to the old single-file order. The sorted code content of the artifact is identical, and reordering top-level function definitions is safe because the entrypoint sources every file before anything is invoked. I verified no file-scope statement exists outside
collect.sh's array initialisers.Also checked end-to-end that JUnit/JSON/TAP still emit correct output, and ran the ADR-010 trap checklist:
git check-ignoreclean, no.editorconfigper-file rule lost, no line over 120, CI-mode ShellCheck (per file, no-x) clean.Green: sequential ·
--parallel·--parallel --simple --strict·make sa·make lint·bash build.sh.