cookstyle 7.9.0 → 7.12.2
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 +8 -0
- data/config/upstream.yml +47 -3
- data/cookstyle.gemspec +1 -1
- data/lib/cookstyle.rb +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/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
- data/lib/rubocop/monkey_patches/{comment_config.rb → directive_comment.rb} +5 -4
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68835852d8021cee74896aa171d78ca5b540fca9fdee42632719d867910c107e
|
4
|
+
data.tar.gz: f71d3a8f4bc874dd86f81b0b01d4caa929ba62c2bf2222ca66a3e726eb398611
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ce79400b3866f0ac4b5b94ed0eb39da7a7b19dcd6dcf5fb0e6347affc31a70c0d56d8e2d671b776cea74465b6c715a20d9d88b3941291655ed01833c38796b
|
7
|
+
data.tar.gz: 1d324b44b1ce454718685eb5339e14d4063072b2d66dec6707091a871aa1fbef6f8eb4a13aeee683552b4b6d54f0821b5fa82493b4bde31d62aac48e9577a396
|
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:
|
@@ -851,6 +857,8 @@ Style/StabbyLambdaParentheses:
|
|
851
857
|
Enabled: false
|
852
858
|
Style/StderrPuts:
|
853
859
|
Enabled: false
|
860
|
+
Style/StringChars:
|
861
|
+
Enabled: false
|
854
862
|
Style/StringConcatenation:
|
855
863
|
Enabled: false
|
856
864
|
Style/StringHashKeys:
|
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: >-
|
@@ -2055,13 +2084,18 @@ Lint/SuppressedException:
|
|
2055
2084
|
StyleGuide: '#dont-hide-exceptions'
|
2056
2085
|
Enabled: true
|
2057
2086
|
AllowComments: true
|
2087
|
+
AllowNil: true
|
2058
2088
|
VersionAdded: '0.9'
|
2059
|
-
VersionChanged: '
|
2089
|
+
VersionChanged: '1.12'
|
2060
2090
|
|
2061
2091
|
Lint/SymbolConversion:
|
2062
2092
|
Description: 'Checks for unnecessary symbol conversions.'
|
2063
2093
|
Enabled: pending
|
2064
2094
|
VersionAdded: '1.9'
|
2095
|
+
EnforcedStyle: strict
|
2096
|
+
SupportedStyles:
|
2097
|
+
- strict
|
2098
|
+
- consistent
|
2065
2099
|
|
2066
2100
|
Lint/Syntax:
|
2067
2101
|
Description: 'Checks for syntax errors.'
|
@@ -2489,6 +2523,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2489
2523
|
- disallowed
|
2490
2524
|
- required
|
2491
2525
|
- optional
|
2526
|
+
Safe: false
|
2492
2527
|
|
2493
2528
|
Naming/MethodName:
|
2494
2529
|
Description: 'Use the configured style when naming methods.'
|
@@ -3174,6 +3209,7 @@ Style/Documentation:
|
|
3174
3209
|
Description: 'Document classes and non-namespace modules.'
|
3175
3210
|
Enabled: true
|
3176
3211
|
VersionAdded: '0.9'
|
3212
|
+
AllowedConstants: []
|
3177
3213
|
Exclude:
|
3178
3214
|
- 'spec/**/*'
|
3179
3215
|
- 'test/**/*'
|
@@ -3672,6 +3708,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3672
3708
|
AllowParenthesesInMultilineCall: false
|
3673
3709
|
AllowParenthesesInChaining: false
|
3674
3710
|
AllowParenthesesInCamelCaseMethod: false
|
3711
|
+
AllowParenthesesInStringInterpolation: false
|
3675
3712
|
EnforcedStyle: require_parentheses
|
3676
3713
|
SupportedStyles:
|
3677
3714
|
- require_parentheses
|
@@ -4491,6 +4528,13 @@ Style/StderrPuts:
|
|
4491
4528
|
Enabled: true
|
4492
4529
|
VersionAdded: '0.51'
|
4493
4530
|
|
4531
|
+
Style/StringChars:
|
4532
|
+
Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
|
4533
|
+
StyleGuide: '#string-chars'
|
4534
|
+
Enabled: pending
|
4535
|
+
Safe: false
|
4536
|
+
VersionAdded: '1.12'
|
4537
|
+
|
4494
4538
|
Style/StringConcatenation:
|
4495
4539
|
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4496
4540
|
StyleGuide: '#string-interpolation'
|
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.rb
CHANGED
@@ -7,7 +7,7 @@ require 'yaml' unless defined?(YAML)
|
|
7
7
|
# ensure the desired target version of RuboCop is gem activated
|
8
8
|
gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
|
9
9
|
require 'rubocop'
|
10
|
-
require_relative 'rubocop/monkey_patches/
|
10
|
+
require_relative 'rubocop/monkey_patches/directive_comment'
|
11
11
|
|
12
12
|
# monkey patches needed for the TargetChefVersion config option
|
13
13
|
require_relative 'rubocop/monkey_patches/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
|
#
|