{"record":{"id":"177595e4c1dc60d3","repo":"golangci/golangci-lint","slug":"enable-all-and-enabled-checks-options-must-not-be","errorCode":null,"errorMessage":"enable-all and enabled-checks options must not be combined","messagePattern":"enable-all and enabled-checks options must not be combined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/golinters/gocritic/gocritic_settings.go","lineNumber":310,"sourceCode":"\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}\n\t}\n\n\treturn nil\n}","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/golinters/gocritic/gocritic_settings.go#L292-L328","documentation":"With gocritic enable-all enabled, listing enabled-checks is rejected because it conflicts with the semantics of turning everything on. validateOptionsCombinations throws this to prevent ambiguous configurations where inclusion lists and bulk enable coexist.","triggerScenarios":"gocritic settings combine enable-all: true with a non-empty enabled-checks list in .golangci.yml.","commonSituations":"Adding enable-all on top of an existing check-by-check config; scripts that append enable-all without cleaning enabled-checks; misunderstanding that enable-all acts as a default rather than a strict mode.","solutions":["Remove enabled-checks when enable-all is set","Use disabled-checks with enable-all to turn off specific checks instead","Drop enable-all if per-check opt-in (enabled-checks) is the desired behavior","Verify config with 'golangci-lint config verify' before CI runs"],"exampleFix":"// before (.golangci.yml)\ngocritic:\n  enable-all: true\n  enabled-checks:\n    - rangeValCopy\n\n// after\ngocritic:\n  enable-all: true\n  disabled-checks:\n    - hugeParam","handlingStrategy":"validation","validationCode":"if cfg.Gocritic.EnableAll && len(cfg.Gocritic.EnabledChecks) > 0 {\n    return errors.New(\"gocritic: use disabled-checks instead of enabled-checks with enable-all\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Replace enabled-checks with disabled-checks when enable-all is on","Keep exclusion lists (disabled-checks) as the single source of adjustments","Verify config in CI before linting"],"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"}