cookstyle 7.11.3 → 7.13.0
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 +20 -2
- data/config/disable_all.yml +2 -0
- data/config/upstream.yml +11 -3
- data/lib/cookstyle/version.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 +0 -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/notifies_action_not_symbol.rb +0 -1
- 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/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 +0 -1
- data/lib/rubocop/cop/chef/deprecation/cb_depends_on_self.rb +11 -12
- data/lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/chef_shellout.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/chef_sugar_helpers.rb +22 -23
- data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +0 -1
- 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 +0 -1
- data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/easy_install.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +0 -1
- data/lib/rubocop/cop/chef/deprecation/erl_call.rb +0 -1
- 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/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 +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 811ea8aed6ff56a955606ba47fd8c30181ea3827c816879fd2e8e98443db92bc
|
4
|
+
data.tar.gz: ab8a7d83c787649299f98c6e86722be5728d3aa2b510c50a2d5f72cd0718999b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e1184b274aa2fb50748e5e693f3f30a9ec6bf23230187152c3934c03a42350fbbb44624772722a871801cc8b9dbb9f9a5e676fbf9dabcfe34cdc0582584a0d4
|
7
|
+
data.tar.gz: '09c3f666ede2289ea7dfbe677e73c9df1f1763ae19c16d8b1c51ae33dddde2ead0eaee275d4dd45fee304769422549d171a0bfaede0262ef059dd6b4307c226e'
|
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
|
###############################
|
@@ -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
|
###############################
|
data/config/disable_all.yml
CHANGED
data/config/upstream.yml
CHANGED
@@ -1612,7 +1612,7 @@ Lint/EmptyBlock:
|
|
1612
1612
|
Description: 'This cop checks for blocks without a body.'
|
1613
1613
|
Enabled: pending
|
1614
1614
|
VersionAdded: '1.1'
|
1615
|
-
VersionChanged: '1.
|
1615
|
+
VersionChanged: '1.15'
|
1616
1616
|
AllowComments: true
|
1617
1617
|
AllowEmptyLambdas: true
|
1618
1618
|
|
@@ -3480,6 +3480,7 @@ Style/HashAsLastArrayItem:
|
|
3480
3480
|
|
3481
3481
|
Style/HashConversion:
|
3482
3482
|
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3483
|
+
StyleGuide: '#avoid-hash-constructor'
|
3483
3484
|
Enabled: pending
|
3484
3485
|
VersionAdded: '1.10'
|
3485
3486
|
VersionChanged: '1.11'
|
@@ -3998,6 +3999,7 @@ Style/NilLambda:
|
|
3998
3999
|
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3999
4000
|
Enabled: pending
|
4000
4001
|
VersionAdded: '1.3'
|
4002
|
+
VersionChanged: '1.15'
|
4001
4003
|
|
4002
4004
|
Style/NonNilCheck:
|
4003
4005
|
Description: 'Checks for redundant nil checks.'
|
@@ -4651,6 +4653,12 @@ Style/TernaryParentheses:
|
|
4651
4653
|
- require_parentheses_when_complex
|
4652
4654
|
AllowSafeAssignment: true
|
4653
4655
|
|
4656
|
+
Style/TopLevelMethodDefinition:
|
4657
|
+
Description: 'This cop looks for top-level method definitions.'
|
4658
|
+
StyleGuide: '#top-level-methods'
|
4659
|
+
Enabled: false
|
4660
|
+
VersionAdded: '1.15'
|
4661
|
+
|
4654
4662
|
Style/TrailingBodyOnClass:
|
4655
4663
|
Description: 'Class body goes below class statement.'
|
4656
4664
|
Enabled: true
|
@@ -4737,7 +4745,7 @@ Style/TrivialAccessors:
|
|
4737
4745
|
StyleGuide: '#attr_family'
|
4738
4746
|
Enabled: true
|
4739
4747
|
VersionAdded: '0.9'
|
4740
|
-
VersionChanged: '
|
4748
|
+
VersionChanged: '1.15'
|
4741
4749
|
# When set to `false` the cop will suggest the use of accessor methods
|
4742
4750
|
# in situations like:
|
4743
4751
|
#
|
@@ -4756,7 +4764,7 @@ Style/TrivialAccessors:
|
|
4756
4764
|
# on_exception :restart
|
4757
4765
|
#
|
4758
4766
|
# Commonly used in DSLs
|
4759
|
-
AllowDSLWriters:
|
4767
|
+
AllowDSLWriters: true
|
4760
4768
|
IgnoreClassMethods: false
|
4761
4769
|
AllowedMethods:
|
4762
4770
|
- to_ary
|
data/lib/cookstyle/version.rb
CHANGED
@@ -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,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
|
@@ -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,33 +15,32 @@
|
|
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
|
-
# Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started
|
23
|
-
#
|
24
|
-
# @example
|
25
|
-
#
|
26
|
-
# #### incorrect
|
27
|
-
# vagrant_key?
|
28
|
-
# vagrant_domain?
|
29
|
-
# vagrant_user?
|
30
|
-
# require_chef_gem
|
31
|
-
# best_ip_for(node)
|
32
|
-
# nexus?
|
33
|
-
# ios_xr?
|
34
|
-
# ruby_20?
|
35
|
-
# ruby_19?
|
36
|
-
# includes_recipe?('foo::bar')
|
37
|
-
# wrlinux?
|
38
|
-
# dev_null
|
39
|
-
# nexentacore_platform?
|
40
|
-
# opensolaris_platform?
|
41
|
-
# nexentacore?
|
42
|
-
# opensolaris?
|
43
|
-
#
|
44
21
|
module Deprecations
|
22
|
+
# Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### incorrect
|
27
|
+
# vagrant_key?
|
28
|
+
# vagrant_domain?
|
29
|
+
# vagrant_user?
|
30
|
+
# require_chef_gem
|
31
|
+
# best_ip_for(node)
|
32
|
+
# nexus?
|
33
|
+
# ios_xr?
|
34
|
+
# ruby_20?
|
35
|
+
# ruby_19?
|
36
|
+
# includes_recipe?('foo::bar')
|
37
|
+
# wrlinux?
|
38
|
+
# dev_null
|
39
|
+
# nexentacore_platform?
|
40
|
+
# opensolaris_platform?
|
41
|
+
# nexentacore?
|
42
|
+
# opensolaris?
|
43
|
+
#
|
45
44
|
class ChefSugarHelpers < Base
|
46
45
|
MSG = 'Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started'
|
47
46
|
RESTRICT_ON_SEND = [:vagrant_key?, :vagrant_domain?, :vagrant_user?, :require_chef_gem, :best_ip_for, :nexus?, :ios_xr?, :ruby_20?, :ruby_19?, :includes_recipe?, :wrlinux?, :dev_null, :nexentacore_platform?, :opensolaris_platform?, :nexentacore?, :opensolaris?].freeze
|
@@ -15,13 +15,12 @@
|
|
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
|
-
# The Librarian-Chef depsolving project is no longer maintained and a Cheffile should not be used for cookbook depsolving. Consider using Policyfiles instead. If the Policyfiles model is not compatible with your workflow you may find Berkshelf offers a more similar, and still supported, experience to Librarian-Chef.
|
23
|
-
#
|
24
21
|
module Deprecations
|
22
|
+
# The Librarian-Chef depsolving project is no longer maintained and a Cheffile should not be used for cookbook depsolving. Consider using Policyfiles instead. If the Policyfiles model is not compatible with your workflow you may find Berkshelf offers a more similar, and still supported, experience to Librarian-Chef.
|
23
|
+
#
|
25
24
|
class Cheffile < Base
|
26
25
|
include RangeHelp
|
27
26
|
|