Skip to content

Commit c11a081

Browse files
authored
⚙️ lint (#127)
<!-- Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. SPDX-License-Identifier: Proprietary --> ### Description Upgrade the linting ### Test Coverage <!-- Please put an `x` in the correct box e.g. `[x]` to indicate the testing coverage of this change. --> - [x] This change is covered by existing or additional automated tests. - [ ] Manual testing has been performed (and evidence provided) as automated testing was not feasible. - [ ] Additional tests are not required for this change (e.g. documentation update).
1 parent 10c6a00 commit c11a081

File tree

8 files changed

+64
-49
lines changed

8 files changed

+64
-49
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ jobs:
7171
working-directory: ${{ matrix.go-module }}
7272
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
7373
name: Linting
74-
uses: golangci/golangci-lint-action@v6
74+
uses: golangci/golangci-lint-action@v8
7575
with:
7676
# Required: the version of golangci-lint is required and must be specified without patch version.
7777
version: latest
7878
working-directory: ${{ matrix.go-module }}
79-
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"
79+
args: "--verbose --output.text.print-issued-lines --output.text.print-linter-name --output.tab.colors --max-issues-per-linter 0 --max-same-issues 0"
8080
- name: Test ${{ matrix.go-module }} on ${{ matrix.os }}
8181
run: go test -race -cover -v ./...
82-
working-directory: ${{ matrix.go-module }}
82+
working-directory: ${{ matrix.go-module }}

.golangci.yaml

Lines changed: 54 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,65 @@
1+
version: "2"
12
run:
2-
timeout: 10m
3-
4-
# Run linters over integration tests
53
build-tags:
64
- integration
7-
85
linters:
9-
disable-all: true # Disable defaults, then enable the ones we want
6+
default: none
107
enable:
8+
- bodyclose
119
- errcheck
12-
- gosimple
10+
- gocritic
11+
- gosec
1312
- govet
1413
- ineffassign
14+
- misspell
15+
- revive
1516
- staticcheck
16-
- typecheck
17+
- unconvert
1718
- unused
18-
- bodyclose
19-
- stylecheck
20-
- gosec
21-
- goimports
19+
settings:
20+
misspell:
21+
locale: UK
22+
extra-words:
23+
- typo: sanetisation
24+
correction: sanitisation
25+
- typo: sanetise
26+
correction: sanitise
27+
- typo: sanetising
28+
correction: sanitising
29+
revive:
30+
rules:
31+
- name: exported
32+
arguments:
33+
- disableStutteringCheck
34+
severity: warning
35+
disabled: false
36+
exclusions:
37+
generated: lax
38+
presets:
39+
- comments
40+
- common-false-positives
41+
- legacy
42+
- std-error-handling
43+
paths:
44+
- third_party$
45+
- builtin$
46+
- examples$
47+
formatters:
48+
enable:
2249
- gci
23-
- revive
24-
- gocritic
25-
- unconvert
26-
- misspell
27-
28-
linters-settings:
29-
goimports:
30-
local-prefixes: github.com/ARM-software
31-
gci:
32-
sections:
33-
- Standard
34-
- Default
35-
- Prefix(github.com/ARM-software)
36-
revive:
37-
rules:
38-
- name: exported
39-
severity: warning
40-
disabled: false
41-
arguments:
42-
- "disableStutteringCheck"
43-
misspell:
44-
locale: UK
45-
extra-words:
46-
- typo: "sanetisation"
47-
correction: "sanitisation"
48-
- typo: "sanetise"
49-
correction: "sanitise"
50-
- typo: "sanetising"
51-
correction: "sanitising"
50+
- goimports
51+
settings:
52+
gci:
53+
sections:
54+
- Standard
55+
- Default
56+
- Prefix(github.com/ARM-software)
57+
goimports:
58+
local-prefixes:
59+
- github.com/ARM-software
60+
exclusions:
61+
generated: lax
62+
paths:
63+
- third_party$
64+
- builtin$
65+
- examples$

changes/202510241630.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:builder: Upgrade the linting

utils/client/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func NewClient(cfg *http.RequestConfiguration, logger logr.Logger, underlyingHTT
4242

4343
func newClientConfiguration(cfg *http.RequestConfiguration) (clientCfg *_client.Configuration) {
4444
clientCfg = _client.NewConfiguration()
45-
if !reflection.IsEmpty(cfg.Target.Host) {
46-
basePathURL, err := url.Parse(cfg.Target.Host)
45+
if !reflection.IsEmpty(cfg.Host) {
46+
basePathURL, err := url.Parse(cfg.Host)
4747
if err == nil {
4848
clientCfg.Host = basePathURL.Host
4949
clientCfg.Scheme = basePathURL.Scheme

utils/job/manager_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func TestManager_BrowseMessages(t *testing.T) {
199199
assert.NotNil(t, messagePaginator)
200200
count := 0
201201
for {
202-
if !messagePaginator.HasNext() {
202+
if !messagePaginator.HasNext() { //nolint:staticcheck
203203
break
204204
}
205205
message, subErr := messagePaginator.GetNext()

utils/messages/testing_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func Test_NewMockNotificationFeedPage(t *testing.T) {
2525
it, err := page.GetItemIterator()
2626
require.NoError(t, err)
2727
for {
28-
if !it.HasNext() {
28+
if !it.HasNext() { //nolint:staticcheck
2929
break
3030
}
3131
next, err := it.GetNext()

utils/pagination/page_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestToPage(t *testing.T) {
105105
itback, err := mappedBack.GetItemIterator()
106106
require.NoError(t, err)
107107
for {
108-
if !it.HasNext() {
108+
if !it.HasNext() { //nolint:staticcheck
109109
break
110110
}
111111
assert.True(t, itback.HasNext())

utils/pagination/stream_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func TestToStream(t *testing.T) {
101101
itBack, err := mappedBack.GetItemIterator()
102102
require.NoError(t, err)
103103
for {
104-
if !it.HasNext() {
104+
if !it.HasNext() { //nolint:staticcheck
105105
break
106106
}
107107
assert.True(t, itBack.HasNext())

0 commit comments

Comments
 (0)