Shellcheck Configuration

作者 wshobson46891e7e60da无许可证收录于 2026年10月8日更新于 2026年10月8日

Master ShellCheck static analysis configuration and usage for shell script quality. Use when setting up linting infrastructure, fixing code issues, or ensuring script portability.

AI 生成的概览

指导配置和使用 ShellCheck 静态分析,以提升 shell 脚本质量与可移植性。

功能
提供关于配置和运行 ShellCheck 对 shell 脚本进行静态分析的指导,涵盖错误码、警告、规则集以及误报抑制。还涉及将 ShellCheck 集成到 CI/CD 流水线、pre-commit 钩子和编辑器中,并指向一个包含详细模式与示例的参考文件。
适用场景
适用于搭建 shell 脚本检查基础设施、分析现有脚本问题,或统一代码质量标准。也适合将脚本迁移以满足质量门禁,以及针对特定项目需求配置 ShellCheck。
运行要求
仅为说明性内容,不附带脚本。使用该指导需在相应环境中具备 ShellCheck,CI/CD 或编辑器集成则依赖周边工具。

ShellCheck Configuration and Static Analysis

Comprehensive guidance for configuring and using ShellCheck to improve shell script quality, catch common pitfalls, and enforce best practices through static code analysis.

When to Use This Skill

  • Setting up linting for shell scripts in CI/CD pipelines
  • Analyzing existing shell scripts for issues
  • Understanding ShellCheck error codes and warnings
  • Configuring ShellCheck for specific project requirements
  • Integrating ShellCheck into development workflows
  • Suppressing false positives and configuring rule sets
  • Enforcing consistent code quality standards
  • Migrating scripts to meet quality gates

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Run ShellCheck in CI/CD - Catch issues before merging
  2. Configure for your target shell - Don't analyze bash as sh
  3. Document exclusions - Explain why violations are suppressed
  4. Address violations - Don't just disable warnings
  5. Enable strict mode - Use --enable=all with careful exclusions
  6. Update regularly - Keep ShellCheck current for new checks
  7. Use pre-commit hooks - Catch issues locally before pushing
  8. Integrate with editors - Get real-time feedback during development

来源与署名

来源:wshobson/agents位于plugins/shell-scripting/skills/shellcheck-configuration提交46891e7

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架