cookstyle 7.11.1 → 7.12.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/cookstyle.yml +27 -8
- data/lib/cookstyle/version.rb +1 -1
- data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/invalid_default_action.rb +10 -11
- data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +1 -2
- data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_family_helper.rb +1 -1
- data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +0 -1
- data/lib/rubocop/cop/chef/correctness/metadata_missing_name.rb +9 -10
- data/lib/rubocop/cop/chef/correctness/node_normal.rb +2 -6
- data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +2 -6
- data/lib/rubocop/cop/chef/correctness/node_save.rb +1 -3
- data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +1 -2
- data/lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb +1 -1
- data/lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb +1 -3
- data/lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb +0 -1
- data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +0 -1
- data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +1 -1
- data/lib/rubocop/cop/chef/correctness/service_resource.rb +0 -1
- data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +0 -1
- data/lib/rubocop/cop/chef/correctness/tmp_path.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/cb_depends_on_self.rb +11 -12
- data/lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/chef_shellout.rb +2 -5
- data/lib/rubocop/cop/chef/deprecation/chef_sugar_helpers.rb +22 -23
- data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/cheffile.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_actions.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/easy_install.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/erl_call.rb +1 -2
- data/lib/rubocop/cop/chef/deprecation/execute_path_property.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/execute_relative_creates_without_cwd.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_unified_mode_true.rb +86 -0
- data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/macos_userdefaults_global_property.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/resource_without_unified_mode_true.rb +84 -0
- data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/{ use_automatic_resource_name.rb → use_automatic_resource_name.rb} +0 -0
- data/lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb +0 -1
- data/lib/rubocop/cop/chef/effortless/berksfile.rb +0 -1
- data/lib/rubocop/cop/chef/effortless/chef_vault_used.rb +0 -2
- data/lib/rubocop/cop/chef/effortless/depends_chef_vault.rb +0 -2
- data/lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/resource_set_or_return.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/resource_with_attributes.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/seven_zip_archive.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +37 -18
- data/lib/rubocop/cop/chef/modernize/zipfile_resource.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/attribute_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/conflicts_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/custom_resource_with_allowed_actions.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/grouping_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/long_description_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/provides_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/recipe_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/replaces_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/suggests_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/sharing/default_maintainer_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/sharing/empty_metadata_field.rb +0 -1
- data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +0 -1
- data/lib/rubocop/cop/chef/style/attribute_keys.rb +0 -1
- data/lib/rubocop/cop/chef/style/chef_whaaat.rb +0 -1
- data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +0 -1
- data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +0 -1
- data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +0 -1
- data/lib/rubocop/cop/chef/style/comments_format.rb +0 -1
- data/lib/rubocop/cop/chef/style/file_mode.rb +0 -1
- data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +0 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7958b406a903a1393062af1fea9eb412dea315a39ba72f0614be9e50a61f48f5
|
4
|
+
data.tar.gz: 65f9399991eb1969d32675ea92baf7515d8631a34f775599354e222a6e67539d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f11395e2998b9527c94071305e61abd63301a8f283ab5b032eb26fb842166c81ecaff34372fcaadf51e9467b56e10d14bb53f4fefdf6925e192277e9087f6068
|
7
|
+
data.tar.gz: dbea35f94ed1240fab1e755d993906811e34420dcefa0f4d707ed5de3220519471547a8ccfcb690d99819c29fd4d53c12ae3b4f00a18d4e3448e5b5d21e7fca0
|
data/config/cookstyle.yml
CHANGED
@@ -3,8 +3,8 @@ AllCops:
|
|
3
3
|
TargetRubyVersion: 2.5
|
4
4
|
TargetChefVersion: ~
|
5
5
|
Exclude:
|
6
|
-
- '
|
7
|
-
- '
|
6
|
+
- '**/files/**/*'
|
7
|
+
- '**/vendor/**/*'
|
8
8
|
- Guardfile
|
9
9
|
|
10
10
|
###############################
|
@@ -221,7 +221,7 @@ Chef/Correctness/MetadataMissingName:
|
|
221
221
|
- '**/metadata.rb'
|
222
222
|
|
223
223
|
Chef/Correctness/BlockGuardWithOnlyString:
|
224
|
-
Description: A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it to be executed as Ruby code which will always
|
224
|
+
Description: A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it to be executed as Ruby code which will always return true instead of a shell command that will actually run.
|
225
225
|
StyleGuide: 'chef_correctness_blockguardwithonlystring'
|
226
226
|
Enabled: true
|
227
227
|
VersionAdded: '5.2.0'
|
@@ -584,7 +584,7 @@ Chef/Deprecations/NodeSetUnless:
|
|
584
584
|
- '**/Berksfile'
|
585
585
|
|
586
586
|
Chef/Deprecations/EpicFail:
|
587
|
-
Description: Use ignore_failure
|
587
|
+
Description: Use `ignore_failure` in resources to continue when failures occur instead of the deprecated `epic_fail` property
|
588
588
|
StyleGuide: 'chef_deprecations_epicfail'
|
589
589
|
Enabled: true
|
590
590
|
VersionAdded: '5.1.0'
|
@@ -843,7 +843,7 @@ Chef/Deprecations/DeprecatedYumRepositoryProperties:
|
|
843
843
|
- '**/Berksfile'
|
844
844
|
|
845
845
|
Chef/Deprecations/EOLAuditModeUsage:
|
846
|
-
Description: The beta Audit Mode feature in Chef Infra Client was removed in Chef Infra Client 15.0.
|
846
|
+
Description: The beta Audit Mode feature in Chef Infra Client was removed in Chef Infra Client 15.0.
|
847
847
|
StyleGuide: 'chef_deprecations_eolauditmodeusage'
|
848
848
|
Enabled: true
|
849
849
|
VersionAdded: '5.10.0'
|
@@ -1071,7 +1071,7 @@ Chef/Deprecations/ChefDKGenerators:
|
|
1071
1071
|
- '**/Berksfile'
|
1072
1072
|
|
1073
1073
|
Chef/Deprecations/ChefHandlerRecipe:
|
1074
|
-
Description: There is no need to include the empty and deprecated chef_handler::default recipe
|
1074
|
+
Description: There is no need to include the empty and deprecated chef_handler::default recipe to use the chef_handler resource.
|
1075
1075
|
StyleGuide: 'chef_deprecations_chefhandlerrecipe'
|
1076
1076
|
Enabled: true
|
1077
1077
|
VersionAdded: '6.12.0'
|
@@ -1107,7 +1107,7 @@ Chef/Deprecations/CookbooksDependsOnSelf:
|
|
1107
1107
|
- '**/metadata.rb'
|
1108
1108
|
|
1109
1109
|
Chef/Deprecations/ChefShellout:
|
1110
|
-
Description: Don't use deprecated Chef::ShellOut which was removed in Chef Infra Client 13. Use Mixlib::ShellOut instead, which behaves identically.
|
1110
|
+
Description: Don't use the deprecated `Chef::ShellOut` class which was removed in Chef Infra Client 13. Use the `Mixlib::ShellOut` class instead, which behaves identically.
|
1111
1111
|
StyleGuide: 'chef_deprecations_chefshellout'
|
1112
1112
|
Enabled: true
|
1113
1113
|
VersionAdded: '6.17.0'
|
@@ -1190,6 +1190,24 @@ Chef/Deprecations/ChefSugarHelpers:
|
|
1190
1190
|
- '**/Berksfile'
|
1191
1191
|
- '**/Rakefile'
|
1192
1192
|
|
1193
|
+
Chef/Deprecations/HWRPWithoutUnifiedTrue:
|
1194
|
+
Description: Set `unified_mode true` in Chef Infra Client 15.3+ HWRP style custom resources to ensure they work correctly in Chef Infra Client 18 (April 2022) when Unified Mode becomes the default.
|
1195
|
+
StyleGuide: 'chef_deprecations_hwrpwithoutunifiedtrue'
|
1196
|
+
Enabled: true
|
1197
|
+
VersionAdded: '7.12.0'
|
1198
|
+
Include:
|
1199
|
+
- '**/libraries/*.rb'
|
1200
|
+
|
1201
|
+
Chef/Deprecations/ResourceWithoutUnifiedTrue:
|
1202
|
+
Description: Set `unified_mode true` in Chef Infra Client 15.3+ custom resources to ensure they work correctly in Chef Infra Client 18 (April 2022) when Unified Mode becomes the default.
|
1203
|
+
StyleGuide: 'chef_deprecations_resourcewithoutunifiedtrue'
|
1204
|
+
Enabled: true
|
1205
|
+
VersionAdded: '7.12.0'
|
1206
|
+
Include:
|
1207
|
+
- '**/resources/*.rb'
|
1208
|
+
Exclude:
|
1209
|
+
- '**/spec/**/*.rb'
|
1210
|
+
|
1193
1211
|
###############################
|
1194
1212
|
# Chef/Modernize: Cleaning up legacy code and using new built-in resources
|
1195
1213
|
###############################
|
@@ -2247,8 +2265,9 @@ Style/Proc:
|
|
2247
2265
|
Enabled: true
|
2248
2266
|
Style/RaiseArgs:
|
2249
2267
|
Enabled: true
|
2268
|
+
# disabled for now as this breaks ruby_block resources
|
2250
2269
|
Style/RedundantBegin:
|
2251
|
-
Enabled:
|
2270
|
+
Enabled: false
|
2252
2271
|
Style/RedundantException:
|
2253
2272
|
Enabled: true
|
2254
2273
|
Style/RedundantFreeze:
|
data/lib/cookstyle/version.rb
CHANGED
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Correctness
|
22
|
-
# A resource guard (not_if/only_if) that is a string should not be wrapped in `{}`. Wrapping a guard string in {} causes it to be executed as Ruby code which will always
|
22
|
+
# A resource guard (not_if/only_if) that is a string should not be wrapped in `{}`. Wrapping a guard string in {} causes it to be executed as Ruby code which will always return true instead of a shell command that will actually run.
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -40,7 +40,7 @@ module RuboCop
|
|
40
40
|
class BlockGuardWithOnlyString < Base
|
41
41
|
extend AutoCorrector
|
42
42
|
|
43
|
-
MSG = 'A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it to be executed as Ruby code which will always
|
43
|
+
MSG = 'A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it to be executed as Ruby code which will always return true instead of a shell command that will actually run.'
|
44
44
|
|
45
45
|
def_node_matcher :block_guard_with_only_string?, <<-PATTERN
|
46
46
|
(block (send nil? ${:not_if :only_if}) (args) (str $_) )
|
@@ -15,21 +15,20 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
19
18
|
module RuboCop
|
20
19
|
module Cop
|
21
20
|
module Chef
|
22
|
-
# Default actions in resources should be symbols or an array of symbols.
|
23
|
-
#
|
24
|
-
# @example
|
25
|
-
#
|
26
|
-
# #### incorrect
|
27
|
-
# default_action 'create'
|
28
|
-
#
|
29
|
-
# #### correct
|
30
|
-
# default_action :create
|
31
|
-
#
|
32
21
|
module Correctness
|
22
|
+
# Default actions in resources should be symbols or an array of symbols.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### incorrect
|
27
|
+
# default_action 'create'
|
28
|
+
#
|
29
|
+
# #### correct
|
30
|
+
# default_action :create
|
31
|
+
#
|
33
32
|
class InvalidDefaultAction < Base
|
34
33
|
MSG = 'Default actions in resources should be symbols or an array of symbols.'
|
35
34
|
RESTRICT_ON_SEND = [:default_action].freeze
|
@@ -15,12 +15,11 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
19
18
|
module RuboCop
|
20
19
|
module Cop
|
21
20
|
module Chef
|
22
21
|
module Correctness
|
23
|
-
# metadata.rb supports methods should contain valid platforms. See [Infra Language: Platform](https://docs.chef.io/infra_language/checking_platforms/#platform-values) for a list of many common platform values.
|
22
|
+
# metadata.rb `supports` methods should contain valid platforms. See [Infra Language: Platform](https://docs.chef.io/infra_language/checking_platforms/#platform-values) for a list of many common platform values.
|
24
23
|
#
|
25
24
|
# @example
|
26
25
|
#
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Correctness
|
22
|
-
# Pass valid
|
22
|
+
# Pass valid platform families to the value_for_platform_family helper. See [Infra Language: Platform Family](https://docs.chef.io/infra_language/checking_platforms/#platform_family-values) for a complete list of platform families.
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -15,28 +15,27 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
19
18
|
module RuboCop
|
20
19
|
module Cop
|
21
20
|
module Chef
|
22
|
-
# metadata.rb needs to include the name method or it will fail on Chef Infra Client 12 and later.
|
23
|
-
#
|
24
|
-
# @example
|
25
|
-
#
|
26
|
-
# #### correct
|
27
|
-
# name 'foo'
|
28
|
-
#
|
29
21
|
module Correctness
|
22
|
+
# metadata.rb needs to include the name method or it will fail on Chef Infra Client 12 and later.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### correct
|
27
|
+
# name 'foo'
|
28
|
+
#
|
30
29
|
class MetadataMissingName < Base
|
31
30
|
include RangeHelp
|
32
31
|
|
33
32
|
MSG = 'metadata.rb needs to include the name method or it will fail on Chef Infra Client 12 and later.'
|
34
33
|
|
35
|
-
def_node_search :cb_name
|
34
|
+
def_node_search :cb_name?, '(send nil? :name str ...)'
|
36
35
|
|
37
36
|
def on_new_investigation
|
38
37
|
# Using range similar to RuboCop::Cop::Naming::Filename (file_name.rb)
|
39
|
-
return if cb_name(processed_source.ast)
|
38
|
+
return if cb_name?(processed_source.ast)
|
40
39
|
range = source_range(processed_source.buffer, 1, 0)
|
41
40
|
add_offense(range, message: MSG, severity: :refactor) do |_corrector|
|
42
41
|
path = processed_source.path
|
@@ -18,13 +18,9 @@ module RuboCop
|
|
18
18
|
module Cop
|
19
19
|
module Chef
|
20
20
|
module Correctness
|
21
|
-
# Normal attributes are discouraged since their semantics differ importantly from the
|
22
|
-
# default and override levels. Their values persist in the node object even after
|
23
|
-
# all code referencing them has been deleted, unlike default and override.
|
21
|
+
# Normal attributes are discouraged since their semantics differ importantly from the default and override levels. Their values persist in the node object even after all code referencing them has been deleted, unlike default and override.
|
24
22
|
#
|
25
|
-
# Code should be updated to use default or override levels, but this will change
|
26
|
-
# attribute merging behavior so needs to be validated manually and force_default or
|
27
|
-
# force_override levels may need to be used in recipe code.
|
23
|
+
# Code should be updated to use default or override levels, but this will change attribute merging behavior so needs to be validated manually and force_default or force_override levels may need to be used in recipe code.
|
28
24
|
#
|
29
25
|
# @example
|
30
26
|
#
|
@@ -18,13 +18,9 @@ module RuboCop
|
|
18
18
|
module Cop
|
19
19
|
module Chef
|
20
20
|
module Correctness
|
21
|
-
# Normal attributes are discouraged since their semantics differ importantly from the
|
22
|
-
# default and override levels. Their values persist in the node object even after
|
23
|
-
# all code referencing them has been deleted, unlike default and override.
|
21
|
+
# Normal attributes are discouraged since their semantics differ importantly from the default and override levels. Their values persist in the node object even after all code referencing them has been deleted, unlike default and override.
|
24
22
|
#
|
25
|
-
# Code should be updated to use default or override levels, but this will change
|
26
|
-
# attribute merging behavior so needs to be validated manually and force_default or
|
27
|
-
# force_override levels may need to be used in recipe code.
|
23
|
+
# Code should be updated to use default or override levels, but this will change attribute merging behavior so needs to be validated manually and force_default or force_override levels may need to be used in recipe code.
|
28
24
|
#
|
29
25
|
# @example
|
30
26
|
#
|
@@ -19,9 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Correctness
|
22
|
-
# Don't use node.save to save partial node data to the Chef Infra Server mid-run unless it's
|
23
|
-
# absolutely necessary. Node.save can result in failed Chef Infra runs appearing in search and
|
24
|
-
# increases load on the Chef Infra Server."
|
22
|
+
# Don't use node.save to save partial node data to the Chef Infra Server mid-run unless it's a requirement of cookbook design that can't be avoided. Node.save can result in failed Chef Infra runs appearing in search and increases load on the Chef Infra Server."
|
25
23
|
#
|
26
24
|
# @example
|
27
25
|
#
|
@@ -15,12 +15,11 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
19
18
|
module RuboCop
|
20
19
|
module Cop
|
21
20
|
module Chef
|
22
21
|
module Correctness
|
23
|
-
# When notifying or subscribing
|
22
|
+
# When notifying or subscribing actions within a resource the action should always be a symbol. In Chef Infra Client releases before 14.0, this may result in double notification.
|
24
23
|
#
|
25
24
|
# @example
|
26
25
|
#
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Correctness
|
22
|
-
# The
|
22
|
+
# The OpenSSL cookbook provides a deprecated `secure_password` helper in the `Opscode::OpenSSL::Password` class, which should no longer be used. This helper would generate a random password that would be used when a data bag or attribute was no present. The practice of generating passwords to be stored on the node is bad security as it exposes the password to anyone that can view the nodes, and deleting a node deletes the password. Passwords should be retrieved from a secure source for use in cookbooks.
|
23
23
|
#
|
24
24
|
# #### incorrect
|
25
25
|
# ::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
|
@@ -19,9 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Correctness
|
22
|
-
# Chef Infra Client uses properties in several resources to track state. These
|
23
|
-
# should not be set in recipes as they break the internal workings of the Chef
|
24
|
-
# Infra Client
|
22
|
+
# Chef Infra Client uses properties in several resources to track state. These should not be set in recipes as they break the internal workings of the Chef Infra Client
|
25
23
|
#
|
26
24
|
# @example
|
27
25
|
#
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Correctness
|
22
|
-
# Scope file exist to access the correct File class by using
|
22
|
+
# Scope file exist to access the correct `File` class by using `::File.exist?` not `File.exist?`.
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -14,12 +14,11 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
|
-
|
18
17
|
module RuboCop
|
19
18
|
module Cop
|
20
19
|
module Chef
|
21
20
|
module Correctness
|
22
|
-
# Use file_cache_path rather than hard-coding
|
21
|
+
# Use file_cache_path rather than hard-coding system temp paths
|
23
22
|
#
|
24
23
|
# @example downloading a large file into /tmp/
|
25
24
|
#
|
@@ -15,22 +15,21 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
19
18
|
module RuboCop
|
20
19
|
module Cop
|
21
20
|
module Chef
|
22
|
-
# Make sure a cookbook doesn't depend on itself. This will fail on Chef Infra Client 13+
|
23
|
-
#
|
24
|
-
# @example
|
25
|
-
#
|
26
|
-
# #### incorrect
|
27
|
-
# name 'foo'
|
28
|
-
# depends 'foo'
|
29
|
-
#
|
30
|
-
# #### correct
|
31
|
-
# name 'foo'
|
32
|
-
#
|
33
21
|
module Deprecations
|
22
|
+
# Make sure a cookbook doesn't depend on itself. This will fail on Chef Infra Client 13+
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### incorrect
|
27
|
+
# name 'foo'
|
28
|
+
# depends 'foo'
|
29
|
+
#
|
30
|
+
# #### correct
|
31
|
+
# name 'foo'
|
32
|
+
#
|
34
33
|
class CookbooksDependsOnSelf < Base
|
35
34
|
extend AutoCorrector
|
36
35
|
include RangeHelp
|
@@ -15,12 +15,11 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
19
18
|
module RuboCop
|
20
19
|
module Cop
|
21
20
|
module Chef
|
22
21
|
module Deprecations
|
23
|
-
# There is no need to include the empty and deprecated chef_handler::default recipe
|
22
|
+
# There is no need to include the empty and deprecated chef_handler::default recipe to use the chef_handler resource
|
24
23
|
#
|
25
24
|
# @example
|
26
25
|
#
|
@@ -32,7 +31,7 @@ module RuboCop
|
|
32
31
|
include RangeHelp
|
33
32
|
extend AutoCorrector
|
34
33
|
|
35
|
-
MSG = 'There is no need to include the empty and deprecated chef_handler::default recipe
|
34
|
+
MSG = 'There is no need to include the empty and deprecated chef_handler::default recipe to use the chef_handler resource'
|
36
35
|
RESTRICT_ON_SEND = [:include_recipe].freeze
|
37
36
|
|
38
37
|
def_node_matcher :chef_handler_recipe?, <<-PATTERN
|