Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable-all in config file can't be overridden on command line? #542

Closed
sb10 opened this issue May 22, 2019 · 5 comments
Closed

enable-all in config file can't be overridden on command line? #542

sb10 opened this issue May 22, 2019 · 5 comments
Labels
area: config Related to .golangci.yml and/or cli options question Further information is requested

Comments

@sb10
Copy link

sb10 commented May 22, 2019

  1. Version of golangci-lint: golangci-lint --version
    golangci-lint has version 1.16.0 built from 97ea1cb on 2019-03-31T19:48:46Z
  2. Config file: cat .golangci.yml
linters:
  enable-all: true
  disable-all: false
  disable:
    - depguard
    - dupl
    - gochecknoglobals
    - gochecknoinits
    - gocyclo
    - gofmt
    - lll
  1. Go environment: go version && go env
go version go1.12.5 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/nfs/users/nfs_s/sb10/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/nfs/users/nfs_s/sb10/go"
GOPROXY=""
GORACE=""
GOROOT="/software/vertres/installs/go"
GOTMPDIR=""
GOTOOLDIR="/software/vertres/installs/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/nfs/users/nfs_s/sb10/src/go/github.com/VertebrateResequencing/wr/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build378946545=/tmp/go-build"

When I run golangci-lint run (or for my text editor) I want all but a certain few linters to be enabled, so my config file has enable-all: true and certain linters in the disable section.

But sometimes I want to run just some of those disabled linters. I hope to be able to do this:

golangci-lint run --disable-all -E gocyclo -E dupl

But I can't:

ERRO Running error: --enable-all and --disable-all options must not be combined

Is there another way I can do what I want? How do you keep using a single config file (which may have per-linter options in it), but sometimes override to only run 1 or 2 specific linters?

@tpounds tpounds added area: config Related to .golangci.yml and/or cli options question Further information is requested labels Sep 29, 2019
@jirfag
Copy link
Member

jirfag commented Oct 14, 2019

hi, enable-all is considered a bad practice and will be deprecated soon. Please, don't use it.

@renta
Copy link

renta commented Dec 27, 2022

@jirfag Correct me if I wrong, but its an end of 2022 and "enable-all" is still valid. It's a quite confusing situation when you have a big config with "enable-all: true", tuned whole linters and try to fix them one-by-one in the project with a command like:

golangci-lint run --disable-all -E gomoddirectives

and receiving error like

ERRO Running error: --enable-all and --disable-all options must not be combined

It's a real problem because now with such approach I have to comment "enable-all" and "disable" sections in the config. Could you reopen this issue?

@ldez
Copy link
Member

ldez commented Dec 27, 2022

#1888
#2039

@renta
Copy link

renta commented Dec 27, 2022

@ldez Thank you! Can you reopen this issue also?

@ldez
Copy link
Member

ldez commented Dec 27, 2022

The management of the configuration is something global, we will not try to change the behavior only for one flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: config Related to .golangci.yml and/or cli options question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants