mmmmmm mmmm # ""# ""# mmm # #
#" #" " # mm mmm # # m" " # mm mmm mmm # m
m# "#mmm #" # #" # # # # #" # #" # #" " # m"
m" "# # # #"""" # # # # # #"""" # #"#
##mmmm "mmm#" # # "#mm" "mm "mm "mmm" # # "#mm" "#mm" # "m
ZShellCheck is the definitive static analysis and comprehensive development suite for the entire Zsh ecosystem, meticulously engineered as the full Zsh equivalent of ShellCheck for Bash. It offers intelligent automatic fixes (planned), advanced formatting capabilities, and deep code analysis to deliver unparalleled quality, performance, and reliability for Zsh scripts, functions, and configurations.
ZShellCheck draws significant inspiration from the esteemed ShellCheck project, a powerful static analysis tool for sh/bash scripts. While ZShellCheck is an independent development with a native focus on Zsh's unique syntax and semantics, ShellCheck's commitment to improving shell script quality served as a guiding principle in our mission to provide an equally robust and tailored solution for the Zsh community.
Why use ZShellCheck over ShellCheck? See our Detailed Comparison.
TL;DR: Use ShellCheck for portable scripts (sh/bash). Use ZShellCheck for native Zsh scripts, plugins, and configuration.
- Inspiration
- Comparison
- Features
- Installation
- Usage
- Configuration
- Integrations
- Shell Completions
- Architecture
- Troubleshooting
- Developer Guide
- Documentation
- Changelog
- Contributing
- Governance
- License
- Zsh-Native Parsing: Full understanding and handling of Zsh's unique constructs, including
[[ ... ]],(( ... )), advanced arrays, associative arrays, and parameter expansion modifiers, applicable across scripts, functions, and configuration files. - Extensible Katas: A modular system where rules are implemented as independent "Katas," allowing for easy expansion, customization, and precise control over checks.
- Highly Configurable: Tailor ZShellCheck's behavior to your project's needs by enabling or disabling specific checks via a flexible
.zshellcheckrcconfiguration file. - Seamless Integration: Designed for effortless integration into modern development workflows, supporting
pre-commithooks and continuous integration (CI) pipelines to enforce quality at every stage.
The easiest way to install ZShellCheck is via the automated installer script. It supports Linux and macOS.
This will install the binary, man pages, and shell completions. It detects if you have Go installed; if not, it downloads the latest pre-built binary.
# Clone the repository or download the script
./install.shFeatures:
- Binary Fallback: No Go environment required. Downloads binaries automatically.
- Interactive: GUIDes you through adding
zshellcheckto yourPATHandfpath. - Automated: Use
./install.sh -yfor non-interactive/CI environments. - Version Control: Install a specific version with
./install.sh -v v0.1.0. - Uninstall: Remove cleanly with
./install.sh --uninstall.
If you prefer standard Go tools:
go install github.com/afadesigns/zshellcheck/cmd/zshellcheck@latestFor contributors:
- Clone the repository.
- Run
./install.sh(it detects the source repo and builds locally).
After installation, run ZShellCheck against your Zsh files:
zshellcheck my_script.zsh- Text (default): Human-readable with ANSI colors.
- JSON:
zshellcheck -format json file.zsh - SARIF:
zshellcheck -format sarif file.zsh(Github Security integration)
Add this to your .pre-commit-config.yaml:
- repo: https://github.com/afadesigns/zshellcheck
rev: v0.1.1
hooks:
- id: zshellcheckCustomize checks via .zshellcheckrc. See the Configuration Guide.
See our Integrations Guide for VS Code, Vim, and Neovim setup.
The ./install.sh script installs completions automatically for Zsh and Bash.
Manual Setup (Zsh):
If you installed manually, add the completions/zsh directory to your $fpath:
fpath+=/path/to/zshellcheck/completions/zsh
autoload -Uz compinit && compinitManual Setup (Bash):
Source the script in your .bashrc:
source /path/to/zshellcheck/completions/bash/zshellcheck-completion.bashCurious about how ZShellCheck works under the hood? Check out our Architecture Guide to learn about the Lexer, Parser, AST, and Kata Registry.
Encountering issues? Check our Troubleshooting Guide for solutions to common problems like "command not found" or parser errors.
Want to contribute code? Read our Developer Guide and AST Reference to get started with building, testing, and understanding the codebase.
For a comprehensive list of all implemented Katas (checks), including detailed descriptions, good/bad code examples, and configuration options, please refer to:
👉 KATAS.md
Unsure about a term? Check the Glossary.
See CHANGELOG.md for a history of changes and releases.
Need help? Have a question? Check out our Support Guide.
We welcome contributions! Whether it's adding new Katas, improving the parser, or fixing bugs, your help is appreciated. For detailed instructions, please see CONTRIBUTING.md.
See our Governance Model for information on how this project is managed.
Distributed under the MIT License. See LICENSE for more information.