Skip to main content

A static analysis tool for zsh shell scripts

Project description

ZshCheck

ZshCheck - Static Analysis for Zsh

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zshshellcheck-0.2.1.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zshshellcheck-0.2.1-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file zshshellcheck-0.2.1.tar.gz.

File metadata

  • Download URL: zshshellcheck-0.2.1.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zshshellcheck-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9f4d91e29a1a5a9c3ef574b41e5835acae0c0e28068b16dfcbe944e8c40995e2
MD5 20b23ff65fb815143500ed928fbefcab
BLAKE2b-256 53520b565e7eb5e4fba815f5cb5812637154adc6d687a488510173dda823a135

See more details on using hashes here.

File details

Details for the file zshshellcheck-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: zshshellcheck-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zshshellcheck-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 259e23879383770a444ccb87ea10d7efa07acb4f03fed962532732a038d74dc1
MD5 6123f14e2924e98ae3ceda78a4c108b1
BLAKE2b-256 acaf3b5c8da98488f2564bb7b47f5d188db340629621461fb52d20861bdfacfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page