|
| 1 | +--- |
| 2 | +id: zsh_lint |
| 3 | +title: 🔍 Zsh Lint |
| 4 | +sidebar_position: 1 |
| 5 | +description: A Go-based semantic analyzer for Zsh. |
| 6 | +keywords: |
| 7 | + - zsh-lint |
| 8 | + - linter |
| 9 | + - zsh |
| 10 | + - go |
| 11 | +--- |
| 12 | + |
| 13 | +{/* @format */} |
| 14 | + |
| 15 | +## A Go-based semantic analyzer for Zsh |
| 16 | + |
| 17 | +`zsh-lint` is a standalone Go semantic analyzer for Zsh. It parses Zsh sources |
| 18 | +with a real grammar front end and reports greppable diagnostics from its default |
| 19 | +static-analysis rules. |
| 20 | + |
| 21 | +### <i class="fa-brands fa-github"></i> [z-shell/zsh-lint][] |
| 22 | + |
| 23 | +### Installation |
| 24 | + |
| 25 | +```sh |
| 26 | +go install github.com/z-shell/zsh-lint/cmd/zsh-lint@latest |
| 27 | +``` |
| 28 | + |
| 29 | +### Usage |
| 30 | + |
| 31 | +```sh |
| 32 | +zsh-lint path/to/file.zsh another.zsh |
| 33 | +``` |
| 34 | + |
| 35 | +Diagnostics use the `path:line:col: [rule-id] message` format. Parse errors, |
| 36 | +warnings, and errors produce a non-zero exit code. |
| 37 | + |
| 38 | +For parser-gap corpus evaluation without static-analysis rules, use the |
| 39 | +dedicated survey command: |
| 40 | + |
| 41 | +```sh |
| 42 | +zsh-lint-survey path/to/file.zsh another.zsh |
| 43 | +``` |
| 44 | + |
| 45 | +### Reference |
| 46 | + |
| 47 | +{/* zsh-lint:generated:start */} |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +#### zsh\-lint |
| 52 | + |
| 53 | + import "github.com/z-shell/zsh-lint/cmd/zsh-lint" |
| 54 | + |
| 55 | +Command zsh\-lint performs static analysis of Zsh shell scripts. |
| 56 | + |
| 57 | +##### Index |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +#### zsh\-lint\-survey |
| 62 | + |
| 63 | + import "github.com/z-shell/zsh-lint/cmd/zsh-lint-survey" |
| 64 | + |
| 65 | +Command zsh\-lint\-survey runs the parser front end across Zsh files and reports parser gaps without evaluating static\-analysis rules. |
| 66 | + |
| 67 | +##### Index |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +#### survey |
| 72 | + |
| 73 | + import "github.com/z-shell/zsh-lint/internal/survey" |
| 74 | + |
| 75 | +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. |
| 76 | + |
| 77 | +This is the reboot's parser\-evaluation surface \(issues \#5, \#8\): it reports parser outcomes only and intentionally implements no lint rules yet. |
| 78 | + |
| 79 | +##### Index |
| 80 | + |
| 81 | +- [func Run\(names \[\]string, w io.Writer\) int](#func-run) |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +##### func Run |
| 86 | + |
| 87 | + func Run(names []string, w io.Writer) int |
| 88 | + |
| 89 | +Run parses each file in names, writing per\-file status and a summary to w. |
| 90 | + |
| 91 | +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. |
| 92 | + |
| 93 | +It returns a process exit code: 0 if every file parsed, 1 otherwise. |
| 94 | + |
| 95 | +Generated by [gomarkdoc](https://github.com/princjef/gomarkdoc) |
| 96 | + |
| 97 | +{/* zsh-lint:generated:end */} |
| 98 | + |
| 99 | +{/* end-of-file */} |
| 100 | +{/* links */} |
| 101 | +{/* external */} |
| 102 | + |
| 103 | +[z-shell/zsh-lint]: https://github.com/z-shell/zsh-lint |
0 commit comments