Skip to content

Language Support

void-filter provides per-language formatting and linting. Configuration in config/hooks.jsonlanguages.

Language Matrix

Language Formatter Linter Config File Include Patterns Exclude Patterns
Go goimports golangci-lint .go vendor/, *.pb.go
C/C++ clang-format cppcheck .clang-format.yml, .clang-tidy .c, .cpp, .h, .hpp, .cc, .cxx build/, third_party/
Python ruff format ruff check ruff.toml .py .venv/, __pycache__/
JavaScript/TS prettier eslint .prettierrc, .eslintrc .js, .ts, .jsx, .tsx node_modules/, dist/
Shell shfmt shellcheck .shellcheckrc .sh, .bash

How It Works

  1. pre-commit hook identifies staged files
  2. Matches file extensions against include_patterns
  3. Skips files matching exclude_patterns
  4. Runs formatter first (auto-fixes, re-stages)
  5. Runs linter (blocks commit on errors)

Configuration

Per-language settings in config/hooks.json:

"go": {
  "enabled": true,
  "formatter": "goimports",
  "linter": "golangci-lint",
  "lint_args": ["run", "--fast"],
  "include_patterns": [".+\\.go$"],
  "exclude_patterns": ["vendor/", "*.pb.go"]
}

Adding a New Language

  1. Add entry to config/hooks.jsonlanguages
  2. Specify formatter and linter commands
  3. Define include/exclude regex patterns
  4. Install the tools on your system
  5. The pre-commit hook auto-detects the new language

Tool Configuration Files

File Purpose Location
.clang-format.yml C++ formatting rules repo root
.clang-tidy C++ static analysis repo root
ruff.toml Python linter/formatter config repo root
.shellcheckrc ShellCheck options repo root
.yamllint.yml YAML lint rules repo root
.editorconfig Editor-agnostic formatting repo root
Tools/Git/Lint/configs/ruff.toml Lint-specific ruff override Tools/Git/Lint/configs/
Tools/Git/Lint/configs/yamllint.yml Lint-specific YAML override Tools/Git/Lint/configs/