MCPcopy Index your code
hub / github.com/afadesigns/zshellcheck

github.com/afadesigns/zshellcheck @v1.7.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.7.1 ↗ · + Follow
4,725 symbols 15,424 edges 135 files 784 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ZShellCheck

The quiet linter for a quiet shell.

Static analysis and auto-fix for the setopts, hooks, and globs Bash never learned.

CI Release Marketplace Auto-fix Dependencies Go Report codecov Scorecard OpenSSF Best Practices SLSA

Install · User guide · Katas · Integrations · Roadmap · Changelog


See it in action

ZShellCheck demo

Install

# macOS, Linux, WSL
curl -fsSL https://raw.githubusercontent.com/afadesigns/zshellcheck/main/install.sh | bash
# Windows
irm https://raw.githubusercontent.com/afadesigns/zshellcheck/main/install.ps1 | iex
# Anywhere Go is installed
go install github.com/afadesigns/zshellcheck/cmd/zshellcheck@latest

--uninstall reverses any of them.

Native .deb, .rpm, .apk, and a multi-arch container at ghcr.io/afadesigns/zshellcheck ship on every release tag.

Pinning, cosign verification, and distro one-liners are in INSTALL.md.

Run

# Lint
zshellcheck path/to/script.zsh

# Write SARIF for GitHub Code Scanning
zshellcheck -severity warning -format sarif ./scripts > zshellcheck.sarif

# Preview every auto-fix as a unified diff
zshellcheck -diff path/to/script.zsh

# Apply the fixes
zshellcheck -fix path/to/script.zsh

Exits 0 on a clean run, 1 when anything was flagged. zshellcheck -h lists every flag, grouped by intent.

Silence inline with # noka: ZC1234. Bare # noka silences every kata on the line. Trailing, preceding, and file-wide forms are documented in USER_GUIDE.md.

CI/CD

The published action checks out your repository, installs a signed release binary, runs it, and fails the job on any finding. Add the SARIF upload to surface results in the repository Security tab:

# .github/workflows/lint.yml
name: zshellcheck
on: [push, pull_request]
permissions:
  contents: read
  security-events: write
jobs:
  zshellcheck:
    runs-on: ubuntu-latest
    steps:
      - uses: afadesigns/zshellcheck@latest
        with:
          args: -format sarif -severity warning ./scripts > zshellcheck.sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: zshellcheck.sarif

Run it as a pre-commit hook instead:

# .pre-commit-config.yaml
-   repo: https://github.com/afadesigns/zshellcheck
    rev: latest
    hooks:
      - id: zshellcheck

Pin @latest and rev: latest to a tag from Releases for reproducible CI.

Integrations

ZShellCheck is verified against widely used Zsh frameworks, plugin managers, plugins, and prompts on every release. The pinned corpus matrix runs a parse-and-findings sweep: zero parser errors, zero crashes, and kata findings locked to a reviewed baseline. The heaviest trees are swept manually; the full catalog with file counts lives in INTEGRATIONS.md.

Category Examples
Frameworks oh-my-zsh, prezto, prezto-contrib, zephyr, zimfw
Plugin managers antidote, zinit
Plugins zsh-syntax-highlighting, zsh-autosuggestions, zsh-autocomplete, atuin, zsh-help
Prompts powerlevel10k, spaceship-prompt, starship, gitstatus
Tooling fzf, fzf-tab, fast-syntax-highlighting

Quality

Every release replays the linter over the pinned integration corpora and gates on:

  • Parser errors and crashes stay at zero.
  • Kata findings match a reviewed baseline; a new finding on known-good code fails the build as a candidate false positive.
  • Auto-fixes round-trip cleanly: applying every fix to a corpus file never raises its parser-error count and always converges, so a rewrite cannot corrupt working code.

Semantic-preserving rewrites — added blank lines, comments, or variable renames — must not change which katas fire. See the local checks for the commands.

Documentation

Use it

  • INSTALL.md — install and uninstall paths for macOS, Windows, Linux, and Docker.
  • USER_GUIDE.md — CLI reference, configuration, inline directives, FAQ.
  • KATAS.md — every kata with description, severity, and auto-fix status.
  • INTEGRATIONS.md — verified Zsh frameworks, plugins, and prompts.

Develop with it

  • DEVELOPER.md — architecture, AST reference, kata authoring, auto-fix catalog.
  • REFERENCE.md — governance, glossary, ShellCheck comparison.
  • ROADMAP.md — LSP, distribution channels, plugin system.
  • CHANGELOG.md — per-release history.

Contribute

Contributing

Contributions of all kinds are welcome. Start with CONTRIBUTING.md.

License

ZShellCheck is licensed under the MIT License.

Credits

Authored and maintained by Andreas Fahl (@afadesigns). Inspired by ShellCheck.

Website GitHub LinkedIn Instagram Facebook

Extension points exported contracts — how you extend this code

Node (Interface)
Node represents a node in the AST. [39 implementers]
pkg/ast/ast.go
Reporter (Interface)
Reporter defines the interface for reporting violations. [1 implementers]
pkg/reporter/reporter.go
Statement (Interface)
Statement represents a statement in the AST. [17 implementers]
pkg/ast/ast.go
Expression (Interface)
Expression represents an expression in the AST. [38 implementers]
pkg/ast/ast.go
WalkFn (FuncType)
WalkFn is a function that will be called for each node in the AST. It returns true if the children of the node should be
pkg/ast/ast.go

Core symbols most depended-on inside this repo

String
called by 1481
pkg/ast/ast.go
Check
called by 1035
pkg/testutil/testing.go
RegisterKata
called by 1014
pkg/katas/katas.go
AssertViolations
called by 1005
pkg/testutil/testing.go
peekTokenIs
called by 281
pkg/parser/parser.go
New
called by 268
pkg/lexer/lexer.go
nextToken
called by 250
pkg/parser/parser.go
New
called by 235
pkg/parser/parser.go

Shape

Function 4,199
Method 432
Struct 83
Interface 6
FuncType 3
TypeAlias 2

Languages

Go100%
Python1%

Modules by API surface

pkg/katas/zc1000s.go279 symbols
pkg/ast/ast.go231 symbols
pkg/katas/zc1900s.go229 symbols
pkg/katas/zc1800s.go225 symbols
pkg/parser/parser_test.go189 symbols
pkg/fix/integration_test.go182 symbols
pkg/katas/zc1700s.go172 symbols
pkg/katas/zc1200s.go156 symbols
pkg/katas/zc1400s.go152 symbols
pkg/katas/zc1600s.go146 symbols
pkg/parser/parser_coverage_test.go142 symbols
pkg/katas/zc1500s.go142 symbols

Datastores touched

(mongodb)Database · 1 repos
dbDatabase · 1 repos
(mysql)Database · 1 repos

For agents

$ claude mcp add zshellcheck \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page