Skip to content

chore(scripts): apply shfmt and fix shellcheck warnings in scripts/bash - #4806

Open
jlec wants to merge 1 commit into
github:mainfrom
jlec:chore/4805-shell-lint
Open

jlec wants to merge 1 commit into
github:mainfrom
jlec:chore/4805-shell-lint

Conversation

@jlec

@jlec jlec commented Oct 1, 2026 •

Copy link
Copy Markdown

Description

Closes #4805. Fixes the 3 SC2155 warnings, silences SC1091 with # shellcheck source=/dev/null, and formats the six scripts/bash/*.sh files with shfmt. Adds switch_case_indent = true for shell files to .editorconfig so shfmt keeps the existing case indentation (diff +126/-50 instead of about +273/-198 with shfmt's default). CI is untouched; tightening lint.yml can follow.

Testing

  • shellcheck at default severity: 8 findings before, 0 after. shfmt -d: clean.

  • Minified shfmt output of before vs after differs only in the 3 SC2155 declare/assign splits.

  • The shell-related tests (test_check_prerequisites*, test_create_new_feature*, test_resolve_template*, test_setup_plan*, test_setup_tasks*, test_command_template_py_scripts) give identical results on main and on this branch: 11 failed, 227 passed, 99 skipped. The 11 failures all occur on unmodified main, in the composed-template tests.

  • Behavior note: the SC2155 splits mean a failing command substitution in those 3 assignments is no longer masked by local. Under set -e that could now abort where it previously continued, which is the intent of the rule.

  • Ran existing tests with uv sync && uv run pytest (shell-related subset only, in the worktree's own venv)

  • Tested locally with uv run specify --help

  • Tested with a sample project (if applicable)

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

AI disclosure: Agent: Claude Code. Model: Claude Sonnet 5.5, run autonomously on behalf of @jlec, who directed each step (fork, issue, branch, edits, PR). The agent wrote the code changes, ran the checks above, and drafted this PR and #4805. The commit carries an Assisted-by: trailer.

馃 Generated with Claude Code

@jlec
jlec requested a review from mnriem as a code owner October 1, 2026 07:17
@jlec
jlec force-pushed the chore/4805-shell-lint branch from 535dc9f to 17730c1 Compare October 1, 2026 07:20
Fix the three SC2155 warnings by declaring and assigning separately, so
command substitution failures are no longer masked. Add
"# shellcheck source=/dev/null" above each "source common.sh" to clear
SC1091. Format all six scripts with shfmt, with switch_case_indent
enabled in .editorconfig so existing case indentation is preserved.

Beyond the three SC2155 splits, the scripts are unchanged: minified
shfmt output of before and after differs only in those lines.

Refs github#4805

Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Justin Lecher <justin@jlec.de>
@jlec
jlec force-pushed the chore/4805-shell-lint branch from 17730c1 to 7bc35e7 Compare October 1, 2026 07:26
@mnriem mnriem added the triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate label Oct 1, 2026
@mnriem
mnriem requested a balanced review from Copilot October 1, 2026 17:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

馃煝 Approval recommended

The focused lint and formatting changes preserve valid Bash syntax and introduce no unresolved issues.

Review effort: Balanced
Findings: None

What changed in this PR

Formats Bash scripts with shfmt and resolves reported shellcheck warnings without changing CI configuration.

Changes:

  • Adds shfmt case-indentation configuration.
  • Adds dynamic-source annotations and fixes SC2155 assignments.
  • Applies consistent shell formatting across six scripts.
File Description
.editorconfig Configures shell case indentation.
scripts/鈥媌ash/鈥媍ommon.sh Fixes SC2155 and applies formatting.
scripts/鈥媌ash/鈥媍heck-prerequisites.sh Adds source annotation and formatting.
scripts/鈥媌ash/鈥媍reate-new-feature.sh Fixes SC2155, annotates source, and formats.
scripts/鈥媌ash/鈥媟esolve-template.sh Adds source annotation and formatting.
scripts/鈥媌ash/鈥媠etup-plan.sh Adds source annotation and formatting.
scripts/鈥媌ash/鈥媠etup-tasks.sh Adds source annotation and formatting.

馃挕 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: apply shfmt and fix shellcheck warnings in scripts/bash

3 participants