Skip to content

Suggestion to Add ShellCheck static analysis for all shell scripts #21

@DonRichards

Description

@DonRichards

Description
The repository includes several .sh files, but there is no automated shell‑script linting. Adding ShellCheck to the workflow will catch common bugs (missed set -e, unquoted variables, etc.) before they reach production.

Proposed change

  1. Add a CI step (or Makefile target) that runs ShellCheck inside the official Docker image

    # lint‑shell.sh
    docker run --rm -v "$(pwd)":/mnt koalaman/shellcheck:latest $(git ls-files '*.sh')
  2. Include the script in the existing GitHub Actions workflow

    - name: ShellCheck
      run: ./lint-shell.sh

    If the project doesn’t use Actions yet, this can be a separate workflow or invoked locally via make lint-shell.

  3. Fail the build on ShellCheck warnings to keep the main branch clean.

Benefits

  • Detects syntax errors and unsafe patterns early.
  • Enforces consistent, POSIX‑compliant shell code across contributors.

Suggestion

  • CI fails when any .sh file triggers a ShellCheck warning.
  • Documentation updated with make lint-shell (or equivalent) instructions.

I noticed some of my code submitted had shellcheck issues so I thought I'd add this as a suggestion. Happy to open a PR if the maintainers agree!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions