From f37072f8fc388c8e9bd7bdf4a9bc2269e225a5b0 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 17 Nov 2023 13:46:38 +1300 Subject: [PATCH] ci: enforce that `cachedregexp` is always used instead of `regexp` (#663) I did this as a bit of an exercise in how to configure linting a bit more - while not critical, might as well have it and should help with external contributors e.g. it'll flag #658 --- .golangci.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.golangci.yaml b/.golangci.yaml index 8e214124c5..752d96d422 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -30,7 +30,6 @@ linters: - testpackage # will re-add later (another-rex) - goerr113 # will re-add later (another-rex) - nonamedreturns # disagree with, for now (another-rex) - - depguard # not necessary at the moment (another-rex) presets: - bugs - comment @@ -42,6 +41,16 @@ linters: - unused linters-settings: + depguard: + rules: + regexp: + files: + - '!**/internal/cachedregexp/**' + - '!**/main_test.go' + deny: + - pkg: 'regexp' + desc: + 'Use github.com/google/osv-scanner/internal/cachedregexp instead' gocritic: disabled-checks: - ifElseChain