Keep this session's splits shfmt-clean

analyze_repo.sh was shfmt-clean at 133fccf and my split made it dirty
(a double blank line). Fixed with shfmt -w, then restored the STEP 1
comment banner shfmt -w also stripped -- all eight banners re-counted.

The three new shell_check libs inherited their parent's 2-space
indentation; as new files they have no prior style to preserve, so they
are now tabs like shfmt wants.

Context for the exit code: 157 of 298 linux_configuration shell files
already fail shfmt at 133fccf. shfmt is not in .pre-commit-config.yaml
and there is no .editorconfig, so run_linters exiting 1 on the full tree
is the repo's standing state, not a regression here. Scoped this commit
to what these splits touched rather than reformatting 157 files.

Also closes the risk left open in a84556a: run_linters now verified
directly over the three new libs -- all six passes PASS, exit 0 -- with
install_linters never invoked, so decision 6 holds. That is the path
.github/workflows/shell-check.yml runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
This commit is contained in:
Krzysztof Rudnicki 2026-08-16 22:05:01 +02:00
parent 936e0ec70d
commit 1b19808edb
6 changed files with 335 additions and 265 deletions

View File

@ -0,0 +1,18 @@
{
"title": "Make the files this session's splits touched shfmt-clean",
"objective": "Ensure the 250-line splits landed in 41cc045, a84556a and 936e0ec do not add new shfmt violations to linux_configuration, whose shell_check.sh run_linters pass compares every discovered script against shfmt's default formatting.",
"acceptance_criteria": [
"shfmt -d reports no diff for analyze_repo.sh and for the three new lib/shell_check_*.sh files.",
"shellcheck still reports zero findings across every file this session created or modified.",
"analyze_repo.sh still runs to completion (exit 0) against a fixture repo and still produces artifacts byte-identical to the pre-split original at 133fccf.",
"shell_check.sh --skip-install --list-only --verbose still discovers 321 files.",
"The STEP 1 comment banner that shfmt -w stripped from analyze_repo.sh is restored, so all eight STEP banners are present.",
"No file that was already shfmt-dirty before this session is reformatted; the change is scoped to what these splits touched."
],
"out_of_scope": [
"Reformatting the 157 of 298 linux_configuration shell files that already fail shfmt at 133fccf. That drift predates this session and fixing it is a repo-wide formatting decision, not a line-count split.",
"Making shell_check.sh itself shfmt-clean: it was already dirty at 133fccf, uses 2-space indentation throughout, and reformatting it would rewrite the whole file rather than the seam.",
"Adding shfmt to .pre-commit-config.yaml or introducing an .editorconfig."
],
"verifier": "shfmt -d over the four files (expects no output), shellcheck over every file this session touched (expects zero findings), a stubbed end-to-end run of analyze_repo.sh against a fixture repo diffed artifact-by-artifact against the 133fccf run, and shell_check.sh --skip-install --list-only --verbose piped to a line count (expects 321)."
}

View File

@ -0,0 +1,52 @@
{
"intent": "Stop this session's splits from adding new shfmt violations, after discovering that analyze_repo.sh went from shfmt-clean to shfmt-dirty when it was split.",
"scope": [
"linux_configuration/scripts/single_use/utils/analyze_repo.sh",
"linux_configuration/scripts/meta/lib/shell_check_{discover,install,lint}.sh",
"Non-goal: the 157 pre-existing shfmt-dirty files, and shell_check.sh itself, which was already dirty at 133fccf"
],
"changes": [
"Ran shfmt -w on analyze_repo.sh to remove the double blank line the split introduced, then restored the STEP 1 comment banner that shfmt -w also stripped, so all eight STEP banners are intact.",
"Ran shfmt -w on the three new shell_check libs, converting them from the 2-space indentation they inherited from their parent to shfmt's default tabs. They are new files, so there is no prior style to preserve."
],
"verification": [
{
"command": "shfmt -d on the four files",
"result": "pass",
"evidence": "No diff for analyze_repo.sh or any of the three shell_check libs. Before this commit, analyze_repo.sh was the only file this session made newly dirty: a check against 133fccf confirmed it was clean there and shell_check.sh was already dirty there."
},
{
"command": "count of shfmt-dirty .sh files at 133fccf",
"result": "pass",
"evidence": "157 of 298. This establishes that run_linters exiting 1 on the full tree is the repository's pre-existing state and not a regression from these splits; shfmt is not in .pre-commit-config.yaml and there is no .editorconfig, so the default tab style has never been enforced."
},
{
"command": "shellcheck over every file this session touched",
"result": "pass",
"evidence": "Zero findings. Reformatting did not reintroduce any of the SC2034 / SC2154 / SC2086 / SC2153 findings cleared earlier."
},
{
"command": "stubbed end-to-end run of analyze_repo.sh against a fixture repo, artifacts diffed against the 133fccf run",
"result": "pass",
"evidence": "Exit 0, and every artifact except the binary cscope index is byte-identical to the pre-split original. Re-run after reformatting to confirm shfmt -w changed no behaviour."
},
{
"command": "bash scripts/meta/shell_check.sh --skip-install --list-only --verbose | grep -c '^ - '",
"result": "pass",
"evidence": "321, unchanged after the libs were reformatted."
},
{
"command": "run_linters exercised directly over the three shell_check libs, with install_linters never invoked",
"result": "pass",
"evidence": "All six passes (shellcheck, shfmt, checkbashisms, bash -n, zsh -n, sh/dash -n) report PASS and run_linters exits 0. This verifies the CI path from .github/workflows/shell-check.yml, which was the outstanding risk recorded in the shell_check split's evidence."
}
],
"risks": [
"run_linters over the whole linux_configuration tree still exits 1, because of the 157 pre-existing shfmt-dirty files. That is unchanged by this commit and was true before this session started.",
"shfmt -w is a mechanical rewrite and removed a comment banner in analyze_repo.sh without being asked; the banner was restored by hand and all eight STEP headers were re-counted. Any future use of shfmt -w on a commented file deserves the same check."
],
"rollback": [
"git revert this commit; the four files return to their previous indentation and analyze_repo.sh regains the double blank line.",
"After rollback, re-run the fixture comparison to confirm analyze_repo.sh still exits 0, since the rollback touches formatting only."
]
}

View File

@ -72,7 +72,6 @@ BLUE='\033[0;34m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
#============================================================================== #==============================================================================
# Libraries # Libraries
#============================================================================== #==============================================================================
@ -92,6 +91,7 @@ install_missing_tools
# Create directories # Create directories
mkdir -p "$WORK_DIR" "$RESULTS_DIR" mkdir -p "$WORK_DIR" "$RESULTS_DIR"
#==============================================================================
# STEP 1: Clone or Use Local Repository # STEP 1: Clone or Use Local Repository
#============================================================================== #==============================================================================
print_header "STEP 1: Repository Setup" print_header "STEP 1: Repository Setup"