Skip to content

fix: resolve shellcheck warnings in test and packaging scripts#518

Merged
andy5995 merged 6 commits intomasterfrom
fix-shellcheck
Mar 25, 2026
Merged

fix: resolve shellcheck warnings in test and packaging scripts#518
andy5995 merged 6 commits intomasterfrom
fix-shellcheck

Conversation

@andy5995
Copy link
Copy Markdown
Member

  • Add missing shebang to doinst.sh (SC2148)
  • Quote variables throughout to prevent word splitting/globbing (SC2086)
  • Replace echo "\n" with printf for escape sequences (SC2028)
  • Replace backticks with $() (SC2006)
  • Replace expr with $(()) arithmetic (SC2003)
  • Replace [ ! $(grep ...) ] with ! grep -q (SC2143)
  • Replace ls | wc -l with find | wc -l (SC2012)
  • Replace printf "---\n" with echo for plain separator lines (SC3045)

All scripts remain POSIX/dash compatible.

- Add missing shebang to doinst.sh (SC2148)
- Quote variables throughout to prevent word splitting/globbing (SC2086)
- Replace echo "\n" with printf for escape sequences (SC2028)
- Replace backticks with $() (SC2006)
- Replace expr with $(()) arithmetic (SC2003)
- Replace [ ! $(grep ...) ] with ! grep -q (SC2143)
- Replace ls | wc -l with find | wc -l (SC2012)
- Replace printf "---\n" with echo for plain separator lines (SC3045)

All scripts remain POSIX/dash compatible.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@andy5995 andy5995 added this to the v0.9.5 milestone Mar 25, 2026
andy5995 and others added 5 commits March 24, 2026 21:06
- Quote $(id -u) to prevent word splitting (SC2046)
- Replace [ -n "$(mount | grep ...)" ] with mount | grep -q (SC2143)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add shell directive to COMMON (SC2148)
- Quote variables, fix backticks/expr, fix -o in [ ] (SC2086/SC2006/SC2003/SC2166)
- Fix pattern expansion quoting in cmp_substr (SC2295)
- Quote basename argument (SC2086)
- Fix broken echo strings in error message
- Remove unused TESTS_DIR variable
- Add SC2034 disable comments for variables used by sourcing scripts
- Update SHELLCHECK_OPTS path to test/ so shellcheck can follow COMMON source

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SHELLCHECK_OPTS used $GITHUB_WORKSPACE which GitHub Actions does not
expand in env: blocks. SCRIPTDIR is shellcheck's built-in token that
resolves to the directory of the script being checked, so shellcheck
can find COMMON alongside each test script without a hardcoded path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The OpenSUSE Tumbleweed CI container does not have 'find' in PATH.
Revert to the original ls -A approach and suppress SC2012 since
filenames in the waste folder are controlled and the count is reliable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@andy5995 andy5995 merged commit ebf2c74 into master Mar 25, 2026
14 of 15 checks passed
@andy5995 andy5995 deleted the fix-shellcheck branch March 25, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant