Contributing#
Setup#
Prerequisites: Go 1.21+
git clone https://github.com/shinagawa-web/colref.git
cd colref
make install-hooksmake install-hooks installs a pre-push hook. Every time you run git push, it automatically runs:
- Lint — golangci-lint
- Unit tests + coverage — unit tests with 100% coverage enforcement (e2e excluded)
- Benchmarks — runs benchmarks; compares against
mainifbenchstatis installed
That’s it for most changes. Write code, push, the hook tells you if anything is broken.
Adding a new detection pattern#
- Add the pattern to the relevant scanner in
internal/ - Add test cases to the pattern battery in
test_patterns/ - Run
make update-goldento regenerate golden files - Run
make test-e2eto verify the pattern battery passes (the pre-push hook does not run e2e) - Update Detection patterns with the new pattern
- Push — the hook runs lint, unit tests, and benchmarks
Submitting changes#
- Open an issue before starting non-trivial work
- Keep PRs focused — one logical change per PR
- All tests must pass; coverage must stay at 100%
Running checks manually#
If you need to run individual checks without pushing:
make static-lint # lint only
make test # unit tests
make test-e2e # end-to-end tests
make check-coverage # tests + 100% coverage enforcement
make bench # benchmarks
make update-golden # regenerate golden files