From 944c9ca664af68e8af164cd826a88b70c0484581 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 be58e681..8de9897f 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: @@ -486,6 +488,7 @@ Chef/Correctness/OctalModeAsString: ############################### Chef/Sharing: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Sharing/InsecureCookbookURL: @@ -554,6 +557,7 @@ Chef/Sharing/IncludeResourceExamples: ############################### Chef/Deprecations: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Deprecations/NodeDeepFetch: @@ -1195,6 +1199,7 @@ Chef/Deprecations/ChefSugarHelpers: ############################### Chef/Modernize: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Modernize/LegacyBerksfileSource: @@ -1757,6 +1762,7 @@ Chef/Modernize/ActionMethodInResource: ############################### Chef/RedundantCode: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/RedundantCode/ConflictsMetadata: @@ -1979,6 +1985,7 @@ Chef/RedundantCode/DoubleCompileTime: ############################### Chef/Effortless: + Enabled: true StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/ Chef/Effortless/CookbookUsesSearch: