Skip to content

Commit

Permalink
Update golangci.yml (#455)
Browse files Browse the repository at this point in the history
* remove and replace deprecated linters

* update gosec exclusion list

* correct revive var-declaration offences

* add exclusion for revive type stuttering

* update the golangci version in ci

* remove unused sprintf

* fix a big bug in dns.go

* timeout

* add an exclusion

* add a nolint
  • Loading branch information
ptnapoleon authored Dec 9, 2021
1 parent a567915 commit 1a7229c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ executors:
environment:
KUBEBUILDER_VERSION: 3.1.0
KUBEBUILDER_ARCH: amd64
GOLANGCI_LINT_VERSION: 1.25.1
GOLANGCI_LINT_VERSION: 1.43.0
HELM_VERSION: 3.5.4
python:
<<: *working_directory
Expand Down
13 changes: 8 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ linters:
- godox
- gofmt
- goimports
- golint
- goprintffuncname
- gosec
- interfacer
- maligned
- misspell
- nakedret
- prealloc
- revive
- rowserrcheck
- stylecheck
- unconvert
Expand All @@ -47,9 +45,14 @@ issues:
# gosec
- Subprocess launch(ed with variable|ing should be audited)
- Expect file permissions to be 0600 or less
- Blacklisted import `crypto/md5`
- Use of weak cryptographic primitive
- Blocklisted import `crypto/md5`
- weak cryptographic primitive
- weak random number generator
- memory aliasing in for loop
- file inclusion via variable
# stylecheck
- at least one file in a package should have a package comment
# golint
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
# revive
- and that stutters
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ vet:

# Run golangci-lint against code
lint:
golangci-lint run --timeout 2m0s
golangci-lint run --timeout 3m0s

# Generate code
generate: controller-gen
Expand Down
4 changes: 2 additions & 2 deletions cli/chaosli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
)

// Version will be set with the -ldflags option at compile time
var Version string = "v0"
var APILibPath string = fmt.Sprintf("chaosli-api-lib/v1beta1/%v", Version)
var Version = "v0"
var APILibPath = fmt.Sprintf("chaosli-api-lib/v1beta1/%v", Version)
var cfgFile string

// rootCmd represents the base command when called without any subcommands
Expand Down
2 changes: 1 addition & 1 deletion cli/injector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func main() {

// execute command
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
os.Exit(1) //nolint:gocritic
}
}

Expand Down
2 changes: 1 addition & 1 deletion ddmark/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// AllDefinitions contains all marker definitions for this package.
var AllDefinitions []*k8smarkers.Definition
var rulePrefix string = "ddmark:validation:"
var rulePrefix = "ddmark:validation:"

func init() {
addDefinition(Maximum(0), k8smarkers.DescribesField)
Expand Down
2 changes: 1 addition & 1 deletion network/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c dnsClient) Resolve(host string) ([]net.IP, error) {

// compute possible names to resolve
names := append([]string{}, podDNSConfig.NameList(host)...)
names = append([]string{}, nodeDNSConfig.NameList(host)...)
names = append(names, nodeDNSConfig.NameList(host)...)

// do the request on the first configured dns resolver
dnsClient := dns.Client{}
Expand Down
2 changes: 1 addition & 1 deletion network/tc.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func buildCmd(module string, iface string, parent string, handle uint32, kind st

// parent
if parent == "root" {
cmd += fmt.Sprintf(" root")
cmd += " root"
} else {
cmd += fmt.Sprintf(" parent %s", parent)
}
Expand Down

0 comments on commit 1a7229c

Please sign in to comment.