-
Notifications
You must be signed in to change notification settings - Fork 158
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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
atpre-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
withmdformat-gfm
andmdformat-frontmatter
for GFM (Github Format) tables and frontmatter.
File Filtering Requirements
- Exclude paths in upstream directories defined by non-negated entries in scripts/upstream_files.txt
- Skip directories
- Skip non-text files
- Skip common binary artifacts (e.g., *.bin)
- Exclude intentionally invalid test fixtures from JSON validation like https://github.com/ava-labs/coreth/blob/master/rpc/testdata/invalid-syntax.json
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request