Skip to content

Integrate pre-commit hooks #1120

@powerslider

Description

@powerslider

Description

Integrate pre-commit hooks to provide fast, local feedback, align developer workflows with CI, and prevent committing formatting/lint violations or invalid files. Include a filtering layer so hooks don’t touch upstream-sourced code, binaries, or intentionally invalid fixtures.

Why?

  • Fast feedback before CI.
  • Consistent formatting and static analysis across contributors.
  • Prevent accidental commits of invalid files (e.g., malformed JSON).
  • Gradual hardening: run strict rules on changed code without churning upstream areas.

What to integrate

  • Baseline Go linting at pre-commit:
  • golangci-lint v1 with .golangci.yml (stable, repo-wide)
  • Strict linting: extra golangci-lint via scripts/lint.sh at pre-commit (change-scoped). Check ci: Enable extra linters #1117.
  • [OPTIONAL]: Full repo suite via scripts/lint.sh at pre-push (mirrors CI).
  • General hooks from pre-commit:
    • trailing-whitespace
    • end-of-file-fixer
    • check-merge-conflict
    • check-yaml
    • check-toml
    • check-json
  • Markdown formatting:
    • mdformat with mdformat-gfm and mdformat-frontmatter for GFM (Github Format) tables and frontmatter.

File Filtering Requirements

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions