cookstyle 6.3.4 → 6.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/config/cookstyle.yml +290 -15
- data/config/disable_all.yml +13 -1
- data/config/upstream.yml +82 -22
- data/lib/cookstyle.rb +1 -1
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/chef/platform_helpers.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +77 -0
- data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +77 -0
- data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +56 -0
- data/lib/rubocop/cop/chef/correctness/node_normal.rb +1 -1
- data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +1 -1
- data/lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb +45 -0
- 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 +10 -4
- data/lib/rubocop/cop/chef/deprecation/easy_install.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/erl_call.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +141 -0
- data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/node_set.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +3 -3
- data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +86 -0
- data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +59 -0
- data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +6 -1
- data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +3 -3
- data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +24 -3
- data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +64 -0
- data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +8 -4
- data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +1 -1
- data/lib/rubocop/cop/target_chef_version.rb +4 -0
- data/lib/rubocop/monkey_patches/team.rb +24 -0
- metadata +13 -6
- data/lib/rubocop/cop/chef/deprecation/resource_without_name_or_provides.rb +0 -81
- data/lib/rubocop/monkey_patches/commissioner.rb +0 -26
@@ -1,81 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: 2020, Chef Software Inc.
|
3
|
-
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
module RuboCop
|
19
|
-
module Cop
|
20
|
-
module Chef
|
21
|
-
module ChefDeprecations
|
22
|
-
# In Chef Infra Client 16 and later a legacy HWRP resource must use either `resource_name` or `provides` to define the resource name.
|
23
|
-
#
|
24
|
-
# @example
|
25
|
-
#
|
26
|
-
# # bad
|
27
|
-
# class Chef
|
28
|
-
# class Resource
|
29
|
-
# class UlimitRule < Chef::Resource
|
30
|
-
# property :type, [Symbol, String], required: true
|
31
|
-
# property :item, [Symbol, String], required: true
|
32
|
-
#
|
33
|
-
# # additional resource code
|
34
|
-
# end
|
35
|
-
# end
|
36
|
-
# end
|
37
|
-
#
|
38
|
-
# # good
|
39
|
-
# class Chef
|
40
|
-
# class Resource
|
41
|
-
# class UlimitRule < Chef::Resource
|
42
|
-
# resource_name :ulimit_rule
|
43
|
-
#
|
44
|
-
# property :type, [Symbol, String], required: true
|
45
|
-
# property :item, [Symbol, String], required: true
|
46
|
-
#
|
47
|
-
# # additional resource code
|
48
|
-
# end
|
49
|
-
# end
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# # better
|
53
|
-
# Convert your legacy HWRPs to custom resources
|
54
|
-
#
|
55
|
-
class ResourceWithoutNameOrProvides < Cop
|
56
|
-
MSG = 'In Chef Infra Client 16 and later legacy HWRP resources must use either `resource_name` or `provides` to define the resource name.'.freeze
|
57
|
-
|
58
|
-
def_node_matcher :HWRP?, <<-PATTERN
|
59
|
-
(class
|
60
|
-
(const nil? :Chef) nil?
|
61
|
-
(class
|
62
|
-
(const nil? :Resource) nil?
|
63
|
-
$(class
|
64
|
-
(const nil? ... )
|
65
|
-
(const
|
66
|
-
(const nil? :Chef) :Resource)
|
67
|
-
(begin ... ))))
|
68
|
-
PATTERN
|
69
|
-
|
70
|
-
def_node_search :provides_or_resource_name?, '(send nil? {:provides :resource_name} ...)'
|
71
|
-
|
72
|
-
def on_class(node)
|
73
|
-
HWRP?(node) do |inherit|
|
74
|
-
add_offense(inherit, location: :expression, message: MSG, severity: :warning) if provides_or_resource_name?(processed_source.ast).nil?
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
class Commissioner
|
6
|
-
def remove_irrelevant_cops(filename)
|
7
|
-
@cops.reject! { |cop| cop.excluded_file?(filename) }
|
8
|
-
@cops.reject! do |cop|
|
9
|
-
cop.class.respond_to?(:support_target_ruby_version?) &&
|
10
|
-
!cop.class.support_target_ruby_version?(cop.target_ruby_version)
|
11
|
-
end
|
12
|
-
@cops.reject! do |cop|
|
13
|
-
cop.class.respond_to?(:support_target_rails_version?) &&
|
14
|
-
!cop.class.support_target_rails_version?(cop.target_rails_version)
|
15
|
-
end
|
16
|
-
|
17
|
-
### START COOKSTYLE MODIFICATION
|
18
|
-
@cops.reject! do |cop|
|
19
|
-
cop.class.respond_to?(:support_target_chef_version?) &&
|
20
|
-
!cop.class.support_target_chef_version?(cop.target_chef_version)
|
21
|
-
end
|
22
|
-
### END COOKSTYLE MODIFICATION
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|