cookstyle 7.10.0 → 7.12.3
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 +24 -7
- data/config/disable_all.yml +6 -0
- data/config/upstream.yml +31 -2
- data/cookstyle.gemspec +1 -1
- data/lib/cookstyle/version.rb +2 -2
- 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 +31 -12
- 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 +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6b4ac76f05be60a51f678d80bb34d68d4396560b2887214a0a3dd7ac6cd038f
|
4
|
+
data.tar.gz: 74a95cd52549baf8086aa14e3579370d917b8db198deafdc6ced6c28071b3956
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 105f70150e5c66d01b6e157b7f07660a3bf4c755dbb7eed18709fca10b911b54c14fbfff2a2cd41d04ce11b649525b742a469f5f3631ee6c13eaa9f7fa1dc90b
|
7
|
+
data.tar.gz: fb7ffae6e230fa1f26f68626cd9adf4f8d265aee2feeec5fed68c963fde79bbce1022fa973e6bc2cccfbb07e396e4784d81ba0747778915eb3c288ea7e20f19b
|
data/config/cookstyle.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
AllCops:
|
2
2
|
SuggestExtensions: false
|
3
|
-
TargetRubyVersion: 2.
|
3
|
+
TargetRubyVersion: 2.5
|
4
4
|
TargetChefVersion: ~
|
5
5
|
Exclude:
|
6
6
|
- '/**/files/**/*'
|
@@ -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,22 @@ 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
|
+
|
1193
1209
|
###############################
|
1194
1210
|
# Chef/Modernize: Cleaning up legacy code and using new built-in resources
|
1195
1211
|
###############################
|
@@ -2247,8 +2263,9 @@ Style/Proc:
|
|
2247
2263
|
Enabled: true
|
2248
2264
|
Style/RaiseArgs:
|
2249
2265
|
Enabled: true
|
2266
|
+
# disabled for now as this breaks ruby_block resources
|
2250
2267
|
Style/RedundantBegin:
|
2251
|
-
Enabled:
|
2268
|
+
Enabled: false
|
2252
2269
|
Style/RedundantException:
|
2253
2270
|
Enabled: true
|
2254
2271
|
Style/RedundantFreeze:
|
data/config/disable_all.yml
CHANGED
@@ -5,6 +5,8 @@ Bundler/DuplicatedGem:
|
|
5
5
|
Enabled: false
|
6
6
|
Bundler/GemComment:
|
7
7
|
Enabled: false
|
8
|
+
Bundler/GemVersion:
|
9
|
+
Enabled: false
|
8
10
|
Bundler/InsecureProtocolSource:
|
9
11
|
Enabled: false
|
10
12
|
Bundler/OrderedGems:
|
@@ -147,8 +149,12 @@ Layout/MultilineOperationIndentation:
|
|
147
149
|
Enabled: false
|
148
150
|
Layout/ParameterAlignment:
|
149
151
|
Enabled: false
|
152
|
+
Layout/RedundantLineBreak:
|
153
|
+
Enabled: false
|
150
154
|
Layout/RescueEnsureAlignment:
|
151
155
|
Enabled: false
|
156
|
+
Layout/SingleLineBlockChain:
|
157
|
+
Enabled: false
|
152
158
|
Layout/SpaceAfterColon:
|
153
159
|
Enabled: false
|
154
160
|
Layout/SpaceAfterComma:
|
data/config/upstream.yml
CHANGED
@@ -130,7 +130,7 @@ AllCops:
|
|
130
130
|
# What MRI version of the Ruby interpreter is the inspected code intended to
|
131
131
|
# run on? (If there is more than one, set this to the lowest version.)
|
132
132
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
133
|
-
# values are specificed as a float (i.e.
|
133
|
+
# values are specificed as a float (i.e. 3.0); the teeny version of Ruby
|
134
134
|
# should not be included. If the project specifies a Ruby version in the
|
135
135
|
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
136
136
|
# try to determine the desired version of Ruby by inspecting the
|
@@ -138,7 +138,7 @@ AllCops:
|
|
138
138
|
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
139
139
|
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
140
140
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
141
|
-
# supported Ruby version (currently Ruby 2.
|
141
|
+
# supported Ruby version (currently Ruby 2.5).
|
142
142
|
TargetRubyVersion: ~
|
143
143
|
# Determines if a notification for extension libraries should be shown when
|
144
144
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
@@ -174,6 +174,20 @@ Bundler/GemComment:
|
|
174
174
|
IgnoredGems: []
|
175
175
|
OnlyFor: []
|
176
176
|
|
177
|
+
Bundler/GemVersion:
|
178
|
+
Description: 'Requires or forbids specifying gem versions.'
|
179
|
+
Enabled: false
|
180
|
+
VersionAdded: '1.14'
|
181
|
+
EnforcedStyle: 'required'
|
182
|
+
SupportedStyles:
|
183
|
+
- 'required'
|
184
|
+
- 'forbidden'
|
185
|
+
Include:
|
186
|
+
- '**/*.gemfile'
|
187
|
+
- '**/Gemfile'
|
188
|
+
- '**/gems.rb'
|
189
|
+
AllowedGems: []
|
190
|
+
|
177
191
|
Bundler/InsecureProtocolSource:
|
178
192
|
Description: >-
|
179
193
|
The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
|
@@ -1101,11 +1115,24 @@ Layout/ParameterAlignment:
|
|
1101
1115
|
# But it can be overridden by setting this parameter
|
1102
1116
|
IndentationWidth: ~
|
1103
1117
|
|
1118
|
+
Layout/RedundantLineBreak:
|
1119
|
+
Description: >-
|
1120
|
+
Do not break up an expression into multiple lines when it fits
|
1121
|
+
on a single line.
|
1122
|
+
Enabled: false
|
1123
|
+
InspectBlocks: false
|
1124
|
+
VersionAdded: '1.13'
|
1125
|
+
|
1104
1126
|
Layout/RescueEnsureAlignment:
|
1105
1127
|
Description: 'Align rescues and ensures correctly.'
|
1106
1128
|
Enabled: true
|
1107
1129
|
VersionAdded: '0.49'
|
1108
1130
|
|
1131
|
+
Layout/SingleLineBlockChain:
|
1132
|
+
Description: 'Put method call on a separate line if chained to a single line block.'
|
1133
|
+
Enabled: false
|
1134
|
+
VersionAdded: '1.14'
|
1135
|
+
|
1109
1136
|
Layout/SpaceAfterColon:
|
1110
1137
|
Description: 'Use spaces after colons.'
|
1111
1138
|
StyleGuide: '#spaces-operators'
|
@@ -1380,6 +1407,8 @@ Lint/AmbiguousBlockAssociation:
|
|
1380
1407
|
StyleGuide: '#syntax'
|
1381
1408
|
Enabled: true
|
1382
1409
|
VersionAdded: '0.48'
|
1410
|
+
VersionChanged: '1.13'
|
1411
|
+
IgnoredMethods: []
|
1383
1412
|
|
1384
1413
|
Lint/AmbiguousOperator:
|
1385
1414
|
Description: >-
|
data/cookstyle.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = 'Cookstyle is a code linting tool that helps you to write better Chef Infra cookbooks by detecting and automatically correcting style, syntax, and logic mistakes in your code.'
|
12
12
|
spec.license = 'Apache-2.0'
|
13
13
|
spec.homepage = 'https://docs.chef.io/workstation/cookstyle/'
|
14
|
-
spec.required_ruby_version = '>= 2.
|
14
|
+
spec.required_ruby_version = '>= 2.5'
|
15
15
|
|
16
16
|
# the gemspec and Gemfile are necessary for appbundling of the gem
|
17
17
|
spec.files = %w(LICENSE cookstyle.gemspec Gemfile) + Dir.glob('{lib,bin,config}/**/*')
|
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
|
#
|