Skip to content

Commit

Permalink
.golangci.yml: update the the latest version from ci repo
Browse files Browse the repository at this point in the history
Change-Id: I444e4ad6f7f7e32958f2aafe04a69cb9431f766a
  • Loading branch information
elek committed Sep 7, 2022
1 parent 28e6b67 commit 96cbed6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ run:

linters:
enable:
- bidichk # find dangerous bidi unicode symbols
- bodyclose # find unclosed http response bodies
- deadcode # find code that is not used
- dogsled # checks for too many ignored arguments
Expand All @@ -20,7 +21,7 @@ linters:
- gocritic # checks for style, performance issues, and common programming errors
- godot # dots for everything
- goerr113 # check error expressions
- gofumpt # gofmt with stricter formatting requirements
- gofmt # sanity check formatting
- goprintffuncname # checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
- govet # check standard vet rules
- importas # verify that imports are consistent
Expand All @@ -34,21 +35,29 @@ linters:
- revive # check standard linting rules
- staticcheck # comprehensive checks
- structcheck # check for unused struct parameters
- tenv # ensure we use t.SetEnv instead of os.SetEnv
- unconvert # remove unnecessary conversions
- varcheck # find unused global variables and constants
- wastedassign
#TODO#- nilnil # needs fixes; checks that we don't return a nil and no-error
#TODO#- forcetypeassert # needs work to replace unchecked interface type assertion
#TODO#- gochecknoglobals # needs work to remove globals
#TODO#- gochecknoinits # needs work to remove init()
#TODO#- gofumpt # not sure whether it's useful
#TODO#- nestif # looks useful, however needs work
#TODO#- prealloc # easy optimizations
#TODO#- unparam # check for unused parameters
#TODO#- whitespace # checks for leading/trailing newlines
disable:
- asciicheck # non-ascii is allowed
- containedctx # gives false positives, however might be good to re-evaluate
- contextcheck # doesn't look like it's useful
- cyclop # this complexity is not a good metric
- decorder # not that useful
- depguard # unused
- dupl # slow
- errchkjson # false positives, checks for non-encodable json types
- errname # we have different approach
- exhaustive # doesn't handle default case
- exhaustivestruct # false positivies
- forbidigo # not useful
Expand All @@ -58,17 +67,19 @@ linters:
- goconst # check for things that could be replaced by constants
- gocyclo # this complexity is not a good metric
- godox # too many false positivies
- gofmt # running gofmt is covered by gofumpt
- goheader # separate tool
- goimports # disabled, because it's slow, using scripts/check-imports.go instead.
- gomnd # false positives
- gomoddirectives # not useful
- gomodguard # not useful
- gosec # needs tweaking
- gosimple # part of staticcheck
- grouper # we have a custom implementation
- ifshort # usefulness, depends on the context
- interfacer # not that useful
- ireturn # not that useful for us
- lll # don't need this check
- maintidx # code complexity based on halsted V and cyclomatic, both shown to be ineffective
- nlreturn # non-important code style
- paralleltest # too many false positives
- predeclared # kind of useful, but not critical
Expand All @@ -81,6 +92,7 @@ linters:
- thelper # too many false positives
- tparallel # false positivies
- unused # part of staticcheck
- varnamelen # unenecssary
- wrapcheck # too much noise and false positives
- wsl # too much noise
fast: false
Expand Down Expand Up @@ -169,4 +181,4 @@ issues:
text: "do not define dynamic errors"
- linters:
- revive
text: "if-return"
text: "if-return"
16 changes: 16 additions & 0 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ import (
)

// Test executes all unit and integration tests.
//
//nolint:deadcode
func Test() error {
err := sh.RunV("go", "test", "./...")
return err
}

// Coverage executes all unit test with coverage measurement.
//
//nolint:deadcode
func Coverage() error {
fmt.Println("Executing tests and generate coverate information")
Expand All @@ -42,12 +44,14 @@ func Coverage() error {
}

// Lint executes all the linters with golangci-lint.
//
//nolint:deadcode
func Lint() error {
return sh.RunV("bash", "./scripts/lint.sh")
}

// Format reformats code automatically.
//
//nolint:deadcode
func Format() error {
err := sh.RunV("gofmt", "-w", ".")
Expand All @@ -58,6 +62,7 @@ func Format() error {
}

// GenBuild re-generates `./build` helper binary.
//
//nolint:deadcode
func GenBuild() error {
envs := map[string]string{
Expand Down Expand Up @@ -85,12 +90,14 @@ func withDockerTag(filename string, publish bool, action func(tag string) error)
}

// DockerBaseBuild builds storj-base image.
//
//nolint:deadcode
func DockerBaseBuild() error {
return dockerBase(false)
}

// DockerBasePublish pushes storj-base image.
//
//nolint:deadcode
func DockerBasePublish() error {
return dockerBase(true)
Expand All @@ -106,12 +113,14 @@ func dockerBase(publish bool) error {
}

// DockerBuildBuild builds the storj-build docker image.
//
//nolint:deadcode
func DockerBuildBuild() error {
return dockerBuild(false)
}

// DockerBuildPublish pushes the storj-build docker image
//
//nolint:deadcode
func DockerBuildPublish() error {
return errs.Combine(
Expand Down Expand Up @@ -178,12 +187,14 @@ func dockerEdge(version string, publish bool) error {
}

// Integration executes integration tests.
//
//nolint:deadcode
func Integration() error {
return sh.RunV("bash", "test/test.sh")
}

// RebuildImages rebuilds all core and edge images.
//
//nolint:deadcode
func RebuildImages() error {
versions, err := listContainerVersions("storj")
Expand Down Expand Up @@ -211,6 +222,7 @@ func RebuildImages() error {
}

// DockerEdge builds a Edge docker image for local use.
//
//nolint:deadcode
func DockerEdge(version string, publish bool) error {
if version == "" {
Expand All @@ -220,6 +232,7 @@ func DockerEdge(version string, publish bool) error {
}

// DockerStorj builds a Core docker image for local use.
//
//nolint:deadcode
func DockerStorj(version string, publish bool) error {
if version == "" {
Expand All @@ -229,6 +242,7 @@ func DockerStorj(version string, publish bool) error {
}

// Images build missing images for existing git tags
//
//nolint:deadcode
func Images() error {
err := doOnMissing("storj", "storj", func(container string, repo string, version string) error {
Expand Down Expand Up @@ -257,6 +271,7 @@ func Images() error {
}

// ListImages prints all the existing storj and storj-edge images in the repo.
//
//nolint:deadcode
func ListImages() error {
versions, err := listContainerVersions("storj")
Expand Down Expand Up @@ -349,6 +364,7 @@ func writeDockerTag(tagFile string, tag string) error {
}

// ListVersions prints out the available container / release versions.
//
//nolint:deadcode
func ListVersions() error {
fmt.Println("container: storj")
Expand Down

0 comments on commit 96cbed6

Please sign in to comment.