From 4e8324f6fa99e8879394eba200149db387a57124 Mon Sep 17 00:00:00 2001 From: Adrien CABARBAYE Date: Fri, 24 Oct 2025 16:29:44 +0100 Subject: [PATCH 1/4] :gear: lint --- .golangci.yaml | 94 +++++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 40 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index c1f23b7..dc1082f 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,51 +1,65 @@ +version: "2" run: - timeout: 10m - - # Run linters over integration tests build-tags: - integration - linters: - disable-all: true # Disable defaults, then enable the ones we want + default: none enable: + - bodyclose - errcheck - - gosimple + - gocritic + - gosec - govet - ineffassign + - misspell + - revive - staticcheck - - typecheck + - unconvert - unused - - bodyclose - - stylecheck - - gosec - - goimports + settings: + misspell: + locale: UK + extra-words: + - typo: sanetisation + correction: sanitisation + - typo: sanetise + correction: sanitise + - typo: sanetising + correction: sanitising + revive: + rules: + - name: exported + arguments: + - disableStutteringCheck + severity: warning + disabled: false + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: - gci - - revive - - gocritic - - unconvert - - misspell - -linters-settings: - goimports: - local-prefixes: github.com/ARM-software - gci: - sections: - - Standard - - Default - - Prefix(github.com/ARM-software) - revive: - rules: - - name: exported - severity: warning - disabled: false - arguments: - - "disableStutteringCheck" - misspell: - locale: UK - extra-words: - - typo: "sanetisation" - correction: "sanitisation" - - typo: "sanetise" - correction: "sanitise" - - typo: "sanetising" - correction: "sanitising" + - goimports + settings: + gci: + sections: + - Standard + - Default + - Prefix(github.com/ARM-software) + goimports: + local-prefixes: + - github.com/ARM-software + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ From 3d578c5a6aaa195b7226ada102db6b8bdc3ce775 Mon Sep 17 00:00:00 2001 From: Adrien CABARBAYE Date: Fri, 24 Oct 2025 16:30:39 +0100 Subject: [PATCH 2/4] Create 202510241630.misc --- changes/202510241630.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/202510241630.misc diff --git a/changes/202510241630.misc b/changes/202510241630.misc new file mode 100644 index 0000000..19f80a5 --- /dev/null +++ b/changes/202510241630.misc @@ -0,0 +1 @@ +:builder: Upgrade the linting From 5a1191e4afeb2c9334768d43837470d76bb3d878 Mon Sep 17 00:00:00 2001 From: Adrien CABARBAYE Date: Fri, 24 Oct 2025 16:32:03 +0100 Subject: [PATCH 3/4] Update build-and-test.yml --- .github/workflows/build-and-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 1021628..9ca4db0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -71,12 +71,12 @@ jobs: working-directory: ${{ matrix.go-module }} - if: ${{ startsWith(matrix.os, 'ubuntu') }} name: Linting - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: # Required: the version of golangci-lint is required and must be specified without patch version. version: latest working-directory: ${{ matrix.go-module }} - args: "--verbose --print-issued-lines --print-linter-name --out-${NO_FUTURE}format colored-line-number --timeout 300s --max-issues-per-linter 0 --max-same-issues 0" + args: "--verbose --output.text.print-issued-lines --output.text.print-linter-name --output.tab.colors --max-issues-per-linter 0 --max-same-issues 0" - name: Test ${{ matrix.go-module }} on ${{ matrix.os }} run: go test -race -cover -v ./... - working-directory: ${{ matrix.go-module }} \ No newline at end of file + working-directory: ${{ matrix.go-module }} From 28e720a3ae4d5bae0a37e8fc22f8ca844295700f Mon Sep 17 00:00:00 2001 From: Adrien CABARBAYE Date: Fri, 24 Oct 2025 17:12:39 +0100 Subject: [PATCH 4/4] :green_heart: linting --- utils/client/client.go | 4 ++-- utils/job/manager_test.go | 2 +- utils/messages/testing_test.go | 2 +- utils/pagination/page_test.go | 2 +- utils/pagination/stream_test.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/client/client.go b/utils/client/client.go index 5ace300..d85666d 100644 --- a/utils/client/client.go +++ b/utils/client/client.go @@ -42,8 +42,8 @@ func NewClient(cfg *http.RequestConfiguration, logger logr.Logger, underlyingHTT func newClientConfiguration(cfg *http.RequestConfiguration) (clientCfg *_client.Configuration) { clientCfg = _client.NewConfiguration() - if !reflection.IsEmpty(cfg.Target.Host) { - basePathURL, err := url.Parse(cfg.Target.Host) + if !reflection.IsEmpty(cfg.Host) { + basePathURL, err := url.Parse(cfg.Host) if err == nil { clientCfg.Host = basePathURL.Host clientCfg.Scheme = basePathURL.Scheme diff --git a/utils/job/manager_test.go b/utils/job/manager_test.go index e5ed036..640f893 100644 --- a/utils/job/manager_test.go +++ b/utils/job/manager_test.go @@ -199,7 +199,7 @@ func TestManager_BrowseMessages(t *testing.T) { assert.NotNil(t, messagePaginator) count := 0 for { - if !messagePaginator.HasNext() { + if !messagePaginator.HasNext() { //nolint:staticcheck break } message, subErr := messagePaginator.GetNext() diff --git a/utils/messages/testing_test.go b/utils/messages/testing_test.go index 4ae922c..a3de816 100644 --- a/utils/messages/testing_test.go +++ b/utils/messages/testing_test.go @@ -25,7 +25,7 @@ func Test_NewMockNotificationFeedPage(t *testing.T) { it, err := page.GetItemIterator() require.NoError(t, err) for { - if !it.HasNext() { + if !it.HasNext() { //nolint:staticcheck break } next, err := it.GetNext() diff --git a/utils/pagination/page_test.go b/utils/pagination/page_test.go index 2aedc48..95811d2 100644 --- a/utils/pagination/page_test.go +++ b/utils/pagination/page_test.go @@ -105,7 +105,7 @@ func TestToPage(t *testing.T) { itback, err := mappedBack.GetItemIterator() require.NoError(t, err) for { - if !it.HasNext() { + if !it.HasNext() { //nolint:staticcheck break } assert.True(t, itback.HasNext()) diff --git a/utils/pagination/stream_test.go b/utils/pagination/stream_test.go index 2d3013e..2cb29c8 100644 --- a/utils/pagination/stream_test.go +++ b/utils/pagination/stream_test.go @@ -101,7 +101,7 @@ func TestToStream(t *testing.T) { itBack, err := mappedBack.GetItemIterator() require.NoError(t, err) for { - if !it.HasNext() { + if !it.HasNext() { //nolint:staticcheck break } assert.True(t, itBack.HasNext())