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 從公開儲存庫中收錄這些內容。

檢舉或申請下架