Skip to content

Commit 11440b6

Browse files
committed
Use linting rules from topaz and update formatting with gofumpt
1 parent 8ba9f1c commit 11440b6

19 files changed

Lines changed: 95 additions & 72 deletions

File tree

.golangci.yaml

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,54 +28,56 @@ linters:
2828
- wrapcheck
2929

3030
settings:
31+
cyclop:
32+
max-complexity: 12
33+
34+
errcheck:
35+
exclude-functions:
36+
- fmt.Fprint
37+
- fmt.Fprintf
38+
- fmt.Fprintln
39+
- os.Close
40+
41+
funlen:
42+
lines: 80
43+
statements: 60
44+
ignore-comments: true
45+
46+
gomoddirectives:
47+
replace-local: true
48+
49+
gosec:
50+
excludes:
51+
- G104 # Errors unhandled
52+
- G304 # Potential file inclusion via variable (see https://github.com/golang/go/issues/67002)
53+
3154
ireturn:
3255
allow:
3356
- error
3457
- empty
58+
- stdlib
3559
- generic
3660
- proto.Message
37-
- plugins.Plugin
38-
- stdlib
3961
- v3.ImporterClient
40-
gomoddirectives:
41-
replace-local: true
62+
4263
lll:
43-
line-length: 140 # a lot of parameter lines over 130 characters
44-
dupl:
45-
threshold: 100
46-
funlen:
47-
lines: 100
48-
statements: 80
49-
ignore-comments: true
50-
goconst:
51-
min-len: 2
52-
min-occurrences: 2
53-
gocritic:
54-
enabled-tags:
55-
- diagnostic
56-
- experimental
57-
- opinionated
58-
- performance
59-
- style
60-
disabled-checks:
61-
- dupImport # https://github.com/go-critic/go-critic/issues/845
62-
- ifElseChain
63-
- octalLiteral
64-
- whyNoLint
65-
- wrapperFunc
66-
cyclop:
67-
max-complexity: 12
68-
govet:
69-
settings:
70-
printf:
71-
funcs:
72-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
73-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
74-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
75-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
76-
misspell:
77-
locale: US
78-
nolintlint:
79-
allow-unused: false # report any unused nolint directives
80-
require-explanation: false # don't require an explanation for nolint directives
81-
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
64+
line-length: 150
65+
66+
recvcheck:
67+
exclusions:
68+
- "*.Map"
69+
70+
tagliatelle:
71+
case:
72+
rules:
73+
json: snake
74+
yaml: snake
75+
76+
exclusions:
77+
generated: lax
78+
79+
formatters:
80+
enable:
81+
- gofmt
82+
- gofumpt
83+
- goimports

plugins/auth0/pkg/app/constants.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package app
22

3-
const AppName = "ds-load-auth0"
4-
const AppDescription = "auth0 directory loader"
3+
const (
4+
AppName = "ds-load-auth0"
5+
AppDescription = "auth0 directory loader"
6+
)
57

68
const auth0prefix string = "auth0|"

plugins/azuread/pkg/app/cli.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ func (cmd *VersionCmd) Run() error {
3232
}
3333

3434
func createAzureAdClient(ctx context.Context,
35-
tenant, clientID, clientSecret, refreshToken string) (*azureclient.AzureADClient, error) {
35+
tenant, clientID, clientSecret, refreshToken string,
36+
) (*azureclient.AzureADClient, error) {
3637
if refreshToken != "" {
3738
return azureclient.NewAzureADClientWithRefreshToken(
3839
ctx,
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
package app
22

3-
const AppName = "ds-load-azuread"
4-
const AppDescription = "AzureAD directory loader"
3+
const (
4+
AppName = "ds-load-azuread"
5+
AppDescription = "AzureAD directory loader"
6+
)

plugins/azuread/pkg/azureclient/credential.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ type RefreshTokenCredential struct {
2323
}
2424

2525
func NewRefreshTokenCredential(ctx context.Context,
26-
tenantID, clientID, clientSecret, refreshToken string) (*RefreshTokenCredential, error) {
26+
tenantID, clientID, clientSecret, refreshToken string,
27+
) (*RefreshTokenCredential, error) {
2728
c := &RefreshTokenCredential{
2829
clientID: clientID,
2930
clientSecret: clientSecret,

plugins/azureadb2c/pkg/app/cli.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ func (cmd *VersionCmd) Run() error {
3232
}
3333

3434
func createAzureAdClient(ctx context.Context,
35-
tenant, clientID, clientSecret, refreshToken string) (*azureclient.AzureADClient, error) {
35+
tenant, clientID, clientSecret, refreshToken string,
36+
) (*azureclient.AzureADClient, error) {
3637
if refreshToken != "" {
3738
return azureclient.NewAzureADClientWithRefreshToken(
3839
ctx,
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
package app
22

3-
const AppName = "ds-load-azureadb2c"
4-
const AppDescription = "AzureAD B2C directory loader"
3+
const (
4+
AppName = "ds-load-azureadb2c"
5+
AppDescription = "AzureAD B2C directory loader"
6+
)

plugins/azureadb2c/pkg/azureclient/credential.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ type RefreshTokenCredential struct {
2323
}
2424

2525
func NewRefreshTokenCredential(ctx context.Context,
26-
tenantID, clientID, clientSecret, refreshToken string) (*RefreshTokenCredential, error) {
26+
tenantID, clientID, clientSecret, refreshToken string,
27+
) (*RefreshTokenCredential, error) {
2728
c := &RefreshTokenCredential{
2829
clientID: clientID,
2930
clientSecret: clientSecret,
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
package app
22

3-
const AppName = "ds-load-cognito"
4-
const AppDescription = "Cognito directory loader"
3+
const (
4+
AppName = "ds-load-cognito"
5+
AppDescription = "Cognito directory loader"
6+
)
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
package app
22

3-
const AppName = "ds-load-fusionauth"
4-
const AppDescription = "FusionAuth directory loader"
3+
const (
4+
AppName = "ds-load-fusionauth"
5+
AppDescription = "FusionAuth directory loader"
6+
)

0 commit comments

Comments
 (0)