{"record":{"id":"1268815dc7a7dd74","repo":"golangci/golangci-lint","slug":"disable-all-and-disabled-tags-options-must-not-be","errorCode":null,"errorMessage":"disable-all and disabled-tags options must not be combined","messagePattern":"disable-all and disabled-tags options must not be combined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/golinters/gocritic/gocritic_settings.go","lineNumber":315,"sourceCode":"\nfunc (s *settingsWrapper) validateOptionsCombinations() error {\n\tif s.EnableAll && s.DisableAll {\n\t\treturn errors.New(\"enable-all and disable-all options must not be combined\")\n\t}\n\n\tswitch {\n\tcase s.EnableAll:\n\t\tif len(s.EnabledTags) > 0 {\n\t\t\treturn errors.New(\"enable-all and enabled-tags options must not be combined\")\n\t\t}\n\n\t\tif len(s.EnabledChecks) > 0 {\n\t\t\treturn errors.New(\"enable-all and enabled-checks options must not be combined\")\n\t\t}\n\n\tcase s.DisableAll:\n\t\tif len(s.DisabledTags) > 0 {\n\t\t\treturn errors.New(\"disable-all and disabled-tags options must not be combined\")\n\t\t}\n\n\t\tif len(s.DisabledChecks) > 0 {\n\t\t\treturn errors.New(\"disable-all and disabled-checks options must not be combined\")\n\t\t}\n\n\t\tif len(s.EnabledTags) == 0 && len(s.EnabledChecks) == 0 {\n\t\t\treturn errors.New(\"all checks were disabled, but no one check was enabled: at least one must be enabled\")\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (s *settingsWrapper) validateCheckerTags() error {\n\tfor _, tag := range s.EnabledTags {\n\t\tif !s.allChecksByTag.has(tag) {\n\t\t\treturn fmt.Errorf(\"enabled tag %q doesn't exist, see %s's documentation\", tag, linterName)","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/golinters/gocritic/gocritic_settings.go#L297-L333","documentation":"When gocritic's disable-all is set, listing disabled-tags is contradictory: everything is already off, so tag-based exclusions make no sense. validateOptionsCombinations rejects the combination during settings validation.","triggerScenarios":"gocritic settings contain disable-all: true together with a non-empty disabled-tags list in .golangci.yml.","commonSituations":"Merging a disable-all (opt-in) config with an enable-all (opt-out) config; migrating between the two philosophies and leaving stale disabled-tags; generated configs that emit both keys.","solutions":["Remove disabled-tags when using disable-all","Select checks with enabled-tags/enabled-checks when disable-all is set","Switch to enable-all with disabled-tags if exclusion-based configuration is intended","Run 'golangci-lint config verify' to catch the conflict before linting"],"exampleFix":"// before (.golangci.yml)\ngocritic:\n  disable-all: true\n  disabled-tags:\n    - style\n\n// after\ngocritic:\n  disable-all: true\n  enabled-tags:\n    - diagnostic","handlingStrategy":"validation","validationCode":"if cfg.Gocritic.DisableAll && len(cfg.Gocritic.DisabledTags) > 0 {\n    return errors.New(\"gocritic: use enabled-tags instead of disabled-tags with disable-all\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["With disable-all, only use enabled-tags/enabled-checks","Strip disabled-* keys when adopting disable-all","Run 'golangci-lint config verify' in CI"],"tags":["gocritic","config","golangci-lint","validation"],"backgroundTag":"conflicting-config-options","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}