{"record":{"id":"80b82028d17e0fbe","repo":"golangci/golangci-lint","slug":"enable-all-and-enabled-tags-options-must-not-be-co","errorCode":null,"errorMessage":"enable-all and enabled-tags options must not be combined","messagePattern":"enable-all and enabled-tags options must not be combined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/golinters/gocritic/gocritic_settings.go","lineNumber":306,"sourceCode":"\t\ts.validateDisabledAndEnabledAtOneMoment,\n\t\ts.validateAtLeastOneCheckerEnabled,\n\t} {\n\t\tif err := v(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\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}","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/golinters/gocritic/gocritic_settings.go#L288-L324","documentation":"When gocritic's enable-all is set, using enabled-tags is contradictory: enable-all already turns on every check, so tag-based inclusion is meaningless and rejected by validateOptionsCombinations. The library fails fast rather than silently ignoring one of the options.","triggerScenarios":"gocritic settings have enable-all: true together with a non-empty enabled-tags list in .golangci.yml.","commonSituations":"Upgrading from a tag-based config to enable-all and forgetting to remove enabled-tags; merging team configs with different philosophies; copy-pasting settings blocks from different examples.","solutions":["Remove enabled-tags when using enable-all","If you want everything except some checks, use enable-all with disabled-tags instead","If tags are the real intent, replace enable-all with a curated enabled-tags list","Validate the config with 'golangci-lint config verify' before running"],"exampleFix":"// before (.golangci.yml)\ngocritic:\n  enable-all: true\n  enabled-tags:\n    - style\n\n// after\ngocritic:\n  enable-all: true\n  disabled-tags:\n    - opinionated","handlingStrategy":"validation","validationCode":"if cfg.Gocritic.EnableAll && len(cfg.Gocritic.EnabledTags) > 0 {\n    return errors.New(\"gocritic: use disabled-tags instead of enabled-tags with enable-all\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["With enable-all, only use disabled-tags/disabled-checks","Strip enabled-* keys when adopting enable-all","Validate config before running linters 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"}