ZshCheck
Uma ferramenta de análise estática para scripts zsh, construída com Python 3.12+.
Funcionalidades
- Parser Tree-sitter: Análise AST precisa usando gramática tree-sitter-zsh
- Checks Plugin-based: Sistema de verificação extensível com padrão registry
- CLI Rico: Saída formatada com tabela, JSON e formatos compactos
- Múltiplos Formatos de Saída: Table, JSON e compacto
- Auto-Fix: Corrige automaticamente problemas detectáveis (--fix flag)
- Suporte a Unicode: Aceita emojis e caracteres não-ASCII em comentários
Instalação
pip install zshshellcheck
Início Rápido
# Analisar um script
zshcheck script.zsh
# Analisar múltiplos arquivos
zshcheck *.zsh
# Listar checks disponíveis
zshcheck --list-checks
# Filtrar por código de check
zshcheck --include ZC1001 --include ZC2001
# Saída em JSON
zshcheck --format json script.zsh
# Auto-fixar problemas (pergunta para cada fix)
zshcheck script.zsh --fix
# Ou usando a flag curta
zshcheck script.zsh -F
Documentação
A documentação completa está disponível em: https://developer.github.io/zshshellcheck/
Limitações Conhecidas
Emojis e Unicode em scripts zsh
O parser tree-sitter-zsh pode apresentar problemas com caracteres unicode em identificadores (nomes de variáveis, funções). Esses caracteres agora são detectados como INFO (ZC9004) em vez de erro, para que você possa decidir se quer ajustar.
Exemplo de warning:
INFO ZC9004 Non-ASCII characters detected (2 found). Found: 'ã' 'é'
Isso aparece como INFO (não blockea a análise) e indica quais caracteres foram encontrados.
Sintaxe zsh avançada
Algumas sintaxes zsh avançadas (como parâmetros de glob qualifiers ${(k)functions}) podem não ser suportadas pelo parser. Recomendamos usar a flag acima para scripts que contenham dessas expressões.
Desenvolvimento
# Executar testes
pytest -v
# Executar linting
ruff check .
# Executar type checking
mypy .
# Verificação completa
ruff check . && mypy . && pytest
Licença
MIT
Metadata
Release files for zshshellcheck 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zshshellcheck-0.2.1.tar.gz | 25.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zshshellcheck-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.2 kB
Release files / zshshellcheck-0.2.1.tar.gz
| Download URL | zshshellcheck-0.2.1.tar.gz |
|---|---|
| Size | 25.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f4d91e29a1a5a9c3ef574b41e5835acae0c0e28068b16dfcbe944e8c40995e2
|
|
BLAKE2b-256 checksum How to use checksums |
53520b565e7eb5e4fba815f5cb5812637154adc6d687a488510173dda823a135
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / zshshellcheck-0.2.1-py3-none-any.whl
| Download URL | zshshellcheck-0.2.1-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
259e23879383770a444ccb87ea10d7efa07acb4f03fed962532732a038d74dc1
|
|
BLAKE2b-256 checksum How to use checksums |
acaf3b5c8da98488f2564bb7b47f5d188db340629621461fb52d20861bdfacfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|