From a424880ae2814439e9ec6328e1b6303aae196577 Mon Sep 17 00:00:00 2001 From: Phil Dibowitz Date: Sat, 22 Jan 2022 13:23:17 -0800 Subject: [PATCH] Allow departments to be enabled/disabled by users Over in https://github.com/rubocop/rubocop/issues/9752 we figured out that the reason end-users can't enable/disable Cookstyle departments is because `Enabled` isn't in the config and thus [can't be overridden](https://github.com/rubocop/rubocop/issues/9752#issuecomment-877707141). This change will allow a user to not only do the obvious: ```yaml Chef/Correctness: Enabled: false ``` But more interestingly do something like this: ```yaml AllCops: DisabledByDefault: true Chef/Correctness: Enabled: true ``` CC @jonas054 --- config/cookstyle.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/cookstyle.yml b/config/cookstyle.yml index 22daa7cb..592c50c3 100644 --- a/config/cookstyle.yml +++ b/config/cookstyle.yml @@ -12,6 +12,7 @@ AllCops: ############################### Chef/Style: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Style/AttributeKeys: @@ -156,6 +157,7 @@ Chef/Style/IncludeRecipeWithParentheses: ############################### Chef/Correctness: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Correctness/ServiceResource: @@ -529,6 +531,7 @@ Chef/Correctness/InvalidNotificationResource: ############################### Chef/Sharing: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Sharing/InsecureCookbookURL: @@ -597,6 +600,7 @@ Chef/Sharing/IncludeResourceExamples: ############################### Chef/Deprecations: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Deprecations/NodeDeepFetch: @@ -1301,6 +1305,7 @@ Chef/Deprecations/DependsOnOmnibusUpdaterCookbook: ############################### Chef/Modernize: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Modernize/LegacyBerksfileSource: @@ -1973,6 +1978,7 @@ Chef/Modernize/DeclareActionClass: ############################### Chef/RedundantCode: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/RedundantCode/ConflictsMetadata: @@ -2195,6 +2201,7 @@ Chef/RedundantCode/DoubleCompileTime: ############################### Chef/Effortless: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Effortless/CookbookUsesSearch: