Skip to content

Commit 62c5697

Browse files
committed
feat: upgrade golangcilint to v2
1 parent 1ea9e93 commit 62c5697

48 files changed

Lines changed: 173 additions & 105 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.golangci.yml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1+
version: "2"
2+
13
linters:
2-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
3-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
4-
disable-all: true
54
enable:
65
- bodyclose
76
- exhaustive
87
- goconst
9-
- gofmt
108
- goprintffuncname
11-
# - gosec
12-
- gosimple
139
- govet
1410
- ineffassign
1511
- misspell
1612
- nakedret
1713
- noctx
1814
- staticcheck
19-
- typecheck
2015
- unconvert
2116
- unparam
2217
- unused
@@ -48,18 +43,20 @@ linters:
4843
- godot
4944
- godox
5045
- nilnil
46+
exclusions:
47+
rules:
48+
- path: cmd\/*
49+
linters:
50+
- forbidigo
5151

52-
linters-settings:
53-
gci:
54-
sections:
55-
- Standard
56-
- Default
57-
- "Prefix(github.com/shopware/shopware-cli)"
58-
59-
issues:
60-
exclude-dirs:
61-
- version
62-
exclude-rules:
63-
- path: cmd\/*
64-
linters:
65-
- forbidigo
52+
formatters:
53+
enable:
54+
- gofmt
55+
- gci
56+
settings:
57+
gci:
58+
sections:
59+
- Standard
60+
- Default
61+
- "Prefix(github.com/shopware/shopware-cli)"
62+

cmd/account/account_producer_extension_info_push.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ func updateStoreInfo(ext *accountApi.Extension, zipExt extension.Extension, cfg
282282
}
283283

284284
func getTranslation[T extension.Translatable](language string, config extension.ConfigTranslated[T]) *T {
285-
if language == "de" {
285+
switch language {
286+
case "de":
286287
return config.German
287-
} else if language == "en" {
288+
case "en":
288289
return config.English
289290
}
290291

cmd/extension/extension_admin_watch.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,18 @@ import (
1212
"strings"
1313
"time"
1414

15-
"github.com/shopware/shopware-cli/shop"
16-
"golang.org/x/net/html"
17-
18-
"github.com/shopware/shopware-cli/internal/asset"
19-
20-
htmlprinter "github.com/shyim/go-htmlprinter"
21-
2215
"github.com/NYTimes/gziphandler"
2316
"github.com/evanw/esbuild/pkg/api"
17+
htmlprinter "github.com/shyim/go-htmlprinter"
2418
"github.com/spf13/cobra"
2519
"github.com/vulcand/oxy/v2/forward"
20+
"golang.org/x/net/html"
2621

2722
"github.com/shopware/shopware-cli/extension"
23+
"github.com/shopware/shopware-cli/internal/asset"
2824
"github.com/shopware/shopware-cli/internal/esbuild"
2925
"github.com/shopware/shopware-cli/logging"
26+
"github.com/shopware/shopware-cli/shop"
3027
)
3128

3229
const schemeHostSeparator = "://"

cmd/project/ci.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ import (
1111
"strings"
1212

1313
"dario.cat/mergo"
14+
"github.com/spf13/cobra"
15+
"golang.org/x/text/language"
16+
1417
"github.com/shopware/shopware-cli/extension"
1518
"github.com/shopware/shopware-cli/internal/packagist"
1619
"github.com/shopware/shopware-cli/internal/phpexec"
1720
"github.com/shopware/shopware-cli/logging"
1821
"github.com/shopware/shopware-cli/shop"
19-
"github.com/spf13/cobra"
20-
"golang.org/x/text/language"
2122
)
2223

2324
// cleanupPaths are paths that are not nesscarry for the production build.
@@ -57,7 +58,7 @@ var projectCI = &cobra.Command{
5758
}
5859

5960
// Remove annoying cache invalidation errors while asset install
60-
os.Setenv("SHOPWARE_SKIP_ASSET_INSTALL_CACHE_INVALIDATION", "1")
61+
_ = os.Setenv("SHOPWARE_SKIP_ASSET_INSTALL_CACHE_INVALIDATION", "1")
6162

6263
shopCfg, err := shop.ReadConfig(projectConfigPath, true)
6364
if err != nil {

cmd/project/platform.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ import (
99
"slices"
1010
"strings"
1111

12+
"github.com/spf13/cobra"
13+
1214
"github.com/shopware/shopware-cli/extension"
1315
"github.com/shopware/shopware-cli/internal/asset"
1416
"github.com/shopware/shopware-cli/logging"
1517
"github.com/shopware/shopware-cli/shop"
16-
"github.com/spf13/cobra"
1718
)
1819

1920
func findClosestShopwareProject() (string, error) {

cmd/project/project.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package project
22

33
import (
4-
"github.com/shopware/shopware-cli/shop"
54
"github.com/spf13/cobra"
5+
6+
"github.com/shopware/shopware-cli/shop"
67
)
78

89
var projectConfigPath string

cmd/project/project_admin_build.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package project
33
import (
44
"path/filepath"
55

6-
"github.com/shopware/shopware-cli/internal/phpexec"
7-
"github.com/shopware/shopware-cli/shop"
6+
"github.com/spf13/cobra"
87

98
"github.com/shopware/shopware-cli/extension"
9+
"github.com/shopware/shopware-cli/internal/phpexec"
1010
"github.com/shopware/shopware-cli/logging"
11-
"github.com/spf13/cobra"
11+
"github.com/shopware/shopware-cli/shop"
1212
)
1313

1414
var projectAdminBuildCmd = &cobra.Command{

cmd/project/project_admin_watch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import (
55
"os/exec"
66
"path"
77

8+
"github.com/spf13/cobra"
9+
810
"github.com/shopware/shopware-cli/extension"
911
"github.com/shopware/shopware-cli/internal/phpexec"
1012
"github.com/shopware/shopware-cli/shop"
11-
"github.com/spf13/cobra"
1213
)
1314

1415
var projectAdminWatchCmd = &cobra.Command{

cmd/project/project_autofix_composer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import (
99
"github.com/charmbracelet/huh"
1010
"github.com/charmbracelet/huh/spinner"
1111
"github.com/charmbracelet/lipgloss"
12+
"github.com/spf13/cobra"
13+
1214
"github.com/shopware/shopware-cli/extension"
1315
"github.com/shopware/shopware-cli/internal/packagist"
1416
"github.com/shopware/shopware-cli/logging"
15-
"github.com/spf13/cobra"
1617
)
1718

1819
var projectAutofixComposerCmd = &cobra.Command{

cmd/project/project_autofix_flex.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import (
66
"path"
77

88
"github.com/charmbracelet/huh"
9+
"github.com/spf13/cobra"
10+
911
"github.com/shopware/shopware-cli/internal/color"
1012
"github.com/shopware/shopware-cli/internal/flexmigrator"
11-
"github.com/spf13/cobra"
1213
)
1314

1415
var projectAutofixFlexCmd = &cobra.Command{

0 commit comments

Comments
 (0)