Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e73754b
chore(lint): copy shared golangci config
niko-kriznik-globtim Sep 29, 2026
0f5de4a
chore: adopt shared pre-commit hooks
niko-kriznik-globtim Sep 29, 2026
9c16caf
ci: lint only new issues and fail closed on secret scans
niko-kriznik-globtim Sep 29, 2026
3bcd091
chore: pick up shared lint hook fixes
niko-kriznik-globtim Sep 29, 2026
bee9190
fix(lint): make the shared golangci config load
niko-kriznik-globtim Sep 29, 2026
cb3818c
fix(ci): use a valid detect-secrets audit flag
niko-kriznik-globtim Sep 29, 2026
b5c8517
chore(lint): sync shared golangci config and ruleguard rules
niko-kriznik-globtim Oct 19, 2026
94356d4
chore: pin shared hooks to ci-templates cdcceba over HTTPS
niko-kriznik-globtim Oct 19, 2026
bd9726e
fix(ci): make the detect-secrets check fail on new secrets
niko-kriznik-globtim Oct 19, 2026
4958d4d
chore(secrets): refresh baseline for findings already on main
niko-kriznik-globtim Oct 19, 2026
e6b526c
ci: run golangci-lint v2.12.2 with lint-action v9
niko-kriznik-globtim Oct 19, 2026
d7ea444
build(lint): move to golangci-lint v2.14 and ci-templates 7850271
niko-kriznik-globtim Oct 19, 2026
d2c7f27
fix(ci): fail the secrets check only on new secrets
niko-kriznik-globtim Oct 19, 2026
cc7cf26
ci: lint new issues against the merge base with main
niko-kriznik-globtim Oct 19, 2026
5139a0b
build(lint): pin ci-templates c766412
niko-kriznik-globtim Oct 19, 2026
5a5e218
build(lint): pin ci-templates 70dee10
niko-kriznik-globtim Oct 19, 2026
50127cf
fix(ci): fail the secrets check when there are no files to scan
niko-kriznik-globtim Oct 19, 2026
ab4c176
build(lint): pin ci-templates 7b12191
niko-kriznik-globtim Oct 19, 2026
387fafc
ci: lint against the parent commit on main and tags
niko-kriznik-globtim Oct 19, 2026
8d36e27
build(lint): pin ci-templates 62b8b95
niko-kriznik-globtim Oct 20, 2026
cbb4917
build(lint): pin ci-templates c1d25f4
niko-kriznik-globtim Oct 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -96,9 +98,12 @@ jobs:
run: $(go env GOPATH)/bin/staticcheck ./...

- name: golangci-lint
uses: golangci/golangci-lint-action@v8
uses: golangci/golangci-lint-action@v9
with:
version: v2.10.1
version: v2.14.0
# The merge base works for every event, unlike only-new-issues. On main and on
# tags it is HEAD itself, so compare with the parent commit there.
args: ${{ (github.ref_type == 'tag' || github.ref_name == 'main') && '--new-from-rev=HEAD~1' || '--new-from-merge-base=origin/main' }}

- name: Run JSON tags camelCase check
run: make check-json-tags
Expand Down Expand Up @@ -127,19 +132,17 @@ jobs:

- name: Install detect-secrets
run: |
pip install detect-secrets
pip install detect-secrets==1.5.0

- name: Detect secrets
run: |
echo "🔍 Scanning for secrets..."
if command -v detect-secrets >/dev/null 2>&1; then
detect-secrets scan --baseline .secrets.baseline --all-files || echo "Secret detection completed with findings"
if [ -f ".secrets.baseline" ]; then
detect-secrets audit .secrets.baseline --statistics || echo "Baseline audit completed"
fi
else
echo "detect-secrets not available, skipping secret scan (basic validation will still run)"
fi
set -euo pipefail
mapfile -d '' files < <(git ls-files -z)
[ "${#files[@]}" -gt 0 ] || { echo "::error::git ls-files returned no files"; exit 1; }
# Exit 1 means new secrets. Exit 3 only means baselined line numbers moved.
rc=0
detect-secrets-hook --baseline .secrets.baseline "${files[@]}" || rc=$?
[ "$rc" -eq 0 ] || [ "$rc" -eq 3 ]
Comment thread
niko-kriznik-globtim marked this conversation as resolved.

test:
name: Test (matrix)
Expand Down
29 changes: 29 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "2"
linters:
enable: [exhaustive, errorlint, noctx, forbidigo, gocritic]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
settings:
errorlint: {errorf: true, asserts: true, comparison: true}
exhaustive: {check: [switch, map]}
forbidigo:
analyze-types: true
forbid:
- {pattern: '^os\.Exit$', msg: "return an error; exit only from main.go, or add //nolint:forbidigo // <reason>"}
- {pattern: '^log\.Fatal(f|ln)?$', msg: "return an error; exit only from main.go, or add //nolint:forbidigo // <reason>"}
- {pattern: '^zap\.(Logger|SugaredLogger)\.Fatal(f|w|ln)?$', pkg: '^go\.uber\.org/zap$', msg: "Fatal calls os.Exit and skips shutdown; return an error"}
- {pattern: '^uuid\.MustParse$', pkg: '^github\.com/google/uuid$', msg: "MustParse panics on bad input; use uuid.Parse and return InvalidArgument"}
- {pattern: '^otlp\w+\.WithInsecure$', msg: "plaintext OTLP exporter; make it a config opt-in or add //nolint:forbidigo // <reason>"}
- {pattern: '^http\.DefaultClient$', pkg: '^net/http$', msg: "DefaultClient has no timeout; use a client with Timeout"}
gocritic:
disable-all: true
enabled-checks: [ruleguard]
settings:
ruleguard:
rules: '${base-path}/lint/rules.go'
failOn: dsl,import
exclusions:
generated: lax
paths: ['api/oas_.*', 'gen/']
rules:
- {path: '_test\.go$', linters: [forbidigo, gocritic, errorlint, noctx]}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- {path: '(^|/)main\.go$', linters: [forbidigo], text: 'os\.Exit|Fatal'}
- {path: '(^|/)(seed|test)/', linters: [forbidigo], text: 'MustParse'}
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,19 @@ repos:
- id: go-fmt
- id: go-imports
- id: no-go-testing
- id: golangci-lint
# - id: go-unit-tests

- repo: https://github.com/golangci/golangci-lint
rev: v2.14.0
hooks:
- id: golangci-lint-config-verify
- id: golangci-lint

- repo: https://github.com/truvami/ci-templates
rev: c1d25f499c933042579e1fc01dee3d74f7f4b89c # pragma: allowlist secret
hooks:
- id: detect-secrets-fail-closed

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
Expand Down
Loading
Loading