config/cookstyle.yml in cookstyle-6.5.3 vs config/cookstyle.yml in cookstyle-6.6.9
- old
+ new
@@ -29,12 +29,16 @@
###############################
# ChefStyle: Making cookbooks look better
###############################
+ChefStyle:
+ StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chefstyle.md
+
ChefStyle/AttributeKeys:
Description: Check which style of keys are used to access node attributes.
+ StyleGuide: '#chefstyleattributekeys'
Enabled: true
EnforcedStyle: strings
VersionAdded: '5.0.0'
SupportedStyles:
- strings
@@ -42,124 +46,143 @@
Exclude:
- '**/metadata.rb'
ChefStyle/CopyrightCommentFormat:
Description: Properly format copyright dates in comment blocks and ensure dates are up to date
+ StyleGuide: '#chefstylecopyrightcommentformat'
Enabled: false
VersionAdded: '5.0.0'
ChefStyle/CommentSentenceSpacing:
Description: Use a single space after sentences in comments
+ StyleGuide: '#chefstylecommentsentencespacing'
Enabled: false
VersionAdded: '5.1.0'
ChefStyle/CommentFormat:
Description: Use Chef's unique format for comment headers
+ StyleGuide: '#chefstylecommentformat'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/Berksfile'
ChefStyle/FileMode:
Description: Use strings to represent file modes in Chef resources
+ StyleGuide: '#chefstylefilemode'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/attributes/*'
- '**/metadata.rb'
- '**/Berksfile'
ChefStyle/UsePlatformHelpers:
Description: Use platform? and platform_family? helpers to check node platform in resources and recipes
+ StyleGuide: '#chefstyleuseplatformhelpers'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
- '**/libraries/*'
- '**/Berksfile'
ChefStyle/SimplifyPlatformMajorVersionCheck:
Description: Use node['platform_version'].to_i instead of node['platform_version'].split('.').first or node['platform_version'].split('.')[0]
+ StyleGuide: '#chefstylesimplifyplatformmajorversioncheck'
Enabled: true
VersionAdded: '5.8.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefStyle/DefaultCopyrightComments:
Description: Cookbook copyright comment headers should be updated for a real person or organization.
+ StyleGuide: '#chefstyledefaultcopyrightcomments'
Enabled: true
VersionAdded: '5.12.0'
ChefStyle/UnnecessaryPlatformCaseStatement:
Description: Use the platform?() and platform_family?() helpers instead of a case statement that only includes a single when statement.
+ StyleGuide: '#chefstyleunnecessaryplatformcasestatement'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefStyle/ImmediateNotificationTiming:
Description: Use :immediately instead of :immediate for resource notification timing.
+ StyleGuide: '#chefstyleimmediatenotificationtiming'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefStyle/TrueClassFalseClassResourceProperties:
Description: When setting the allowed types for a resource to accept either true or false values it's much simpler to use true and false instead of TrueClass and FalseClass.
+ StyleGuide: '#chefstyletrueclassfalseclassresourceproperties'
Enabled: true
VersionAdded: '5.16.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
ChefStyle/OverlyComplexSupportsDependsMetadata:
Description: Don't loop over an array to set cookbook dependencies or supported platforms if you have fewer than three values to set.
+ StyleGuide: '#chefstyleovercomplexsupportsdependsmetadata'
Enabled: true
VersionAdded: '5.19.0'
Include:
- '**/metadata.rb'
ChefStyle/ChefWhaaat:
Description: Do you mean Chef (the company) or a Chef product (e.g. Chef Infra, Chef InSpec, etc)?
+ StyleGuide: '#chefstylechefwhaaat'
Enabled: false
VersionAdded: '5.20.0'
ChefStyle/UnnecessaryOSCheck:
Description: Use the platform_family?() helpers instead of node['os] == 'foo' for platform_families that match 1:1 with OS values. These helpers are easier to read and can accept multiple platform arguments, which greatly simplifies complex platform logic.
+ StyleGuide: '#chefstyleunnecessaryoscheck'
Enabled: true
VersionAdded: '5.21.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefStyle/NegatingOnlyIf:
Description: Use not_if instead of only_if that negates the Ruby statement with a !
+ StyleGuide: '#chefstylenegatingonlyif'
VersionAdded: '6.2.0'
Enabled: true
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
###############################
# ChefCorrectness: Avoiding potential problems
###############################
+ChefCorrectness:
+ StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chefcorrectness.md
+
ChefCorrectness/ServiceResource:
Description: Use a service resource to start and stop services instead of execute resources
+ StyleGuide: '#chefcorrectnessserviceresource'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/NodeNormal:
Description: Do not use the node.normal method
+ StyleGuide: '#chefcorrectnessnodenormal'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
@@ -172,1139 +195,1328 @@
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/TmpPath:
Description: Use file_cache_path rather than hard-coding tmp paths
+ StyleGuide: '#chefcorrectnessnodenormalunless'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/InvalidPlatformMetadata:
Description: metadata.rb "supports" platform is invalid
+ StyleGuide: '#chefcorrectnessinvalidplatformmetadata'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/metadata.rb'
ChefCorrectness/CookbookUsesNodeSave:
Description: Don't use node.save to save partial node data to the Chef Infra Server mid-run unless it's absolutely necessary. Node.save can result in failed Chef Infra runs appearing in search and increases load on the Chef Infra Server.
+ StyleGuide: '#chefcorrectnesscookbookusesnodesave'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/CookbooksDependsOnSelf:
Description: A cookbook cannot depend on itself
+ StyleGuide: '#chefcorrectnesscookbooksdependonself'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/metadata.rb'
ChefCorrectness/MetadataMissingName:
- Description: MetadataMissingName
+ Description: The metadata.rb file is missing the name field which is required by Chef Infra Client 12 and later
+ StyleGuide: '#chefcorrectnessmetadatamissingname'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/metadata.rb'
ChefCorrectness/BlockGuardWithOnlyString:
Description: A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it be executed as Ruby code which will always returns true instead of a shell command that will actually run.
+ StyleGuide: '#chefcorrectnessblockguardwithonlystring'
Enabled: true
VersionAdded: '5.2.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/ResourceSetsInternalProperties:
Description: Do not set properties used internally by Chef Infra Client to track the system state.
+ StyleGuide: '#chefcorrectnessresourcesetsinternalproperties'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/ResourceSetsNameProperty:
Description: Resource sets the name property in the resource instead of using a name_property.
+ StyleGuide: '#chefcorrectnessresourcesetsnameproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/ResourceWithNoneAction:
Description: Resource uses the nonexistent :none action instead of the :nothing action
+ StyleGuide: '#chefcorrectnessresourcewithnoneaction'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/InvalidVersionMetadata:
Description: Cookbook metadata.rb version field should follow X.Y.Z version format.
+ StyleGuide: '#chefcorrectnessinvalidversionmetadata'
Enabled: true
VersionAdded: '5.8.0'
Include:
- '**/metadata.rb'
ChefCorrectness/NotifiesActionNotSymbol:
Description: When notifying or subscribing an action within a resource the action should always be a symbol. In Chef Infra Client releases before 14.0 this may result in double notification.
+ StyleGuide: '#chefcorrectnessnotifiesactionnotsymbol'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/IncorrectLibraryInjection:
Description: Libraries should be injected into the Chef::DSL::Recipe or Chef::DSL::Resource classes and not Recipe/Resource/Provider classes directly.
+ StyleGuide: '#chefcorrectnessincorrectlibraryinjection'
Enabled: true
VersionAdded: '5.10.0'
Include:
- '**/libraries/*.rb'
ChefCorrectness/InvalidPlatformHelper:
Description: Pass valid platforms to the platform? helper.
+ StyleGuide: '#chefcorrectnessinvalidplatformhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/InvalidPlatformFamilyHelper:
Description: Pass valid platform families to the platform_family? helper.
+ StyleGuide: '#chefcorrectnessinvalidplatformfamilyhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/ScopedFileExist:
Description: Scope file exist to access the correct File class by using ::File.exist? not File.exist?.
+ StyleGuide: '#chefcorrectnessscopedfileexist'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/InvalidPlatformValueForPlatformFamilyHelper:
Description: Pass valid platforms families to the value_for_platform_family helper.
+ StyleGuide: '#chefcorrectnessinvalidplatformvalueforplatformfamilyhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/InvalidPlatformValueForPlatformHelper:
Description: Pass valid platforms to the value_for_platform helper.
+ StyleGuide: '#chefcorrectnessinvalidplatformvalueforplatformhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/InvalidNotificationTiming:
Description: Valid notification timings are :immediately, :immediate (alias for :immediately), :delayed, and :before.
+ StyleGuide: '#chefcorrectnessinvalidnotificationtiming'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/MalformedPlatformValueForPlatformHelper:
Description: When using the value_for_platform helper you must include a hash of possible platforms where each platform contains a hash of versions and potential values. If you don't wish to match on a particular version you can instead use the key 'default'.
+ StyleGuide: '#chefcorrectnessmalformedplatformvalueforplatformhelper'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/DnfPackageAllowDowngrades:
Description: dnf_package does not support the allow_downgrades property
+ StyleGuide: '#chefcorrectnessdnfpackageallowdowngrades'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/ChefApplicationFatal:
Description: Use raise to force Chef Infra Client to fail instead of using Chef::Application.fatal
+ StyleGuide: '#chefcorrectnesschefapplicationfatal'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/PowershellScriptDeleteFile:
Description: Use the `file` or `directory` resources built into Chef Infra Client with the :delete action to remove files/directories instead of using Remove-Item in a powershell_script resource
+ StyleGuide: '#chefcorrectnesspowershellscriptdeletefiles'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefCorrectness/ConditionalRubyShellout:
Description: Don't use Ruby to shellout in an only_if / not_if conditional when you can shellout directly by wrapping the command in quotes.
+ StyleGuide: '#chefcorrectnessconditionalrubyshellout'
Enabled: true
VersionAdded: '6.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
+ChefCorrectness/LazyEvalNodeAttributeDefaults:
+ Description: When setting a node attribute as a default value for a custom resource property, make sure to wrap the node attribute in `lazy {}` so that the node attribute is available when the resource executes.
+ StyleGuide: '#chefcorrectnesslazyevalnodeattributedefaults'
+ Enabled: true
+ VersionAdded: '6.6.0'
+ Include:
+ - '**/libraries/*.rb'
+ - '**/resources/*.rb'
+
+ChefCorrectness/OpenSSLPasswordHelpers:
+ Description: The secure_password helper from the openssl cookbooks Opscode::OpenSSL::Password class should not be used to generate passwords.
+ StyleGuide: '#chefcorrectnessopensslpasswordhelpers'
+ Enabled: true
+ VersionAdded: '6.6.0'
+ Exclude:
+ - '**/metadata.rb'
+ - '**/Berksfile'
+
+ChefCorrectness/InvalidPlatformFamilyInCase:
+ Description: Use valid platform family values in case statements.
+ StyleGuide: '#chefcorrectnessinvalidplatformfamilyincase'
+ Enabled: true
+ VersionAdded: '6.6.0'
+ Exclude:
+ - '**/metadata.rb'
+ - '**/Berksfile'
+
+ChefCorrectness/InvalidPlatformInCase:
+ Description: Use valid platform values in case statements.
+ StyleGuide: '#chefcorrectnessinvalidplatformincase'
+ Enabled: true
+ VersionAdded: '6.6.0'
+ Exclude:
+ - '**/metadata.rb'
+ - '**/Berksfile'
+
###############################
# ChefSharing: Issues that prevent sharing code with other teams or with the Chef community in general
###############################
+ChefSharing:
+ StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chefsharing.md
+
ChefSharing/InsecureCookbookURL:
Description: Insecure http Github or Gitlab URLs for metadata source_url/issues_url fields
+ StyleGuide: '#chefsharinginsecurecookbookurl'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefSharing/InvalidLicenseString:
Description: Cookbook metadata.rb does not use a SPDX compliant license string or "all rights reserved"
+ StyleGuide: '#chefsharinginvalidlicensestring'
Enabled: true
VersionAdded: '5.2.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefSharing/DefaultMetadataMaintainer:
Description: Metadata contains default maintainer information from the cookbook generator. Add actual cookbook maintainer information to the metadata.rb.
+ StyleGuide: '#chefsharingdefaultmetadatamaintainer'
Enabled: true
VersionAdded: '5.4.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefSharing/EmptyMetadataField:
Description: metadata.rb should not include fields with an empty string. Either don't include the field or add a value.
+ StyleGuide: '#chefsharingemptymetadatafield'
Enabled: true
VersionAdded: '5.8.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefSharing/IncludePropertyDescriptions:
Description: Properties should include description fields to allow automated documention. Requires Chef Infra Client 13.9 or later.
+ StyleGuide: '#chefsharingincludepropetydescriptions'
Enabled: false
VersionAdded: '6.1.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
ChefSharing/IncludeResourceDescriptions:
Description: Resources should include description fields to allow automated documention. Requires Chef Infra Client 13.9 or later.
+ StyleGuide: '#chefsharingincluderesourcedescriptions'
Enabled: false
VersionAdded: '6.1.0'
Include:
- '**/resources/*.rb'
###############################
# ChefDeprecations: Resolving Deprecations that block upgrading Chef Infra Client
###############################
+ChefDeprecations:
+ StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chefdeprecations.md
+
ChefDeprecations/NodeDeepFetch:
Description: Do not use the deprecated chef-sugar node.deep_fetch methods
+ StyleGuide: '#chefdeprecationsnodedeepfetch'
Enabled: true
VersionAdded: '5.12.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/NodeSet:
Description: Do not use the deprecated node.set method
+ StyleGuide: '#chefdeprecationsnodeset'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/NodeSetUnless:
Description: Do not use the deprecated node.set_unless method
+ StyleGuide: '#chefdeprecationsnodesetunless'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/EpicFail:
Description: Use ignore_failure method instead of the deprecated epic_fail method
+ StyleGuide: '#chefdeprecationsepicfail'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/CookbookDependsOnPoise:
Description: Cookbooks should not depend on the deprecated Poise framework
+ StyleGuide: '#chefdeprecationscookbookdependsonpoise'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/metadata.rb'
ChefDeprecations/CookbookDependsOnCompatResource:
- Description: Don't depend on the deprecated compat_resource cookbook made obsolete by Chef 12.19+
+ Description: Don't depend on the deprecated compat_resource cookbook made obsolete by Chef Infra Client 12.19+
+ StyleGuide: '#chefdeprecationscookbookdependsoncompatresource'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/metadata.rb'
ChefDeprecations/CookbookDependsOnPartialSearch:
- Description: Don't depend on the deprecated partial_search cookbook made obsolete by Chef 13+
+ Description: Don't depend on the deprecated partial_search cookbook made obsolete by Chef Infra Client 13+
+ StyleGuide: '#chefdeprecationscookbookdependsonpartialsearch'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/metadata.rb'
ChefDeprecations/EasyInstallResource:
- Description: Don't use the deprecated easy_install resource resource removed in Chef 13
+ Description: Don't use the deprecated easy_install resource resource removed in Chef Infra Client 13
+ StyleGuide: '#chefdeprecationseasyinstallresource'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/ErlCallResource:
- Description: Don't use the deprecated erl_call resource removed in Chef 13
+ Description: Don't use the deprecated erl_call resource removed in Chef Infra Client 13
+ StyleGuide: '#chefdeprecationserlcallresource'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/RequireRecipe:
Description: Use include_recipe instead of the require_recipe method
+ StyleGuide: '#chefdeprecationsrequirerecipe'
Enabled: true
VersionAdded: '5.2.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/NodeMethodsInsteadofAttributes:
Description: Use node attributes to access Ohai data instead of node methods, which were deprecated in Chef Infra Client 13.
+ StyleGuide: '#chefdeprecationsnodemethodsinsteadofattributes'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/UsesDeprecatedMixins:
Description: Don't use deprecated Mixins no longer included in Chef Infra Client 14 and later.
+ StyleGuide: '#chefdeprecationsusesdeprecatedmixins'
Enabled: true
VersionAdded: '5.4.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
ChefDeprecations/IncludingXMLRubyRecipe:
Description: The xml::ruby recipe installs nokogiri which is included in Chef Infra Client 12 and later.
+ StyleGuide: '#chefdeprecationsincludingxmlrubyrecipe'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/LegacyYumCookbookRecipes:
Description: The elrepo, epel, ius, remi, and repoforge recipes were split into their own cookbooks and the yum recipe was renamed to be default with the release of yum cookbook 3.0 (Dec 2013).
+ StyleGuide: '#chefdeprecationslegacyyumcookbookrecipes'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/UsesChefRESTHelpers:
Description: Don't use the helpers in Chef::REST which were removed in Chef Infra Client 13
+ StyleGuide: '#chefdeprecationsuseschefresthelpers'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/ChocolateyPackageUninstallAction:
Description: Use the :remove action in the chocolatey_package resource instead of :uninstall which was removed in Chef Infra Client 14+
+ StyleGuide: '#chefdeprecationschocolateypackageuninstallaction'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/LaunchdDeprecatedHashProperty:
Description: The launchd resource's hash property was renamed to plist_hash in Chef Infra Client 13+ to avoid conflicts with Ruby's hash class.
+ StyleGuide: '#chefdeprecationslaunchddeprecatedhashproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/LocaleDeprecatedLcAllProperty:
Description: The local resource's lc_all property has been deprecated and will be removed in Chef Infra Client 16
+ StyleGuide: '#chefdeprecationslocaledeprecatedlcallproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/UserDeprecatedSupportsProperty:
Description: The supports property was removed in Chef Infra Client 13 in favor of individual 'manage_home' and 'non_unique' properties.
+ StyleGuide: '#chefdeprecationsuserdeprecatedsupportsproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/UseInlineResourcesDefined:
Description: use_inline_resources is now the default for resources in Chef Infra Client 13+ and does not need to be specified.
+ StyleGuide: '#chefdeprecationsuseinlineresourcesdefined'
Enabled: true
VersionAdded: '5.4.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
ChefDeprecations/IncludingYumDNFCompatRecipe:
Description: Do not include the yum::dnf_yum_compat default recipe to install yum on dnf systems. Chef Infra Client now includes built in support for DNF.
+ StyleGuide: '#chefdeprecationsincludingyumdnfcompatrecipe'
Enabled: true
VersionAdded: '5.3.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/WindowsTaskChangeAction:
Description: The :change action in the windows_task resource was removed when windows_task was added to Chef Infra Client 13+. The default action of :create should can now be used to create an update tasks.
+ StyleGuide: '#chefdeprecationswindowstaskchangeaction'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/ResourceOverridesProvidesMethod:
Description: Don't override the provides? method in a resource provider. Use provides :SOME_PROVIDER_NAME instead. This will cause failures in Chef Infra Client 13 and later.
+ StyleGuide: '#chefdeprecationsresourceoverridesprovidesmethod'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
ChefDeprecations/ResourceUsesDslNameMethod:
Description: Use resource_name instead of the dsl_name method in resources. This will cause failures in Chef Infra Client 13 and later.
+ StyleGuide: '#chefdeprecationsresourceusesdslnamemethod'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
ChefDeprecations/ResourceUsesUpdatedMethod:
Description: Don't use updated = true/false to update resource state. This will cause failures in Chef Infra Client 13 and later.
+ StyleGuide: '#chefdeprecationsresourceusesupdatedmethod'
Enabled: false # has a high potential for false positives
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
ChefDeprecations/NamePropertyWithDefaultValue:
Description: A resource property can't be marked as a name_property and also have a default value. This will fail in Chef Infra Client 13 or later.
+ StyleGuide: '#chefdeprecationsnamepropertywithdefaultvalue'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
ChefDeprecations/ResourceUsesProviderBaseMethod:
Description: Don't use the deprecated provider_base method in a resource to specify the provider module to use. Instead, the provider should call provides to register itself, or the resource should call provider to specify the provider to use. This will cause failures in Chef Infra Client 13 and later.
+ StyleGuide: '#chefdeprecationsresourceusesproviderbasemethod'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
ChefDeprecations/ChefSpecCoverageReport:
Description: Don't use the deprecated ChefSpec coverage report functionality in your specs.
+ StyleGuide: '#chefdeprecationschefspeccoveragereport'
Enabled: true
VersionAdded: '5.8.0'
Include:
- '**/spec/*.rb'
ChefDeprecations/ChefSpecLegacyRunner:
Description: Use ChefSpec::SoloRunner or ChefSpec::ServerRunner instead of the deprecated ChefSpec::Runner.
+ StyleGuide: '#chefdeprecationschefspeclegacyrunner'
Enabled: true
VersionAdded: '5.8.0'
Include:
- '**/spec/*.rb'
ChefDeprecations/UsesRunCommandHelper:
Description: Use 'shell_out!' instead of the legacy 'run_command' helper for shelling out. The run_command helper was removed in Chef Infra Client 13.
+ StyleGuide: '#chefdeprecationsusesruncommandhelper'
Enabled: true
VersionAdded: '5.9.0'
Exclude:
- '**/metadata.rb'
- 'Rakefile'
ChefDeprecations/ChefHandlerUsesSupports:
Description: Use the type property instead of the deprecated supports property in the chef_handler resource. The supports property was removed in chef_handler cookbook version 3.0 (June 2017) and Chef Infra Client 14.0.
+ StyleGuide: '#chefdeprecationschefhandlerusessupports'
Enabled: true
VersionAdded: '5.9.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/DeprecatedYumRepositoryProperties:
Description: With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 several properties in the yum_repository resource were renamed. url -> baseurl, keyurl -> gpgkey, and mirrorexpire -> mirror_expire.
+ StyleGuide: '#chefdeprecationsdeprecatedyumrepositoryproperties'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/EOLAuditModeUsage:
Description: The beta Audit Mode feature in Chef Infra Client was removed in Chef Infra Client 15.0. Users should instead use InSpec and the audit cookbook. See https://www.inspec.io/ for more informmation.
+ StyleGuide: '#chefdeprecationseolauditmodeusage'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/ResourceInheritsFromCompatResource:
Description: HWRP style resource should inherit from the 'Chef::Resource' class and not the 'ChefCompat::Resource' class from the deprecated compat_resource cookbook.
+ StyleGuide: '#chefdeprecationsresourceinheritsfromcompatresource'
Enabled: true
VersionAdded: '5.10.0'
Include:
- '**/libraries/*.rb'
ChefDeprecations/VerifyPropertyUsesFileExpansion:
Description: Use the 'path' variable in the verify property and not the 'file' variable which was removed in Chef Infra Client 13.
+ StyleGuide: '#chefdeprecationsverifypropertyusesfileexpansion'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/PoiseArchiveUsage:
Description: The poise_archive resource in the deprecated poise-archive should be replaced with the archive_file resource found in Chef Infra Client 15+.
+ StyleGuide: '#chefdeprecationspoisearchiveusage'
Enabled: true
VersionAdded: '5.11.0'
ChefDeprecations/PartialSearchHelperUsage:
Description: Legacy partial_search usage should be updated to use :filter_result in the search helper instead.
+ StyleGuide: '#chefdeprecationspartialsearchhelperusage'
Enabled: true
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/SearchUsesPositionalParameters:
Description: Don't use deprecated positional parameters in cookbook search queries.
+ StyleGuide: '#chefdeprecationssearchusespositionalparameters'
Enabled: true
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/PartialSearchClassUsage:
Description: Legacy Chef::PartialSearch class usage should be updated to use the search helper instead with the filter_result key.
+ StyleGuide: '#chefdeprecationspartialsearchclassusage'
Enabled: true
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/Cheffile:
Description: The Libarian-Chef depsolving project is no longer maintained and should not be used for cookbook depsolving. Consider using Policyfiles instead.
+ StyleGuide: '#chefdeprecationscheffile'
Enabled: true
VersionAdded: '5.12.0'
Include:
- '**/Cheffile'
ChefDeprecations/LegacyNotifySyntax:
Description: Use the new-style notification syntax which allows you to notify resources defined later in a recipe or resource.
+ StyleGuide: '#chefdeprecationslegacynotifysyntax'
Enabled: true
VersionAdded: '5.13.0'
Exclude:
- '**/metadata.rb'
ChefDeprecations/NodeSetWithoutLevel:
Description: When setting a node attribute in Chef Infra Client 11 and later you must specify the precedence level.
+ StyleGuide: '#chefdeprecationsnodesetwithoutlevel'
Enabled: true
VersionAdded: '5.13.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
ChefDeprecations/ChefRewind:
Description: Use delete_resource / edit_resource instead of functionality in the deprecated chef-rewind gem
+ StyleGuide: '#chefdeprecationschefrewind'
Enabled: true
VersionAdded: '5.14.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
ChefDeprecations/RubyBlockCreateAction:
Description: Use the :run action in the ruby_block resource instead of the deprecated :create action
+ StyleGuide: '#chefdeprecationsrubyblockcreateaction'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefDeprecations/DeprecatedPlatformMethods:
Description: Use provider_for_action instead of the deprecated Chef::Platform methods in resources.
+ StyleGuide: '#chefdeprecationsdeprecatedplatformmethods'
Enabled: true
VersionAdded: '5.16.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
- '**/providers/*.rb'
ChefDeprecations/DeprecatedChefSpecPlatform:
Description: Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md. Fauxhai / ChefSpec will perform fuzzy matching on platform version so it's always best to be less specific ie. 10 instead of 10.3
+ StyleGuide: '#chefdeprecationsdeprecatedchefspecplatform'
Enabled: true
VersionAdded: '5.20.0'
Include:
- '**/spec/**/*.rb'
ChefDeprecations/WindowsFeatureServermanagercmd:
Description: The `windows_feature` resource no longer supports setting the `install_method` to `:servermanagercmd`. `:windows_feature_dism` or `:windows_feature_powershell` should be used instead.
+ StyleGuide: '#chefdeprecationswindowsfeatureservermanagercmd'
Enabled: true
VersionAdded: '5.22.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefDeprecations/DeprecatedWindowsVersionCheck:
Description: Don't use the deprecated older_than_win_2012_or_8? helper. Windows versions before 2012 and 8 are now end of life and this helper will always return false.
+ StyleGuide: '#chefdeprecationsdeprecatedwindowsversioncheck'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/ChefWindowsPlatformHelper:
Description: Use `platform?('windows')` instead of the legacy `Chef::Platform.windows?` helper.
+ StyleGuide: '#chefdeprecationschefwindowsplatformhelper'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/LogResourceNotifications:
Description: In Chef Infra Client 16 the log resource no longer notifies when logging so notifications should not be triggered from log resources. Use the notify_group resource instead to aggregate notifications.
+ StyleGuide: '#chefdeprecationslogresourcenotifications'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/ResourceWithoutNameOrProvides:
Description: In Chef Infra Client 16 and later legacy HWRP resources must use either `resource_name` or `provides` to define the resource name.
+ StyleGuide: '#chefdeprecationsresourcewithoutnameorprovides'
Enabled: true
VersionAdded: '6.0.0'
Include:
- '**/libraries/*.rb'
ChefDeprecations/WindowsVersionHelpers:
Description: Use node['platform_version'] data instead of the Windows::VersionHelper helper from the Windows cookbook.
+ StyleGuide: '#chefdeprecationswindowsversionhelpers'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/PowershellCookbookHelpers:
Description: Use node['powershell']['version'] or the new powershell_version helper available in Chef Infra Client 16+ instead of the deprecated PowerShell cookbook helpers.
+ StyleGuide: '#chefdeprecationspowershellcookbookhelpers'
Enabled: true
VersionAdded: '6.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefDeprecations/DeprecatedShelloutMethods:
Description: Many legacy specialized shell_out methods were replaced in Chef Infra Client 14.3 and removed in Chef Infra Client 15. Use shell_out and any additional options if necessary.
+ StyleGuide: '#chefdeprecationsdeprecatedshelloutmethods'
Enabled: true
VersionAdded: '6.3.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefDeprecations/Ruby27KeywordArgumentWarnings:
Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
+ StyleGuide: '#chefdeprecationsruby27keywordargumentwarnings'
Enabled: true
VersionAdded: '6.5.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
###############################
# ChefModernize: Cleaning up legacy code and using new built-in resources
###############################
+ChefModernize:
+ StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chefmodernize.md
+
ChefModernize/LegacyBerksfileSource:
Description: Do not use legacy Berksfile community sources. Use Chef Supermarket instead.
+ StyleGuide: '#chefmodernizelegacyberksfilesource'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/Berksfile'
ChefModernize/WhyRunSupportedTrue:
Description: whyrun_supported? no longer needs to be set to true as it is the default in Chef 13+
+ StyleGuide: '#chefmodernizewhyrunsupportedtrue'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
- '**/libraries/*.rb'
ChefModernize/UnnecessaryDependsChef14:
Description: Don't depend on cookbooks made obsolete by Chef Infra Client 14+. These community cookbooks contain resources that are now included in Chef Infra Client itself.
+ StyleGuide: '#chefmodernizeunnecessarydependschef14'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/metadata.rb'
ChefModernize/RespondToInMetadata:
- Description: It is no longer necessary to use respond_to? in metadata.rb in Chef 12.15 and later
+ Description: It is no longer necessary to use respond_to? in metadata.rb in Chef Infra Client 12.15 and later
+ StyleGuide: '#chefmodernizerespondtoinmetadata'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/metadata.rb'
ChefModernize/RespondToResourceName:
Description: respond_to?(:resource_name) in resources is no longer necessary in Chef Infra Client 12.5+
+ StyleGuide: '#chefmodernizerespondtoresourcename'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefModernize/RespondToProvides:
Description: respond_to?(:provides) in resources is no longer necessary in Chef Infra Client 12+
+ StyleGuide: '#chefmodernizerespondtoprovides'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/providers/*.rb'
- '**/libraries/*.rb'
ChefModernize/SetOrReturnInResources:
Description: Do not use set_or_return within a method to define a property for a resource. Use the property method instead, which supports validation, reporting, and documentation functionality.
+ StyleGuide: '#chefmodernizesetorreturninresources'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefModernize/CustomResourceWithAttributes:
Description: Custom Resources should contain properties not attributes.
+ StyleGuide: '#chefmodernizecustomresourcewithattributes'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/resources/*.rb'
ChefModernize/IncludingAptDefaultRecipe:
Description: Do not include the Apt default recipe to update package cache. Instead use the apt_update resource, which is built into Chef Infra Client 12.7 and later.
+ StyleGuide: '#chefmodernizeincludingaptdefaultrecipe'
Enabled: true
VersionAdded: '5.3.0'
Exclude:
- '**/metadata.rb'
ChefModernize/IncludingWindowsDefaultRecipe:
Description: Do not include the Windows default recipe, which only installs win32 gems already included in Chef Infra Client
+ StyleGuide: '#chefmodernizeincludingwindowsdefaultrecipe'
Enabled: true
VersionAdded: '5.3.0'
Exclude:
- '**/metadata.rb'
ChefModernize/DefinesChefSpecMatchers:
Description: ChefSpec matchers are now auto generated by ChefSpec 7.1+ and do not need to be defined in a cookbook
+ StyleGuide: '#chefmodernizedefineschefspecmatchers'
Enabled: true
VersionAdded: '5.3.0'
Include:
- '**/libraries/*.rb'
ChefModernize/ExecuteAptUpdate:
Description: Use the apt_update resource instead of the execute resource to run an apt-get update package cache update
+ StyleGuide: '#chefmodernizeexecuteaptupdate'
Enabled: true
VersionAdded: '5.3.0'
Exclude:
- '**/metadata.rb'
ChefModernize/MinitestHandlerUsage:
Description: Use Chef InSpec for testing instead of the Minitest Handler cookbook pattern.
+ StyleGuide: '#chefmodernizeminitesthandlerusage'
Enabled: true
VersionAdded: '5.4.0'
Include:
- '**/metadata.rb'
ChefModernize/IncludingMixinShelloutInResources:
Description: There is no need to include Chef::Mixin::ShellOut or Chef::Mixin::PowershellOut in resources or providers as this is already done by Chef Infra Client 12.4+.
+ StyleGuide: '#chefmodernizeincludingmixinshelloutinresources'
Enabled: true
VersionAdded: '5.4.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
ChefModernize/UseBuildEssentialResource:
Description: Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
+ StyleGuide: '#chefmodernizeusebuildessentialresource'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
ChefModernize/WindowsZipfileUsage:
Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the windows_zipfile from the Windows cookbook
+ StyleGuide: '#chefmodernizewindowszipfileusage'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/metadata.rb'
ChefModernize/SevenZipArchiveResource:
Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the seven_zip_archive
+ StyleGuide: '#chefmodernizesevenziparchiveresource'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefModernize/LibarchiveFileResource:
Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the libarchive file resource
+ StyleGuide: '#chefmodernizelibarchivefileresource'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefModernize/PowershellScriptExpandArchive:
Description: Use the archive_file resource built into Chef Infra Client 15+ instead of using Expand-Archive in a powershell_script resource
+ StyleGuide: '#chefmodernizepowershellscriptexpandarchive'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefModernize/PowershellInstallPackage:
Description: Use the package resource built into Chef Infra Client instead of using Install-Package in a powershell_script resource
+ StyleGuide: '#chefmodernizepowershellinstallpackage'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefModernize/PowershellInstallWindowsFeature:
Description: Use the windows_feature resource built into Chef Infra Client 13+ instead of using Install-WindowsFeature or Add-WindowsFeature in a powershell_script resource
+ StyleGuide: '#chefmodernizepowershellinstallwindowsfeature'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefModernize/ShellOutToChocolatey:
Description: Use the Chocolatey resources built into Chef Infra Client instead of shelling out to the choco command
+ StyleGuide: '#chefmodernizeshellouttochocolatey'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
ChefModernize/CronManageResource:
Description: The cron_manage resource was renamed to cron_access in the 6.1 release of the cron cookbook and later shipped in Chef Infra Client 14.4. The new resource name should be used.
+ StyleGuide: '#chefmodernizecronmanageresource'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/UsesZypperRepo:
Description: The zypper_repo resource was renamed zypper_repository when it was added to Chef Infra Client 13.3.
+ StyleGuide: '#chefmodernizeuseszypperrepo'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/DependsOnZypperCookbook:
Description: Don't include the zypper cookbook as the zypper_repository resource is built into Chef Infra Client 13.3+
+ StyleGuide: '#chefmodernizedependsonzyppercookbook'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/ExecuteTzUtil:
Description: Use the timezone resource included in Chef Infra Client 14.6+ instead of shelling out to tzutil
+ StyleGuide: '#chefmodernizeexecutetzutil'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/OpensslRsaKeyResource:
Description: The openssl_rsa_key resource was renamed to openssl_rsa_private_key in Chef Infra Client 14.0. The new resource name should be used.
+ StyleGuide: '#chefmodernizeopensslrsakeyresource'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/OpensslX509Resource:
Description: The openssl_x509 resource was renamed to openssl_x509_certificate in Chef Infra Client 14.4. The new resource name should be used.
+ StyleGuide: '#chefmodernizeopensslx509resource'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/OsxConfigProfileResource:
Description: The osx_config_profile resource was renamed to osx_profile. The new resource name should be used.
+ StyleGuide: '#chefmodernizeosxconfigprofileresource'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/SysctlParamResource:
Description: The sysctl_param resource was renamed to sysctl when it was added to Chef Infra Client 14.0. The new resource name should be used.
+ StyleGuide: '#chefmodernizesysctlparamresource'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/MacOsXUserdefaults:
Description: The mac_os_x_userdefaults resource was renamed to macos_userdefaults when it was added to Chef Infra Client 14.0. The new resource name should be used.
+ StyleGuide: '#chefmodernizemacosxuserdefaults'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
ChefModernize/PowerShellGuardInterpreter:
Description: PowerShell is already set as the default guard interpreter for powershell_script resources in Chef Infra Client 13 and later and does not need to be specified.
+ StyleGuide: '#chefmodernizepowershellguardinterpreter'
Enabled: true
VersionAdded: '5.9.0'
Exclude:
- '**/metadata.rb'
ChefModernize/DefaultActionFromInitialize:
Description: The default actions can now be specified using the `default_action` helper instead of using the @action variable in the resource provider initialize method.
+ StyleGuide: '#chefmodernizedefaultactionfrominitialize'
Enabled: true
VersionAdded: '5.10.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
- '**/libraries/*.rb'
ChefModernize/ResourceNameFromInitialize:
Description: The name of a resource can be set with the "resource_name" helper instead of using the initialize method.
+ StyleGuide: '#chefmodernizeresourcenamefrominitialize'
Enabled: true
VersionAdded: '5.10.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
- '**/libraries/*.rb'
ChefModernize/Definitions:
Description: Legacy Chef Infra definitions should be rewritten as custom resources to take full advantage of the Chef Infra feature set.
+ StyleGuide: '#chefmodernizedefinitions'
Enabled: true
VersionAdded: '5.11.0'
Include:
- '**/definitions/*.rb'
ChefModernize/IfProvidesDefaultAction:
- Description: if defined?(default_action) is no longer necessary in Chef Resources as default_action shipped in Chef 10.8.
+ Description: if defined?(default_action) is no longer necessary in Chef Infra resources as default_action shipped in Chef Infra Client 10.8.
+ StyleGuide: '#chefmodernizeifprovidesdefaultaction'
Enabled: true
VersionAdded: '5.12.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefModernize/ZipfileResource:
Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the zipfile resource from the zipfile cookbook.
+ StyleGuide: '#chefmodernizezipfileresource'
Enabled: true
VersionAdded: '5.12.0'
ChefModernize/UnnecessaryMixlibShelloutRequire:
Description: Chef Infra Client 12.4 and later include mixlib/shellout automatically in resources and providers.
+ StyleGuide: '#chefmodernizeunnecessarymixlibshelloutrequire'
Enabled: true
VersionAdded: '5.12.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
ChefModernize/EmptyResourceInitializeMethod:
Description: There is no need for an empty initialize method in a resource
+ StyleGuide: '#chefmodernizeemptyresourceinitializemethod'
Enabled: true
VersionAdded: '5.13.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
ChefModernize/ChefGemNokogiri:
Description: The nokogiri gem ships in Chef Infra Client 12+ and does not need to be installed before being used.
+ StyleGuide: '#chefmodernizechefgemnokogiri'
Enabled: true
VersionAdded: '5.14.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
ChefModernize/PropertyWithNameAttribute:
Description: Resource property sets name_attribute not name_property
+ StyleGuide: '#chefmodernizepropertywithnameattribute'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefModernize/IncludingOhaiDefaultRecipe:
Description: Use the ohai_plugin resource to ship custom Ohai plugins instead of using the ohai::default recipe. If you're not shipping custom Ohai plugins, then you can remove this recipe entirely.
+ StyleGuide: '#chefmodernizeincludingohaidefaultrecipe'
Enabled: true
VersionAdded: '5.4.0'
VersionChanged: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefModernize/AllowedActionsFromInitialize:
Description: The allowed actions of a resource can be set with the "allowed_actions" helper instead of using the initialize method.
+ StyleGuide: '#chefmodernizeallowedactionsfrominitialize'
Enabled: true
VersionAdded: '5.15.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefModernize/FoodcriticComments:
Description: Remove legacy code comments that disable Foodcritic rules. These comments are no longer necessary if you've migrated from Foodcritic to Cookstyle for cookbook linting.
+ StyleGuide: '#chefmodernizefoodcriticcomments'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/Berksfile'
ChefModernize/ExecuteScExe:
Description: Chef Infra Client 14.0 and later includes :create, :delete, and :configure actions with the full idempotency of the windows_service resource. See the windows_service documentation at https://docs.chef.io/resource_windows_service.html for additional details on creating services with the windows_service resource
+ StyleGuide: '#chefmodernizeexecutescexe'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/WindowsScResource:
Description: Chef Infra Client 14.0 and later includes :create, :delete, and :configure actions without the need for the sc cookbook dependency. See the windows_service documentation at https://docs.chef.io/resource_windows_service.html for additional details.
+ StyleGuide: '#chefmodernizewindowsscresource'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/ExecuteSleep:
Description: Chef Infra Client 15.5 and later include a chef_sleep resource that should be used to sleep between executing resources if necessary instead of using the bash or execute resources to run the sleep command.
+ StyleGuide: '#chefmodernizeexecutesleep'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/DslIncludeInResource:
Description: 'There is no need to include Chef::DSL::Recipe or Chef::DSL::IncludeRecipe classes in resources or providers as this is done automatically.'
+ StyleGuide: '#chefmodernizedslincludeinresource'
Enabled: true
VersionAdded: '5.17.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
ChefModernize/ResourceForcingCompileTime:
Description: The hostname, build_essential, chef_gem, and ohai_hint resources include 'compile_time' properties, which should be used to force the resources to run at compile time by setting `compile_time true`.
+ StyleGuide: '#chefmodernizeresourceforcingcompiletime'
Enabled: true
VersionAdded: '5.18.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/ExecuteSysctl:
Description: Chef Infra Client 14.0 and later includes a sysctl resource that should be used to idempotently load sysctl values instead of templating files and using execute to load them.
+ StyleGuide: '#chefmodernizeexecutesysctl'
Enabled: true
VersionAdded: '5.18.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/SimplifyAptPpaSetup:
Description: The apt_repository resource allows setting up PPAs without using the full URL to ppa.launchpad.net.
+ StyleGuide: '#chefmodernizesimplifyaptppasetup'
Enabled: true
VersionAdded: '5.21.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/UseRequireRelative:
Description: Instead of using require with a File.expand_path and __FILE__ use the simpler require_relative method.
+ StyleGuide: '#chefmodernizeuserequirerelative'
Enabled: true
VersionAdded: '5.22.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/NodeInitPackage:
Description: Use node['init_package'] to check for systemd instead of reading the contents of '/proc/1/comm'
+ StyleGuide: '#chefmodernizenodeinitpackage'
Enabled: true
VersionAdded: '5.22.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefModernize/WindowsRegistryUAC:
Description: Chef Infra Client 15.0 and later includes a windows_uac resource that should be used to set Windows UAC values instead of setting registry keys directly.
+ StyleGuide: '#chefmodernizewindowsregistryuac'
Enabled: true
VersionAdded: '5.22.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/UseMultipackageInstalls:
Description: Pass an array of packages to package resources instead of interating over an array of packages when using multi-package capable package subystem such as apt, yum, chocolatey, dnf, or zypper. Multipackage installs are faster and simplify logs.
+ StyleGuide: '#chefmodernizeusemultipackageinstalls'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefModernize/ProvidesFromInitialize:
Description: Provides should be set using the `provides` resource DSL method instead of instead of setting @provides in the initialize method.
+ StyleGuide: '#chefmodernizeprovidesfrominitialize'
Enabled: true
VersionAdded: '6.0.0'
Include:
- '**/resources/*.rb'
- '**/providers/*.rb'
- '**/libraries/*.rb'
ChefModernize/DatabagHelpers:
Description: Use the `data_bag_item` helper instead of `Chef::DataBagItem.load` or `Chef::EncryptedDataBagItem.load`.
+ StyleGuide: '#chefmodernizedatabaghelpers'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefModernize/NodeRolesInclude:
Description: Use `node.role?('foo')` to check if a node includes a role instead of `node['roles'].include?('foo')`.
+ StyleGuide: '#chefmodernizenoderolesinclude'
Enabled: true
VersionAdded: '6.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefModernize/RespondToCompileTime:
Description: There is no need to check if the chef_gem resource supports compile_time as Chef Infra Client 12.1 and later support the compile_time property.
+ StyleGuide: '#chefmodernizeresondtocompiletime'
Enabled: true
VersionAdded: '6.3.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefModernize/ShellOutHelper:
Description: Use the built-in shell_out helper available in Chef Infra Client 12.11+ instead of calling Mixlib::ShellOut.new('foo').run_command.
+ StyleGuide: '#chefmodernizeshellouthelper'
Enabled: true
VersionAdded: '6.5.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
@@ -1312,230 +1524,263 @@
###############################
# ChefRedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
###############################
+ChefRedundantCode:
+ StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chefredundantcode.md
+
ChefRedundantCode/ConflictsMetadata:
Description: Don't use the deprecated 'conflicts' metadata value
+ StyleGuide: '#chefredundantcodeconflictsmetadata'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/SuggestsMetadata:
Description: The suggests metadata.rb method is not used and is unnecessary in cookbooks.
+ StyleGuide: '#chefredundantcodesuggestsmetadata'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/ProvidesMetadata:
Description: The provides metadata.rb method is not used and is unnecessary in cookbooks.
+ StyleGuide: '#chefredundantcodeprovidesmetadata'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/ReplacesMetadata:
Description: The replaces metadata.rb method is not used and is unnecessary in cookbooks.
+ StyleGuide: '#chefredundantcodereplacesmetadata'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/AttributeMetadata:
Description: The attribute metadata.rb method is not used and is unnecessary in cookbooks.
+ StyleGuide: '#chefredundantcodeattributemetadata'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/LongDescriptionMetadata:
Description: The long_description metadata.rb method is not used and is unnecessary in cookbooks
+ StyleGuide: '#chefredundantcodelongdescriptionmetadata'
Enabled: true
VersionAdded: '5.2.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/RecipeMetadata:
Description: The recipe metadata.rb method is not used and is unnecessary in cookbooks. Recipes should be documented in the README.md file instead.
+ StyleGuide: '#chefredundantcoderecipemetadata'
Enabled: true
VersionAdded: '5.6.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/ResourceWithNothingAction:
Description: There is no need to define a :nothing action in your resource as Chef Infra Client provides the :nothing action by default for every resource.
+ StyleGuide: '#chefredundantcoderesourcewithnothingaction'
Enabled: true
VersionAdded: '5.12.0'
VersionChanged: '5.15.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
- '**/providers/*.rb'
ChefRedundantCode/UnnecessaryNameProperty:
Description: There is no need to define a property named :name in a resource as Chef Infra defines that property for all resources by default.
+ StyleGuide: '#chefredundantcodeunnecessarynameproperty'
Enabled: true
VersionAdded: '5.8.0'
VersionChanged: '5.15.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefRedundantCode/PropertyWithRequiredAndDefault:
Description: Resource property should not be both required and have a default value
+ StyleGuide: '#chefredundantcodepropertywithrequiredanddefault'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefRedundantCode/NamePropertyIsRequired:
Description: Resource properties marked as name properties should not also be required properties
+ StyleGuide: '#chefredundantcodenamepropertyisrequired'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefRedundantCode/CustomResourceWithAllowedActions:
Description: It is not necessary to set `actions` or `allowed_actions` in custom resources as Chef Infra Client determines these automatically from the set of all actions defined in the resource.
+ StyleGuide: '#chefredundantcodecustomresourcewithallowedactions'
Enabled: true
VersionAdded: '5.2.0'
VersionChanged: '5.15.0'
Include:
- '**/resources/*.rb'
ChefRedundantCode/SensitivePropertyInResource:
Description: Every Chef Infra resources already include a sensitive property with a default value of false.
+ StyleGuide: '#chefredundantcodesensitivepropertyinresource'
Enabled: true
VersionAdded: '5.16.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefRedundantCode/UnnecessaryDesiredState:
Description: 'There is no need to set a property to desired_state: true as all properties have a desired_state of true by default.'
+ StyleGuide: '#chefredundantcodeunnecessarydesiredstate'
Enabled: true
VersionAdded: '5.16.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefRedundantCode/AptRepositoryNotifiesAptUpdate:
Description: There is no need to notify an apt-get update when an apt_repository is created as this is done automatically by the apt_repository resource.
+ StyleGuide: '#chefredundantcodeaptrepositorynotifiesaptupdate'
Enabled: true
VersionAdded: '5.17.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefRedundantCode/AptRepositoryDistributionDefault:
Description: There is no need to pass `distribution node['lsb']['codename']` to an apt_repository resource as this is done automatically by the apt_repository resource.
+ StyleGuide: '#chefredundantcodeaptrepositorydistributiondefault'
Enabled: true
VersionAdded: '5.17.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
ChefRedundantCode/GroupingMetadata:
Description: The grouping metadata.rb method is not used and is unnecessary in cookbooks.
+ StyleGuide: '#chefredundantcodegroupingmetadata'
Enabled: true
VersionAdded: '5.19.0'
Include:
- '**/metadata.rb'
ChefRedundantCode/StringPropertyWithNilDefault:
Description: Properties have a nil value by default so there is no need to set the default value to nil.
+ StyleGuide: '#chefredundantcodestringpropertywithnildefault'
Enabled: true
VersionAdded: '5.21.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefRedundantCode/PropertySplatRegex:
Description: There is no need to validate the input of properties in resources using a regex value that will always pass.
+ StyleGuide: '#chefredundantcodepropertysplatregex'
Enabled: true
VersionAdded: '5.21.0'
Include:
- '**/resources/*.rb'
- '**/libraries/*.rb'
ChefRedundantCode/UseCreateIfMissing:
Description: Use the :create_if_missing action instead of not_if with a ::File.exist(FOO) check.
+ StyleGuide: '#chefredundantcodeusecreateifmissing'
Enabled: true
VersionAdded: '6.2.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
###############################
-# Migrating to new patterns
+# ChefEffortless: Migrating to new patterns
###############################
+ChefEffortless:
+ StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chefeffortless.md
+
ChefEffortless/CookbookUsesSearch:
Description: Cookbook uses search, which cannot be used in the Effortless Infra pattern
+ StyleGuide: '#chefeffortlesscookbookusessearch'
Enabled: false
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefEffortless/CookbookUsesDatabags:
Description: Cookbook uses data bags, which cannot be used in the Effortless Infra pattern
+ StyleGuide: '#chefeffortlesscookbookusesdatabags'
Enabled: false
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefEffortless/CookbookUsesEnvironmments:
Description: Cookbook uses environments, which cannot be used in the Effortless Infra pattern
+ StyleGuide: '#chefeffortlesscookbookusesenvironments'
Enabled: false
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefEffortless/CookbookUsesPolicygroups:
Description: Cookbook uses Policy Groups, which cannot be used in the Effortless Infra pattern
+ StyleGuide: '#chefeffortlesscookbookusespolicygroups'
Enabled: false
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefEffortless/CookbookUsesRoles:
Description: Cookbook uses Roles, which cannot be used in the Effortless Infra pattern
+ StyleGuide: '#chefeffortlesscookbookusesroles'
Enabled: false
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefEffortless/SearchForEnvironmentsOrRoles:
Description: Cookbook uses search with a node query that looks for a role or environment
+ StyleGuide: '#chefeffortlesssearchforenvironmentsorroles'
Enabled: false
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
ChefEffortless/Berksfile:
Description: Policyfiles should be used for cookbook dependency solving instead of a Berkshelf Berksfile.
+ StyleGuide: '#chefeffortlessberksfile'
Enabled: false
VersionAdded: '5.12.0'
Include:
- '**/Berksfile'