Skip to main content

🔍 Zsh Lint

A Go-based semantic analyzer for Zsh

zsh-lint is being rebooted as a Go semantic analyzer for Zsh. It parses Zsh sources with a real grammar front end and reports problems. It currently operates as a parser survey — reporting which files the parser accepts — and does not implement lint rules yet.

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

Each file gets an OK/FAIL line; failures include a greppable path:line:col: message. The exit code is 0 only if every file parsed.

Reference

zsh-lint

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

Command zsh-lint surveys Zsh files with the mvdan/sh parser front end and reports parse success or failure per file (reboot parser-evaluation phase, issues #5, #8). Lint rule diagnostics (issue #18) build on this foundation.

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