cookstyle 7.12.2 → 7.14.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 +25 -2
- data/config/disable_all.yml +10 -0
- data/config/upstream.yml +47 -6
- data/lib/cookstyle.rb +1 -1
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +37 -18
- data/lib/rubocop/cop/inspec/deprecation/attribute_default.rb +53 -0
- data/lib/rubocop/cop/inspec/deprecation/attribute_helper.rb +47 -0
- 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: 2fb8828f5ea858d36d8aece2ac5de3e469e04fcd86301ebb2fa86aeffd2ec9bc
|
4
|
+
data.tar.gz: 4b1101bab8a823c1a161478dbb1503e9c7cca0d340a33c07aecef0f6c15efdff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7308b900c24d494ec617f001a3b83ee3f9491fb38de29ee7491c67c3c58605ba21c43c81419567ddd5b150674221c243ceec1faa075ab3744c2e426097f09624
|
7
|
+
data.tar.gz: 3ba724acde273762b7073740e84f19b8d439d20f73ec73e237fd4cefc5dc7c65d84d7b4d62992d56aedca825e924f32063e6557811401f0e0740de6dc4b80e5f
|
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
|
###############################
|
@@ -1205,6 +1205,8 @@ Chef/Deprecations/ResourceWithoutUnifiedTrue:
|
|
1205
1205
|
VersionAdded: '7.12.0'
|
1206
1206
|
Include:
|
1207
1207
|
- '**/resources/*.rb'
|
1208
|
+
Exclude:
|
1209
|
+
- '**/spec/**/*.rb'
|
1208
1210
|
|
1209
1211
|
###############################
|
1210
1212
|
# Chef/Modernize: Cleaning up legacy code and using new built-in resources
|
@@ -2078,6 +2080,27 @@ Chef/Effortless/Berksfile:
|
|
2078
2080
|
Include:
|
2079
2081
|
- '**/Berksfile'
|
2080
2082
|
|
2083
|
+
#### InSpec cops
|
2084
|
+
|
2085
|
+
InSpec/Deprecations:
|
2086
|
+
StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/
|
2087
|
+
|
2088
|
+
InSpec/Deprecations/AttributeHelper:
|
2089
|
+
Description: InSpec attributes have been renamed to inputs. Use the `input` method not the deprecation `attribute` method to access these values.
|
2090
|
+
StyleGuide: 'inspec_deprecations_attributehelper'
|
2091
|
+
Enabled: true
|
2092
|
+
VersionAdded: '7.14.0'
|
2093
|
+
Include:
|
2094
|
+
- '**/controls/*.rb'
|
2095
|
+
|
2096
|
+
InSpec/Deprecations/AttributeDefault:
|
2097
|
+
Description: The InSpec inputs `default` option has been replaced with the `value` option.
|
2098
|
+
StyleGuide: 'inspec_deprecations_attributedefaults'
|
2099
|
+
Enabled: true
|
2100
|
+
VersionAdded: '7.14.0'
|
2101
|
+
Include:
|
2102
|
+
- '**/controls/*.rb'
|
2103
|
+
|
2081
2104
|
#### The base rubocop 0.37 enabled.yml file we started with ####
|
2082
2105
|
|
2083
2106
|
Layout/AccessModifierIndentation:
|
data/config/disable_all.yml
CHANGED
@@ -275,6 +275,8 @@ Lint/EmptyExpression:
|
|
275
275
|
Enabled: false
|
276
276
|
Lint/EmptyFile:
|
277
277
|
Enabled: false
|
278
|
+
Lint/EmptyInPattern:
|
279
|
+
Enabled: false
|
278
280
|
Lint/EmptyInterpolation:
|
279
281
|
Enabled: false
|
280
282
|
Lint/EmptyWhen:
|
@@ -667,6 +669,8 @@ Style/IfWithSemicolon:
|
|
667
669
|
Enabled: false
|
668
670
|
Style/ImplicitRuntimeError:
|
669
671
|
Enabled: false
|
672
|
+
Style/InPatternThen:
|
673
|
+
Enabled: false
|
670
674
|
Style/InfiniteLoop:
|
671
675
|
Enabled: false
|
672
676
|
Style/InverseMethods:
|
@@ -687,6 +691,8 @@ Style/MethodCallWithoutArgsParentheses:
|
|
687
691
|
Enabled: false
|
688
692
|
Style/MethodCallWithArgsParentheses:
|
689
693
|
Enabled: false
|
694
|
+
Style/MultilineInPatternThen:
|
695
|
+
Enabled: false
|
690
696
|
Style/RedundantAssignment:
|
691
697
|
Enabled: false
|
692
698
|
Style/RedundantFetchBlock:
|
@@ -787,6 +793,8 @@ Style/PreferredHashMethods:
|
|
787
793
|
Enabled: false
|
788
794
|
Style/Proc:
|
789
795
|
Enabled: false
|
796
|
+
Style/QuotedSymbols:
|
797
|
+
Enabled: false
|
790
798
|
Style/RaiseArgs:
|
791
799
|
Enabled: false
|
792
800
|
Style/RandomWithOffset:
|
@@ -883,6 +891,8 @@ Style/SymbolProc:
|
|
883
891
|
Enabled: false
|
884
892
|
Style/TernaryParentheses:
|
885
893
|
Enabled: false
|
894
|
+
Style/TopLevelMethodDefinition:
|
895
|
+
Enabled: false
|
886
896
|
Style/TrailingBodyOnClass:
|
887
897
|
Enabled: false
|
888
898
|
Style/TrailingBodyOnMethodDefinition:
|
data/config/upstream.yml
CHANGED
@@ -377,10 +377,11 @@ Layout/BlockEndNewline:
|
|
377
377
|
VersionAdded: '0.49'
|
378
378
|
|
379
379
|
Layout/CaseIndentation:
|
380
|
-
Description: 'Indentation of when in a case/when/[else/]end.'
|
380
|
+
Description: 'Indentation of when in a case/(when|in)/[else/]end.'
|
381
381
|
StyleGuide: '#indent-when-to-case'
|
382
382
|
Enabled: true
|
383
383
|
VersionAdded: '0.49'
|
384
|
+
VersionChanged: '1.16'
|
384
385
|
EnforcedStyle: case
|
385
386
|
SupportedStyles:
|
386
387
|
- case
|
@@ -771,7 +772,7 @@ Layout/HashAlignment:
|
|
771
772
|
Enabled: true
|
772
773
|
AllowMultipleStyles: true
|
773
774
|
VersionAdded: '0.49'
|
774
|
-
VersionChanged: '
|
775
|
+
VersionChanged: '1.16'
|
775
776
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
776
777
|
#
|
777
778
|
# key - left alignment of keys
|
@@ -1612,7 +1613,7 @@ Lint/EmptyBlock:
|
|
1612
1613
|
Description: 'This cop checks for blocks without a body.'
|
1613
1614
|
Enabled: pending
|
1614
1615
|
VersionAdded: '1.1'
|
1615
|
-
VersionChanged: '1.
|
1616
|
+
VersionChanged: '1.15'
|
1616
1617
|
AllowComments: true
|
1617
1618
|
AllowEmptyLambdas: true
|
1618
1619
|
|
@@ -1645,6 +1646,12 @@ Lint/EmptyFile:
|
|
1645
1646
|
AllowComments: true
|
1646
1647
|
VersionAdded: '0.90'
|
1647
1648
|
|
1649
|
+
Lint/EmptyInPattern:
|
1650
|
+
Description: 'Checks for the presence of `in` pattern branches without a body.'
|
1651
|
+
Enabled: pending
|
1652
|
+
AllowComments: true
|
1653
|
+
VersionAdded: '1.16'
|
1654
|
+
|
1648
1655
|
Lint/EmptyInterpolation:
|
1649
1656
|
Description: 'Checks for empty string interpolation.'
|
1650
1657
|
Enabled: true
|
@@ -2092,6 +2099,7 @@ Lint/SymbolConversion:
|
|
2092
2099
|
Description: 'Checks for unnecessary symbol conversions.'
|
2093
2100
|
Enabled: pending
|
2094
2101
|
VersionAdded: '1.9'
|
2102
|
+
VersionChanged: '1.16'
|
2095
2103
|
EnforcedStyle: strict
|
2096
2104
|
SupportedStyles:
|
2097
2105
|
- strict
|
@@ -3480,6 +3488,7 @@ Style/HashAsLastArrayItem:
|
|
3480
3488
|
|
3481
3489
|
Style/HashConversion:
|
3482
3490
|
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3491
|
+
StyleGuide: '#avoid-hash-constructor'
|
3483
3492
|
Enabled: pending
|
3484
3493
|
VersionAdded: '1.10'
|
3485
3494
|
VersionChanged: '1.11'
|
@@ -3489,8 +3498,10 @@ Style/HashEachMethods:
|
|
3489
3498
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
3490
3499
|
StyleGuide: '#hash-each'
|
3491
3500
|
Enabled: true
|
3492
|
-
VersionAdded: '0.80'
|
3493
3501
|
Safe: false
|
3502
|
+
VersionAdded: '0.80'
|
3503
|
+
VersionChanged: '1.16'
|
3504
|
+
AllowedReceivers: []
|
3494
3505
|
|
3495
3506
|
Style/HashExcept:
|
3496
3507
|
Description: >-
|
@@ -3553,6 +3564,7 @@ Style/IdenticalConditionalBranches:
|
|
3553
3564
|
out of the conditional.
|
3554
3565
|
Enabled: true
|
3555
3566
|
VersionAdded: '0.36'
|
3567
|
+
VersionChanged: '1.16'
|
3556
3568
|
|
3557
3569
|
Style/IfInsideElse:
|
3558
3570
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
@@ -3599,6 +3611,12 @@ Style/ImplicitRuntimeError:
|
|
3599
3611
|
Enabled: false
|
3600
3612
|
VersionAdded: '0.41'
|
3601
3613
|
|
3614
|
+
Style/InPatternThen:
|
3615
|
+
Description: 'Checks for `in;` uses in `case` expressions.'
|
3616
|
+
StyleGuide: '#no-in-pattern-semicolons'
|
3617
|
+
Enabled: pending
|
3618
|
+
VersionAdded: '1.16'
|
3619
|
+
|
3602
3620
|
Style/InfiniteLoop:
|
3603
3621
|
Description: >-
|
3604
3622
|
Use Kernel#loop for infinite loops.
|
@@ -3827,6 +3845,12 @@ Style/MultilineIfThen:
|
|
3827
3845
|
VersionAdded: '0.9'
|
3828
3846
|
VersionChanged: '0.26'
|
3829
3847
|
|
3848
|
+
Style/MultilineInPatternThen:
|
3849
|
+
Description: 'Do not use `then` for multi-line `in` statement.'
|
3850
|
+
StyleGuide: '#no-then'
|
3851
|
+
Enabled: pending
|
3852
|
+
VersionAdded: '1.16'
|
3853
|
+
|
3830
3854
|
Style/MultilineMemoization:
|
3831
3855
|
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
|
3832
3856
|
Enabled: true
|
@@ -3998,6 +4022,7 @@ Style/NilLambda:
|
|
3998
4022
|
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3999
4023
|
Enabled: pending
|
4000
4024
|
VersionAdded: '1.3'
|
4025
|
+
VersionChanged: '1.15'
|
4001
4026
|
|
4002
4027
|
Style/NonNilCheck:
|
4003
4028
|
Description: 'Checks for redundant nil checks.'
|
@@ -4184,6 +4209,16 @@ Style/Proc:
|
|
4184
4209
|
VersionAdded: '0.9'
|
4185
4210
|
VersionChanged: '0.18'
|
4186
4211
|
|
4212
|
+
Style/QuotedSymbols:
|
4213
|
+
Description: 'Use a consistent style for quoted symbols.'
|
4214
|
+
Enabled: pending
|
4215
|
+
VersionAdded: '1.16'
|
4216
|
+
EnforcedStyle: same_as_string_literals
|
4217
|
+
SupportedStyles:
|
4218
|
+
- same_as_string_literals
|
4219
|
+
- single_quotes
|
4220
|
+
- double_quotes
|
4221
|
+
|
4187
4222
|
Style/RaiseArgs:
|
4188
4223
|
Description: 'Checks the arguments passed to raise/fail.'
|
4189
4224
|
StyleGuide: '#exception-class-messages'
|
@@ -4651,6 +4686,12 @@ Style/TernaryParentheses:
|
|
4651
4686
|
- require_parentheses_when_complex
|
4652
4687
|
AllowSafeAssignment: true
|
4653
4688
|
|
4689
|
+
Style/TopLevelMethodDefinition:
|
4690
|
+
Description: 'This cop looks for top-level method definitions.'
|
4691
|
+
StyleGuide: '#top-level-methods'
|
4692
|
+
Enabled: false
|
4693
|
+
VersionAdded: '1.15'
|
4694
|
+
|
4654
4695
|
Style/TrailingBodyOnClass:
|
4655
4696
|
Description: 'Class body goes below class statement.'
|
4656
4697
|
Enabled: true
|
@@ -4737,7 +4778,7 @@ Style/TrivialAccessors:
|
|
4737
4778
|
StyleGuide: '#attr_family'
|
4738
4779
|
Enabled: true
|
4739
4780
|
VersionAdded: '0.9'
|
4740
|
-
VersionChanged: '
|
4781
|
+
VersionChanged: '1.15'
|
4741
4782
|
# When set to `false` the cop will suggest the use of accessor methods
|
4742
4783
|
# in situations like:
|
4743
4784
|
#
|
@@ -4756,7 +4797,7 @@ Style/TrivialAccessors:
|
|
4756
4797
|
# on_exception :restart
|
4757
4798
|
#
|
4758
4799
|
# Commonly used in DSLs
|
4759
|
-
AllowDSLWriters:
|
4800
|
+
AllowDSLWriters: true
|
4760
4801
|
IgnoreClassMethods: false
|
4761
4802
|
AllowedMethods:
|
4762
4803
|
- to_ary
|
data/lib/cookstyle.rb
CHANGED
@@ -46,7 +46,7 @@ require_relative 'rubocop/chef/cookbook_only'
|
|
46
46
|
require_relative 'rubocop/cop/target_chef_version'
|
47
47
|
|
48
48
|
# Chef Infra specific cops
|
49
|
-
Dir.glob(__dir__ + '/rubocop/cop
|
49
|
+
Dir.glob(__dir__ + '/rubocop/cop/**/*.rb') do |file|
|
50
50
|
next if File.directory?(file)
|
51
51
|
|
52
52
|
require_relative file # not actually relative but require_relative is faster
|
data/lib/cookstyle/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright:: 2020, Chef Software, Inc.
|
3
|
+
# Copyright:: 2020-2021, Chef Software, Inc.
|
4
4
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -32,12 +32,12 @@ module RuboCop
|
|
32
32
|
# action :create
|
33
33
|
# end
|
34
34
|
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
35
|
+
# #### correct
|
36
|
+
# windows_uac 'Set Windows UAC settings' do
|
37
|
+
# enable_uac false
|
38
|
+
# prompt_on_secure_desktop true
|
39
|
+
# consent_behavior_admins :no_prompt
|
40
|
+
# end
|
41
41
|
#
|
42
42
|
class WindowsRegistryUAC < Base
|
43
43
|
include RuboCop::Chef::CookbookHelpers
|
@@ -47,24 +47,43 @@ module RuboCop
|
|
47
47
|
|
48
48
|
MSG = 'Chef Infra Client 15.0 and later includes a windows_uac resource that should be used to set Windows UAC values instead of setting registry keys directly.'
|
49
49
|
RESTRICT_ON_SEND = [:registry_key].freeze
|
50
|
+
VALID_VALUES = %w(EnableLUA ValidateAdminCodeSignatures PromptOnSecureDesktop ConsentPromptBehaviorAdmin ConsentPromptBehaviorUser EnableInstallerDetection).freeze
|
50
51
|
|
51
|
-
#
|
52
|
-
def
|
53
|
-
return unless node
|
54
|
-
|
55
|
-
|
56
|
-
# use source instead of .value in case there's string interpolation which adds a complex dstr type
|
57
|
-
# with a nested string and a begin. Source allows us to avoid a lot of defensive programming here
|
52
|
+
# block registry_key resources
|
53
|
+
def on_block(node)
|
54
|
+
return unless node.method_name == :registry_key
|
55
|
+
return unless correct_key?(node)
|
56
|
+
return unless uac_supported_values?(node)
|
58
57
|
add_offense(node, message: MSG, severity: :refactor)
|
59
58
|
end
|
60
59
|
|
61
|
-
#
|
62
|
-
|
60
|
+
# make sure the values passed are all the ones in the uac resource
|
61
|
+
# this key has other values we don't support in the windows_uac resource
|
62
|
+
def uac_supported_values?(node)
|
63
|
+
match_property_in_resource?(:registry_key, 'values', node) do |val_prop|
|
64
|
+
return false unless val_prop&.arguments[0].array_type? # make sure values isn't being passed a variable or method
|
65
|
+
val_prop.arguments[0].each_value do |array|
|
66
|
+
array.each_pair do |key, value|
|
67
|
+
if key == s(:sym, :name)
|
68
|
+
return false unless value.str_type? # make sure it isn't being a variable or method that we can't parse
|
69
|
+
return false unless VALID_VALUES.include?(value.value)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
# make sure the registry_key resource is running against the correct key
|
78
|
+
# check the block name and the key property (registry_key's name property)
|
79
|
+
def correct_key?(node)
|
80
|
+
return true if node.send_node.arguments.first.source.match?(/(HKLM|HKEY_LOCAL_MACHINE)\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System/i)
|
81
|
+
|
63
82
|
match_property_in_resource?(:registry_key, 'key', node) do |key_prop|
|
64
83
|
property_data = method_arg_ast_to_string(key_prop)
|
65
|
-
return
|
66
|
-
add_offense(node, message: MSG, severity: :refactor)
|
84
|
+
return true if property_data && property_data.match?(/(HKLM|HKEY_LOCAL_MACHINE)\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System/i)
|
67
85
|
end
|
86
|
+
false
|
68
87
|
end
|
69
88
|
end
|
70
89
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: 2021, Chef Software Inc.
|
4
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
module RuboCop
|
19
|
+
module Cop
|
20
|
+
module InSpec
|
21
|
+
module Deprecations
|
22
|
+
# The InSpec inputs `default` option has been replaced with the `value` option.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### incorrect
|
27
|
+
# login_defs_umask = input('login_defs_umask', default: '077', description: 'Default umask to set in login.defs')
|
28
|
+
#
|
29
|
+
# #### correct
|
30
|
+
# login_defs_umask = input('login_defs_umask', value: '077', description: 'Default umask to set in login.defs')
|
31
|
+
#
|
32
|
+
class AttributeDefault < Base
|
33
|
+
extend AutoCorrector
|
34
|
+
|
35
|
+
MSG = 'The InSpec inputs `default` option has been replaced with the `value` option.'
|
36
|
+
RESTRICT_ON_SEND = [:attribute, :input].freeze
|
37
|
+
|
38
|
+
def_node_matcher :default?, <<-PATTERN
|
39
|
+
(send nil? {:attribute :input} _ (hash <(pair $(sym :default) ...) ...>) )
|
40
|
+
PATTERN
|
41
|
+
|
42
|
+
def on_send(node)
|
43
|
+
default?(node) do |n|
|
44
|
+
add_offense(n, message: MSG, severity: :warning) do |corrector|
|
45
|
+
corrector.replace(n, 'value')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: 2021, Chef Software Inc.
|
4
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
module RuboCop
|
19
|
+
module Cop
|
20
|
+
module InSpec
|
21
|
+
module Deprecations
|
22
|
+
# InSpec attributes have been renamed to inputs. Use the `input` method not the deprecation `attribute` method to access these values.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### incorrect
|
27
|
+
# login_defs_umask = attribute('login_defs_umask', value: '077', description: 'Default umask to set in login.defs')
|
28
|
+
#
|
29
|
+
# #### correct
|
30
|
+
# login_defs_umask = input('login_defs_umask', value: '077', description: 'Default umask to set in login.defs')
|
31
|
+
#
|
32
|
+
class AttributeHelper < Base
|
33
|
+
extend AutoCorrector
|
34
|
+
|
35
|
+
MSG = 'InSpec attributes have been renamed to inputs. Use the `input` method not the deprecation `attribute` method to access these values.'
|
36
|
+
RESTRICT_ON_SEND = [:attribute].freeze
|
37
|
+
|
38
|
+
def on_send(node)
|
39
|
+
add_offense(node, message: MSG, severity: :warning) do |corrector|
|
40
|
+
corrector.replace(node.loc.expression, node.loc.expression.source.gsub(/^attribute/, 'input'))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
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: 7.
|
4
|
+
version: 7.14.2
|
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: 2021-
|
12
|
+
date: 2021-06-23 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: 1.
|
20
|
+
version: 1.17.0
|
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: 1.
|
27
|
+
version: 1.17.0
|
28
28
|
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
@@ -275,6 +275,8 @@ files:
|
|
275
275
|
- lib/rubocop/cop/chef/style/unnecessary_os_check.rb
|
276
276
|
- lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb
|
277
277
|
- lib/rubocop/cop/chef/style/use_platform_helpers.rb
|
278
|
+
- lib/rubocop/cop/inspec/deprecation/attribute_default.rb
|
279
|
+
- lib/rubocop/cop/inspec/deprecation/attribute_helper.rb
|
278
280
|
- lib/rubocop/cop/target_chef_version.rb
|
279
281
|
- lib/rubocop/monkey_patches/base.rb
|
280
282
|
- lib/rubocop/monkey_patches/config.rb
|