zshellcheck

module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2025 License: MIT

README

    ____  __          __               __   ______          __
   / __ \/ /_  ____  / /_  ____ ______/ /__/ ____/___  ____/ /__
  / /_/ / __ \/ __ \/ __ \/ __ `/ ___/ //_/ /   / __ \/ __  / _ \
 / ____/ / / / /_/ / / / / /_/ / /__/ ,< / /___/ /_/ / /_/ /  __/
/_/   /_/ /_/\____/_/ /_/\__,_/\___/_/|_|\____/\____/\__,_/\___/
  

ZShellCheck

Your wise sensei for clean, fast, and safe Zsh.

CI Status Go Version License GitHub Stars

Why ZShellCheck?

Zsh is a powerful, feature-rich shell, but its complexity can lead to subtle bugs, performance issues, and hard-to-maintain scripts. While bash has ShellCheck, Zsh has lacked a dedicated, modern static analysis tool that understands its unique syntax and semantics. ZShellCheck fills this gap, providing a friendly "sensei" to guide you toward writing better Zsh code.

Show, Don't Tell

(Animated GIF of ZShellCheck in action will be here)

Here are a few examples of how ZShellCheck helps you improve your Zsh code.

❌ Before (The "Confused Grasshopper")

# Example 1: Incorrect array access
my_array=(one two three)
echo $my_array[1] # This doesn't do what you think!

# Example 2: Using legacy command substitution
files=`ls *.zsh`

# Example 3: Unsafe use of '['
if [ $ZSH_VERSION > 5.0 ]; then
  echo "Modern Zsh"
fi

✅ After (The "Enlightened Master")

# Example 1: Correct array access
my_array=(one two three)
echo $my_array[1] # ZShellCheck: [ZC1001] Use ${my_array[1]} for array element access.
echo ${my_array[1]}

# Example 2: Using modern command substitution
files=$(ls *.zsh) # ZShellCheck: [ZC1002] Use $(...) instead of backticks for command substitution.

# Example 3: Safe and powerful '[['
if [[ $ZSH_VERSION > 5.0 ]]; then # ZShellCheck: [ZC1003] Prefer [[...]] over [...] for modern Zsh tests.
  echo "Modern Zsh"
fi

Installation

(Coming soon)

Homebrew (macOS)

brew install afadesigns/zshellcheck/zshellcheck

Go

go install github.com/afadesigns/zshellcheck/cmd/zshellcheck@latest

From Binary

Download the latest release from the Releases page.

The Dojo (Usage)

zshellcheck your_script.zsh

Learn the Katas (Rules)

ZShellCheck uses a system of "Katas" (rules) to teach you better Zsh. Each Kata has a unique ID and a detailed explanation.

➡️ See the full list of Katas in our Wiki

Directories

Path Synopsis
cmd
zshellcheck command
pkg
ast

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL