diff --git a/.gitignore b/.gitignore index 9788365673..4dfd49fe87 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swo *.swp .idea/* +tools/bin \ No newline at end of file diff --git a/tools/.golangci.yml b/tools/.golangci.yml new file mode 100644 index 0000000000..3dc1b5d4b5 --- /dev/null +++ b/tools/.golangci.yml @@ -0,0 +1,32 @@ +run: + timeout: "5m" + +linters: + disable-all: true + enable: [ + "govet", + "goimports", + "gofmt", + "staticcheck", + "deadcode", + "dupl", + "errcheck", + "structcheck", + "unparam", + "unused", + "varcheck", + ] + +linters-settings: + goimports: + local-prefixes: "github.com/openshift/enhancements/tools" + govet: + check-shadowing: false + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + exclude-rules: + - linters: + - staticcheck + text: "SA1019:" diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000000..448e0882a1 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,13 @@ +ifeq (/,${HOME}) +GOLANGCI_LINT_CACHE=/tmp/golangci-lint-cache/ +else +GOLANGCI_LINT_CACHE=${HOME}/.cache/golangci-lint +endif + +# Run go lint against code +.PHONY: lint +lint: bin/golangci-lint + GOLANGCI_LINT_CACHE=$(GOLANGCI_LINT_CACHE) ./bin/golangci-lint run --exclude=G101 + +bin/golangci-lint: + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.31.0 diff --git a/tools/report/main.go b/tools/report/main.go index 9f7766827c..a41f64cafb 100644 --- a/tools/report/main.go +++ b/tools/report/main.go @@ -29,7 +29,7 @@ func fileExists(filename string) bool { } func handleError(msg string) { - fmt.Fprintf(os.Stderr, fmt.Sprintf("%s\n", msg)) + fmt.Fprintf(os.Stderr, "%s\n", msg) os.Exit(1) } diff --git a/tools/stats/stats.go b/tools/stats/stats.go index 0cda93e169..76c59d37dd 100644 --- a/tools/stats/stats.go +++ b/tools/stats/stats.go @@ -45,7 +45,6 @@ func New(daysBack int, staleMonths int, orgName, repoName string, devMode bool, type Stats struct { org string repo string - minAge int earliestDate time.Time staleDate time.Time devMode bool