mirror of https://github.com/docker/cli.git
Remove now obsolete gometalinter and use golangci-lint instead
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b7e06f2845
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e70edc3576
commit
7374c0a152
|
@ -0,0 +1,83 @@
|
||||||
|
linters:
|
||||||
|
enable:
|
||||||
|
- bodyclose
|
||||||
|
- deadcode
|
||||||
|
- dogsled
|
||||||
|
- gocyclo
|
||||||
|
- goimports
|
||||||
|
- golint
|
||||||
|
- gosec
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- interfacer
|
||||||
|
- lll
|
||||||
|
- megacheck
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- typecheck
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
|
||||||
|
disable:
|
||||||
|
- errcheck
|
||||||
|
|
||||||
|
run:
|
||||||
|
timeout: 5m
|
||||||
|
skip-dirs:
|
||||||
|
- cli/command/stack/kubernetes/api/openapi
|
||||||
|
- cli/command/stack/kubernetes/api/client
|
||||||
|
skip-files:
|
||||||
|
- cli/compose/schema/bindata.go
|
||||||
|
- .*generated.*
|
||||||
|
|
||||||
|
linters-settings:
|
||||||
|
gocyclo:
|
||||||
|
min-complexity: 16
|
||||||
|
govet:
|
||||||
|
check-shadowing: false
|
||||||
|
lll:
|
||||||
|
line-length: 200
|
||||||
|
nakedret:
|
||||||
|
command: nakedret
|
||||||
|
pattern: ^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$
|
||||||
|
|
||||||
|
issues:
|
||||||
|
# The default exclusion rules are a bit too permissive, so copying the relevant ones below
|
||||||
|
exclude-use-default: false
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- parameter .* always receives
|
||||||
|
|
||||||
|
exclude-rules:
|
||||||
|
# These are copied from the default exclude rules, except for "ineffective break statement"
|
||||||
|
# and GoDoc checks.
|
||||||
|
# https://github.com/golangci/golangci-lint/blob/0cc87df732aaf1d5ad9ce9ca538d38d916918b36/pkg/config/config.go#L36
|
||||||
|
- text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked"
|
||||||
|
linters:
|
||||||
|
- errcheck
|
||||||
|
- text: "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
|
||||||
|
linters:
|
||||||
|
- golint
|
||||||
|
- text: "G103: Use of unsafe calls should be audited"
|
||||||
|
linters:
|
||||||
|
- gosec
|
||||||
|
- text: "G104: Errors unhandled"
|
||||||
|
linters:
|
||||||
|
- gosec
|
||||||
|
- text: "G204: Subprocess launch(ed with (variable|function call)|ing should be audited)"
|
||||||
|
linters:
|
||||||
|
- gosec
|
||||||
|
- text: "(G301|G302): (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)"
|
||||||
|
linters:
|
||||||
|
- gosec
|
||||||
|
- text: "G304: Potential file inclusion via variable"
|
||||||
|
linters:
|
||||||
|
- gosec
|
||||||
|
- text: "(G201|G202): SQL string (formatting|concatenation)"
|
||||||
|
linters:
|
||||||
|
- gosec
|
|
@ -1,20 +1,23 @@
|
||||||
|
# syntax=docker/dockerfile:1.1.3-experimental
|
||||||
|
|
||||||
ARG GO_VERSION=1.12.12
|
ARG GO_VERSION=1.12.12
|
||||||
|
ARG GOLANGCI_LINTER_SHA="v1.21.0"
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-alpine
|
FROM golang:${GO_VERSION}-alpine AS build
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
ARG GOLANGCI_LINTER_SHA
|
||||||
|
ARG GO111MODULE=on
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
|
go get github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINTER_SHA}
|
||||||
|
|
||||||
RUN apk add -U git
|
FROM golang:${GO_VERSION}-alpine AS lint
|
||||||
|
|
||||||
ARG GOMETALINTER_SHA=v2.0.6
|
|
||||||
RUN go get -d github.com/alecthomas/gometalinter && \
|
|
||||||
cd /go/src/github.com/alecthomas/gometalinter && \
|
|
||||||
git checkout -q "$GOMETALINTER_SHA" && \
|
|
||||||
go build -v -o /usr/local/bin/gometalinter . && \
|
|
||||||
gometalinter --install && \
|
|
||||||
rm -rf /go/src/* /go/pkg/*
|
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/docker/cli
|
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
|
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
|
||||||
ENTRYPOINT ["/usr/local/bin/gometalinter"]
|
COPY --from=build /go/bin/golangci-lint /usr/local/bin
|
||||||
CMD ["--config=gometalinter.json", "./..."]
|
WORKDIR /go/src/github.com/docker/cli
|
||||||
|
ENV GOGC=75
|
||||||
|
ENTRYPOINT ["/usr/local/bin/golangci-lint"]
|
||||||
|
CMD ["run", "--config=.golangci.yml"]
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
{
|
|
||||||
"Vendor": true,
|
|
||||||
"Deadline": "3m",
|
|
||||||
"Sort": ["linter", "severity", "path", "line"],
|
|
||||||
"Skip": [
|
|
||||||
"cli/compose/schema/bindata.go",
|
|
||||||
"cli/command/stack/kubernetes/api/openapi",
|
|
||||||
"cli/command/stack/kubernetes/api/client",
|
|
||||||
".*generated.*",
|
|
||||||
"vendor"
|
|
||||||
],
|
|
||||||
"Exclude": [
|
|
||||||
"parameter .* always receives",
|
|
||||||
"_esc(Dir|FS|FSString|FSMustString) is unused"
|
|
||||||
],
|
|
||||||
"EnableGC": true,
|
|
||||||
"Linters": {
|
|
||||||
"nakedret": {
|
|
||||||
"Command": "nakedret",
|
|
||||||
"Pattern": "^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"WarnUnmatchedDirective": true,
|
|
||||||
|
|
||||||
"DisableAll": true,
|
|
||||||
"Enable": [
|
|
||||||
"deadcode",
|
|
||||||
"gocyclo",
|
|
||||||
"gofmt",
|
|
||||||
"goimports",
|
|
||||||
"golint",
|
|
||||||
"gosimple",
|
|
||||||
"ineffassign",
|
|
||||||
"interfacer",
|
|
||||||
"lll",
|
|
||||||
"misspell",
|
|
||||||
"nakedret",
|
|
||||||
"unconvert",
|
|
||||||
"unparam",
|
|
||||||
"unused",
|
|
||||||
"vet"
|
|
||||||
],
|
|
||||||
|
|
||||||
"Cyclo": 16,
|
|
||||||
"LineLength": 200
|
|
||||||
}
|
|
Loading…
Reference in New Issue