Skip to main content

๐Ÿ” Zsh Lint

A Go-based semantic analyzer for Zshโ€‹

zsh-lint is a standalone Go semantic analyzer for Zsh. It parses Zsh sources with a real grammar front end and reports greppable diagnostics from its default static-analysis rules.

z-shell/zsh-lintโ€‹

Installationโ€‹

go install github.com/z-shell/zsh-lint/cmd/zsh-lint@latest

Usageโ€‹

zsh-lint path/to/file.zsh another.zsh

Diagnostics use the path:line:col: [rule-id] message format. Parse errors, warnings, and errors produce a non-zero exit code.

For parser-gap corpus evaluation without static-analysis rules, use the dedicated survey command:

zsh-lint-survey path/to/file.zsh another.zsh

Referenceโ€‹

zsh-lintโ€‹

import "github.com/z-shell/zsh-lint/cmd/zsh-lint"

Command zsh-lint performs static analysis of Zsh shell scripts.

Indexโ€‹

zsh-lint-surveyโ€‹

import "github.com/z-shell/zsh-lint/cmd/zsh-lint-survey"

Command zsh-lint-survey runs the parser front end across Zsh files and reports parser gaps without evaluating static-analysis rules.

Indexโ€‹

surveyโ€‹

import "github.com/z-shell/zsh-lint/internal/survey"

Package survey runs the parser front end across a set of Zsh files and reports, per file, whether parsing succeeded. It produces greppable `path:line:col: message` diagnostics for failures and a one-line summary.

This is the reboot's parser-evaluation surface (issues #5, #8): it reports parser outcomes only and intentionally implements no lint rules yet.

Indexโ€‹
func Runโ€‹

func Run(names []string, w io.Writer) int

Run parses each file in names, writing per-file status and a summary to w.

Each file produces either an "OK <path>" line or a "FAIL <path>" line followed by a greppable "<path>:<line>:<col>: <message>" diagnostic. A final summary line reports the total number of files surveyed, ok, and failed.

It returns a process exit code: 0 if every file parsed, 1 otherwise.

Generated by gomarkdoc