cookstyle 5.23.0 → 6.0.19
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 +86 -4
- data/config/disable_all.yml +58 -52
- data/config/upstream.yml +377 -336
- data/lib/cookstyle.rb +0 -1
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/chef/cookbook_helpers.rb +3 -3
- data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +58 -0
- data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +11 -5
- data/lib/rubocop/cop/chef/correctness/powershell_delete_file.rb +53 -0
- data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +3 -3
- data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +4 -4
- data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +56 -0
- data/lib/rubocop/cop/chef/deprecation/cheffile.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +1 -5
- data/lib/rubocop/cop/chef/deprecation/depends_poise.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +3 -3
- data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb +40 -0
- data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +1 -4
- data/lib/rubocop/cop/chef/deprecation/easy_install.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/erl_call.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb +1 -4
- data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb +60 -0
- data/lib/rubocop/cop/chef/deprecation/name_property_and_default.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/node_deep_fetch.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 +1 -1
- data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/node_set_without_level.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/partial_search_helper_usage.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/poise_archive.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/resource_without_name_or_provides.rb +81 -0
- data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/run_command_helper.rb +3 -3
- data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/use_inline_resources.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/verify_property_file_expansion.rb +1 -4
- data/lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +1 -4
- data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb +1 -1
- data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +58 -0
- data/lib/rubocop/cop/chef/modernize/powershell_guard_interpreter.rb +17 -8
- data/lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb +3 -3
- data/lib/rubocop/cop/chef/modernize/provides_initializer.rb +69 -0
- data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +5 -15
- data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +103 -0
- data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +2 -9
- data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +2 -2
- data/lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/sensitive_property_in_resource.rb +3 -3
- data/lib/rubocop/monkey_patches/comment_config.rb +1 -1
- data/lib/rubocop/monkey_patches/config.rb +1 -1
- metadata +13 -5
- data/lib/rubocop/monkey_patches/json_formatter.rb +0 -20
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2019
|
2
|
+
# Copyright:: 2019, Chef Software Inc.
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -35,15 +35,8 @@ module RuboCop
|
|
35
35
|
|
36
36
|
MSG = 'whyrun_supported? no longer needs to be set to true as it is the default in Chef Infra Client 13+'.freeze
|
37
37
|
|
38
|
-
# match on both whyrun_supported? and the typo form why_run_supported?
|
39
|
-
def_node_matcher :whyrun_true?, <<-PATTERN
|
40
|
-
(def {:whyrun_supported? :why_run_supported?}
|
41
|
-
(args)
|
42
|
-
(true))
|
43
|
-
PATTERN
|
44
|
-
|
45
38
|
def on_def(node)
|
46
|
-
|
39
|
+
if node.method_name == :whyrun_supported? && node.body == s(:true) # rubocop: disable Lint/BooleanSymbol
|
47
40
|
add_offense(node, location: :expression, message: MSG, severity: :refactor)
|
48
41
|
end
|
49
42
|
end
|
@@ -50,7 +50,7 @@ module RuboCop
|
|
50
50
|
|
51
51
|
# use source instead of .value in case there's string interpolation which adds a complex dstr type
|
52
52
|
# with a nested string and a begin. Source allows us to avoid a lot of defensive programming here
|
53
|
-
if node&.arguments.first&.source.match?(/HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System/i)
|
53
|
+
if node&.arguments.first&.source.match?(/(HKLM|HKEY_LOCAL_MACHINE)\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System/i) && node.parent&.method_name != :describe
|
54
54
|
add_offense(node, location: :expression, message: MSG, severity: :refactor)
|
55
55
|
end
|
56
56
|
end
|
@@ -59,7 +59,7 @@ module RuboCop
|
|
59
59
|
def on_block(node)
|
60
60
|
match_property_in_resource?(:registry_key, 'key', node) do |key_prop|
|
61
61
|
property_data = method_arg_ast_to_string(key_prop)
|
62
|
-
if property_data && property_data.match?(/HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System/i)
|
62
|
+
if property_data && property_data.match?(/(HKLM|HKEY_LOCAL_MACHINE)\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System/i)
|
63
63
|
add_offense(node, location: :expression, message: MSG, severity: :refactor)
|
64
64
|
end
|
65
65
|
end
|
@@ -47,7 +47,6 @@ module RuboCop
|
|
47
47
|
|
48
48
|
def on_block(node)
|
49
49
|
match_property_in_resource?(:apt_repository, 'distribution', node) do |dist|
|
50
|
-
## require 'pry'; binding.pry
|
51
50
|
default_dist?(dist) do
|
52
51
|
add_offense(dist, location: :expression, message: MSG, severity: :refactor)
|
53
52
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright 2019
|
2
|
+
# Copyright:: Copyright 2019, Chef Software Inc.
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,13 +18,13 @@ module RuboCop
|
|
18
18
|
module Cop
|
19
19
|
module Chef
|
20
20
|
module ChefRedundantCode
|
21
|
-
# Every Chef Infra
|
21
|
+
# Every Chef Infra resources already include a sensitive property with a default value of false.
|
22
22
|
#
|
23
23
|
# # bad
|
24
24
|
# property :sensitive, [true, false], default: false
|
25
25
|
#
|
26
26
|
class SensitivePropertyInResource < Cop
|
27
|
-
MSG = 'Every Chef Infra
|
27
|
+
MSG = 'Every Chef Infra resources already include a sensitive property with a default value of false.'.freeze
|
28
28
|
|
29
29
|
def_node_matcher :sensitive_property?, <<-PATTERN
|
30
30
|
(send nil? {:property :attribute} (sym :sensitive) ... (hash (pair (sym :default) (false))))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RuboCop
|
2
2
|
# we're monkey patching the config regex to allow for # cookstyle: disable whatever
|
3
|
-
# in addition to the # rubocop: disable whatever that comes with
|
3
|
+
# in addition to the # rubocop: disable whatever that comes with RuboCop
|
4
4
|
class CommentConfig
|
5
5
|
remove_const('COMMENT_DIRECTIVE_REGEXP')
|
6
6
|
COMMENT_DIRECTIVE_REGEXP = Regexp.new(
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookstyle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom May
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.80.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.80.1
|
28
28
|
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/rubocop/chef/platform_helpers.rb
|
52
52
|
- lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb
|
53
53
|
- lib/rubocop/cop/chef/correctness/cb_depends_on_self.rb
|
54
|
+
- lib/rubocop/cop/chef/correctness/chef_application_fatal.rb
|
54
55
|
- lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
|
55
56
|
- lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb
|
56
57
|
- lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb
|
@@ -66,6 +67,7 @@ files:
|
|
66
67
|
- lib/rubocop/cop/chef/correctness/node_normal_unless.rb
|
67
68
|
- lib/rubocop/cop/chef/correctness/node_save.rb
|
68
69
|
- lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb
|
70
|
+
- lib/rubocop/cop/chef/correctness/powershell_delete_file.rb
|
69
71
|
- lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb
|
70
72
|
- lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb
|
71
73
|
- lib/rubocop/cop/chef/correctness/resource_with_none_action.rb
|
@@ -75,6 +77,7 @@ files:
|
|
75
77
|
- lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb
|
76
78
|
- lib/rubocop/cop/chef/deprecation/chef_rest.rb
|
77
79
|
- lib/rubocop/cop/chef/deprecation/chef_rewind.rb
|
80
|
+
- lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb
|
78
81
|
- lib/rubocop/cop/chef/deprecation/cheffile.rb
|
79
82
|
- lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb
|
80
83
|
- lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb
|
@@ -85,6 +88,7 @@ files:
|
|
85
88
|
- lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb
|
86
89
|
- lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb
|
87
90
|
- lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb
|
91
|
+
- lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb
|
88
92
|
- lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb
|
89
93
|
- lib/rubocop/cop/chef/deprecation/easy_install.rb
|
90
94
|
- lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb
|
@@ -95,6 +99,7 @@ files:
|
|
95
99
|
- lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb
|
96
100
|
- lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb
|
97
101
|
- lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb
|
102
|
+
- lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb
|
98
103
|
- lib/rubocop/cop/chef/deprecation/name_property_and_default.rb
|
99
104
|
- lib/rubocop/cop/chef/deprecation/node_deep_fetch.rb
|
100
105
|
- lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb
|
@@ -109,6 +114,7 @@ files:
|
|
109
114
|
- lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb
|
110
115
|
- lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb
|
111
116
|
- lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb
|
117
|
+
- lib/rubocop/cop/chef/deprecation/resource_without_name_or_provides.rb
|
112
118
|
- lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb
|
113
119
|
- lib/rubocop/cop/chef/deprecation/run_command_helper.rb
|
114
120
|
- lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb
|
@@ -134,6 +140,7 @@ files:
|
|
134
140
|
- lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb
|
135
141
|
- lib/rubocop/cop/chef/modernize/compile_time_resources.rb
|
136
142
|
- lib/rubocop/cop/chef/modernize/cron_manage_resource.rb
|
143
|
+
- lib/rubocop/cop/chef/modernize/databag_helpers.rb
|
137
144
|
- lib/rubocop/cop/chef/modernize/default_action_initializer.rb
|
138
145
|
- lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb
|
139
146
|
- lib/rubocop/cop/chef/modernize/definitions.rb
|
@@ -161,6 +168,7 @@ files:
|
|
161
168
|
- lib/rubocop/cop/chef/modernize/powershell_install_package.rb
|
162
169
|
- lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb
|
163
170
|
- lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb
|
171
|
+
- lib/rubocop/cop/chef/modernize/provides_initializer.rb
|
164
172
|
- lib/rubocop/cop/chef/modernize/resource_name_initializer.rb
|
165
173
|
- lib/rubocop/cop/chef/modernize/resource_set_or_return.rb
|
166
174
|
- lib/rubocop/cop/chef/modernize/resource_with_attributes.rb
|
@@ -173,6 +181,7 @@ files:
|
|
173
181
|
- lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb
|
174
182
|
- lib/rubocop/cop/chef/modernize/systctl_param_resource.rb
|
175
183
|
- lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb
|
184
|
+
- lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb
|
176
185
|
- lib/rubocop/cop/chef/modernize/use_require_relative.rb
|
177
186
|
- lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb
|
178
187
|
- lib/rubocop/cop/chef/modernize/windows_default_recipe.rb
|
@@ -223,7 +232,6 @@ files:
|
|
223
232
|
- lib/rubocop/monkey_patches/commissioner.rb
|
224
233
|
- lib/rubocop/monkey_patches/config.rb
|
225
234
|
- lib/rubocop/monkey_patches/cop.rb
|
226
|
-
- lib/rubocop/monkey_patches/json_formatter.rb
|
227
235
|
homepage:
|
228
236
|
licenses:
|
229
237
|
- Apache-2.0
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Formatter
|
5
|
-
# This formatter formats the report data in JSON format.
|
6
|
-
class JSONFormatter < BaseFormatter
|
7
|
-
# We need to expose the correctable status until https://github.com/rubocop-hq/rubocop/pull/7514 is merged
|
8
|
-
def hash_for_offense(offense)
|
9
|
-
{
|
10
|
-
severity: offense.severity.name,
|
11
|
-
message: offense.message,
|
12
|
-
cop_name: offense.cop_name,
|
13
|
-
corrected: offense.corrected?,
|
14
|
-
correctable: offense.status != :unsupported,
|
15
|
-
location: hash_for_location(offense),
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|