diff options
author | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-03-15 07:44:27 +0300 |
---|---|---|
committer | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-03-15 09:28:15 +0300 |
commit | 85f0e3b96709d5a6dc5b0219b3d057b83e11729c (patch) | |
tree | f877e64101f1fdd1b7408ff3256cc2b8223e6e4d /tools/golangci-lint/gitaly/quote_test.go | |
parent | 8eb2d65be9607663316e0939d2550fa22df98ea0 (diff) |
lint: Move custom linter settings to .golangci.yml file
In a prior change
(https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5398), we added
the support for custom linters on top of golangci-lint. In the first
iteration, all settings for them are put in the implemenation file.
This commit moves those settings to the manifeset file, along side with
other linter settings.
golangci-lint doesn't support an official way to load the settings in
de-facto manifest file `.golangci.yml`. Fortunately, we can hook into
configuration parsing library `viper` that golangci-lint uses. Our
custom linters are loaded at the end, just before executing the
commands. At this time, golangci-lint established some state that stores
the configuration. This state is process global, and accessible in our
source code. In the future, if this approach doesn't work anymore, we
can consider parsing the configuration file ourselves.
Diffstat (limited to 'tools/golangci-lint/gitaly/quote_test.go')
-rw-r--r-- | tools/golangci-lint/gitaly/quote_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/golangci-lint/gitaly/quote_test.go b/tools/golangci-lint/gitaly/quote_test.go index 9ba749288..7d262b5de 100644 --- a/tools/golangci-lint/gitaly/quote_test.go +++ b/tools/golangci-lint/gitaly/quote_test.go @@ -15,8 +15,8 @@ func TestQuoteInterpolationAnalyzer(t *testing.T) { } testdata := filepath.Join(wd, "testdata") - analyzer := NewQuoteInterpolationAnalyzer([]string{ + analyzer := newQuoteInterpolationAnalyzer("eInterpolationAnalyzerSettings{IncludedFunctions: []string{ "fmt.*", - }) + }}) analysistest.Run(t, testdata, analyzer, "quote") } |