cookstyle 6.6.9 → 6.7.3
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 +14 -2
- data/config/disable_all.yml +8 -0
- data/config/upstream.yml +53 -18
- data/lib/cookstyle.rb +1 -1
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +3 -3
- data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +77 -0
- data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +24 -3
- data/lib/rubocop/monkey_patches/team.rb +24 -0
- metadata +6 -5
- data/lib/rubocop/monkey_patches/commissioner.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80cc2eea05cb8d161ae1849a5c9ccb5c104016d2f855945a38d45ce19e5e514e
|
4
|
+
data.tar.gz: a9db56d7cddd31470f7ec92326ad3763775d5536089cc70621ad60966eb806b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e16c81ad78a74694473ace336016e135552e427a2e8ee2ab697f28678afc038def94552512c37e519fe60459362f31718c180fc01a7fde6aab4f62e5606109
|
7
|
+
data.tar.gz: 05e491839ef5ada7257e780ec9d105cfed7b027451c78af9435723efc968d2380b5ad604763efceeb003a2a221e03057186ab358133e0145f79728c45c8f414b
|
data/config/cookstyle.yml
CHANGED
@@ -991,6 +991,15 @@ ChefDeprecations/Ruby27KeywordArgumentWarnings:
|
|
991
991
|
- '**/metadata.rb'
|
992
992
|
- '**/Berksfile'
|
993
993
|
|
994
|
+
ChefDeprecations/ResourceUsesOnlyResourceName:
|
995
|
+
Description: Starting with Chef Infra Client 16, using `resource_name` without also using `provides` will result in resource failures. Use `provides` to change the name of the resource instead and omit `resource_name` entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME.
|
996
|
+
StyleGuide: '#chefdeprecationsresourceusesonlyresourcename'
|
997
|
+
Enabled: true
|
998
|
+
VersionAdded: '6.7.0'
|
999
|
+
Include:
|
1000
|
+
- '**/libraries/*.rb'
|
1001
|
+
- '**/resources/*.rb'
|
1002
|
+
|
994
1003
|
###############################
|
995
1004
|
# ChefModernize: Cleaning up legacy code and using new built-in resources
|
996
1005
|
###############################
|
@@ -1115,6 +1124,7 @@ ChefModernize/IncludingMixinShelloutInResources:
|
|
1115
1124
|
Include:
|
1116
1125
|
- '**/resources/*.rb'
|
1117
1126
|
- '**/providers/*.rb'
|
1127
|
+
- '**/libraries/*.rb'
|
1118
1128
|
|
1119
1129
|
ChefModernize/UseBuildEssentialResource:
|
1120
1130
|
Description: Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
|
@@ -1789,8 +1799,6 @@ ChefEffortless/Berksfile:
|
|
1789
1799
|
|
1790
1800
|
Layout/AccessModifierIndentation:
|
1791
1801
|
Enabled: true
|
1792
|
-
Naming/AccessorMethodName:
|
1793
|
-
Enabled: true
|
1794
1802
|
Layout/AlignArray:
|
1795
1803
|
Enabled: true
|
1796
1804
|
Layout/AlignHash:
|
@@ -2444,3 +2452,7 @@ Style/MultilineWhenThen:
|
|
2444
2452
|
# .each_key is a lot more clear that .keys.each
|
2445
2453
|
Style/HashEachMethods:
|
2446
2454
|
Enabled: true
|
2455
|
+
|
2456
|
+
# We want to catch this deprecation in cookbooks
|
2457
|
+
Lint/DeprecatedOpenSSLConstant:
|
2458
|
+
Enabled: true
|
data/config/disable_all.yml
CHANGED
@@ -215,6 +215,8 @@ Lint/Debugger:
|
|
215
215
|
Enabled: false
|
216
216
|
Lint/DeprecatedClassMethods:
|
217
217
|
Enabled: false
|
218
|
+
Lint/DeprecatedOpenSSLConstant:
|
219
|
+
Enabled: false
|
218
220
|
Lint/DisjunctiveAssignmentInConstructor:
|
219
221
|
Enabled: false
|
220
222
|
Lint/DuplicateCaseCondition:
|
@@ -263,6 +265,8 @@ Lint/Loop:
|
|
263
265
|
Enabled: false
|
264
266
|
Lint/MissingCopEnableDirective:
|
265
267
|
Enabled: false
|
268
|
+
Lint/MixedRegexpCaptureTypes:
|
269
|
+
Enabled: false
|
266
270
|
Lint/MultipleComparison:
|
267
271
|
Enabled: false
|
268
272
|
Lint/NestedMethodDefinition:
|
@@ -667,6 +671,10 @@ Style/RedundantParentheses:
|
|
667
671
|
Enabled: false
|
668
672
|
Style/RedundantPercentQ:
|
669
673
|
Enabled: false
|
674
|
+
Style/RedundantRegexpCharacterClass:
|
675
|
+
Enabled: false
|
676
|
+
Style/RedundantRegexpEscape:
|
677
|
+
Enabled: false
|
670
678
|
Style/RedundantReturn:
|
671
679
|
Enabled: false
|
672
680
|
Style/RedundantSelf:
|
data/config/upstream.yml
CHANGED
@@ -153,12 +153,13 @@ Bundler/GemComment:
|
|
153
153
|
Description: 'Add a comment describing each gem.'
|
154
154
|
Enabled: false
|
155
155
|
VersionAdded: '0.59'
|
156
|
-
VersionChanged: '0.
|
156
|
+
VersionChanged: '0.85'
|
157
157
|
Include:
|
158
158
|
- '**/*.gemfile'
|
159
159
|
- '**/Gemfile'
|
160
160
|
- '**/gems.rb'
|
161
161
|
IgnoredGems: []
|
162
|
+
OnlyFor: []
|
162
163
|
|
163
164
|
Bundler/InsecureProtocolSource:
|
164
165
|
Description: >-
|
@@ -468,6 +469,13 @@ Layout/EmptyLinesAroundAttributeAccessor:
|
|
468
469
|
StyleGuide: '#empty-lines-around-attribute-accessor'
|
469
470
|
Enabled: pending
|
470
471
|
VersionAdded: '0.83'
|
472
|
+
VersionChanged: '0.84'
|
473
|
+
AllowAliasSyntax: true
|
474
|
+
AllowedMethods:
|
475
|
+
- alias_method
|
476
|
+
- public
|
477
|
+
- protected
|
478
|
+
- private
|
471
479
|
|
472
480
|
Layout/EmptyLinesAroundBeginBody:
|
473
481
|
Description: "Keeps track of empty lines around begin-end bodies."
|
@@ -783,13 +791,7 @@ Layout/HeredocIndentation:
|
|
783
791
|
StyleGuide: '#squiggly-heredocs'
|
784
792
|
Enabled: true
|
785
793
|
VersionAdded: '0.49'
|
786
|
-
VersionChanged: '0.
|
787
|
-
EnforcedStyle: squiggly
|
788
|
-
SupportedStyles:
|
789
|
-
- squiggly
|
790
|
-
- active_support
|
791
|
-
- powerpack
|
792
|
-
- unindent
|
794
|
+
VersionChanged: '0.85'
|
793
795
|
|
794
796
|
Layout/IndentationConsistency:
|
795
797
|
Description: 'Keep indentation straight.'
|
@@ -857,13 +859,13 @@ Layout/LeadingEmptyLines:
|
|
857
859
|
VersionChanged: '0.77'
|
858
860
|
|
859
861
|
Layout/LineLength:
|
860
|
-
Description: '
|
861
|
-
StyleGuide: '#
|
862
|
+
Description: 'Checks that line length does not exceed the configured limit.'
|
863
|
+
StyleGuide: '#max-line-length'
|
862
864
|
Enabled: true
|
863
865
|
VersionAdded: '0.25'
|
864
|
-
VersionChanged: '0.
|
866
|
+
VersionChanged: '0.84'
|
865
867
|
AutoCorrect: false
|
866
|
-
Max:
|
868
|
+
Max: 120
|
867
869
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
868
870
|
# containing a URI to be longer than Max.
|
869
871
|
AllowHeredoc: true
|
@@ -1370,6 +1372,11 @@ Lint/DeprecatedClassMethods:
|
|
1370
1372
|
Enabled: true
|
1371
1373
|
VersionAdded: '0.19'
|
1372
1374
|
|
1375
|
+
Lint/DeprecatedOpenSSLConstant:
|
1376
|
+
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1377
|
+
Enabled: pending
|
1378
|
+
VersionAdded: '0.84'
|
1379
|
+
|
1373
1380
|
Lint/DisjunctiveAssignmentInConstructor:
|
1374
1381
|
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1375
1382
|
Enabled: true
|
@@ -1526,6 +1533,11 @@ Lint/MissingCopEnableDirective:
|
|
1526
1533
|
# .inf for any size
|
1527
1534
|
MaximumRangeSize: .inf
|
1528
1535
|
|
1536
|
+
Lint/MixedRegexpCaptureTypes:
|
1537
|
+
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1538
|
+
Enabled: pending
|
1539
|
+
VersionAdded: '0.85'
|
1540
|
+
|
1529
1541
|
Lint/MultipleComparison:
|
1530
1542
|
Description: "Use `&&` operator to compare multiple values."
|
1531
1543
|
Enabled: true
|
@@ -1999,6 +2011,11 @@ Naming/ClassAndModuleCamelCase:
|
|
1999
2011
|
StyleGuide: '#camelcase-classes'
|
2000
2012
|
Enabled: true
|
2001
2013
|
VersionAdded: '0.50'
|
2014
|
+
VersionChanged: '0.85'
|
2015
|
+
# Allowed class/module names can be specified here.
|
2016
|
+
# These can be full or part of the name.
|
2017
|
+
AllowedNames:
|
2018
|
+
- module_parent
|
2002
2019
|
|
2003
2020
|
Naming/ConstantName:
|
2004
2021
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
@@ -2019,6 +2036,10 @@ Naming/FileName:
|
|
2019
2036
|
# It further expects it to be nested inside modules which match the names
|
2020
2037
|
# of subdirectories in its path.
|
2021
2038
|
ExpectMatchingDefinition: false
|
2039
|
+
# When `false`, changes the behavior of ExpectMatchingDefinition to match only
|
2040
|
+
# whether each source file's class or module name matches the file name --
|
2041
|
+
# not whether the nested module hierarchy matches the subdirectory path.
|
2042
|
+
CheckDefinitionPathHierarchy: true
|
2022
2043
|
# If non-`nil`, expect all source file names to match the following regex.
|
2023
2044
|
# Only the file name itself is matched, not the entire file path.
|
2024
2045
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2210,7 +2231,7 @@ Security/JSONLoad:
|
|
2210
2231
|
Description: >-
|
2211
2232
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2212
2233
|
security issues. See reference for more information.
|
2213
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2234
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2214
2235
|
Enabled: true
|
2215
2236
|
VersionAdded: '0.43'
|
2216
2237
|
VersionChanged: '0.44'
|
@@ -2223,7 +2244,7 @@ Security/MarshalLoad:
|
|
2223
2244
|
Description: >-
|
2224
2245
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2225
2246
|
security issues. See reference for more information.
|
2226
|
-
Reference: 'https://ruby-doc.org/core-2.
|
2247
|
+
Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2227
2248
|
Enabled: true
|
2228
2249
|
VersionAdded: '0.47'
|
2229
2250
|
|
@@ -2237,7 +2258,7 @@ Security/YAMLLoad:
|
|
2237
2258
|
Description: >-
|
2238
2259
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2239
2260
|
security issues. See reference for more information.
|
2240
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2261
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2241
2262
|
Enabled: true
|
2242
2263
|
VersionAdded: '0.47'
|
2243
2264
|
SafeAutoCorrect: false
|
@@ -2274,7 +2295,7 @@ Style/AndOr:
|
|
2274
2295
|
VersionChanged: '0.25'
|
2275
2296
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2276
2297
|
# or completely (always).
|
2277
|
-
EnforcedStyle:
|
2298
|
+
EnforcedStyle: conditionals
|
2278
2299
|
SupportedStyles:
|
2279
2300
|
- always
|
2280
2301
|
- conditionals
|
@@ -2694,6 +2715,11 @@ Style/DoubleNegation:
|
|
2694
2715
|
StyleGuide: '#no-bang-bang'
|
2695
2716
|
Enabled: true
|
2696
2717
|
VersionAdded: '0.19'
|
2718
|
+
VersionChanged: '0.84'
|
2719
|
+
EnforcedStyle: allowed_in_returns
|
2720
|
+
SupportedStyles:
|
2721
|
+
- allowed_in_returns
|
2722
|
+
- forbidden
|
2697
2723
|
|
2698
2724
|
Style/EachForSimpleLoop:
|
2699
2725
|
Description: >-
|
@@ -2857,8 +2883,7 @@ Style/FrozenStringLiteralComment:
|
|
2857
2883
|
SupportedStyles:
|
2858
2884
|
# `always` will always add the frozen string literal comment to a file
|
2859
2885
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
2860
|
-
# string literal.
|
2861
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
2886
|
+
# string literal. It is possible that this will create errors.
|
2862
2887
|
- always
|
2863
2888
|
# `always_true` will add the frozen string literal comment to a file,
|
2864
2889
|
# similarly to the `always` style, but will also change any disabled
|
@@ -3593,6 +3618,16 @@ Style/RedundantPercentQ:
|
|
3593
3618
|
Enabled: true
|
3594
3619
|
VersionAdded: '0.76'
|
3595
3620
|
|
3621
|
+
Style/RedundantRegexpCharacterClass:
|
3622
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
3623
|
+
Enabled: pending
|
3624
|
+
VersionAdded: '0.85'
|
3625
|
+
|
3626
|
+
Style/RedundantRegexpEscape:
|
3627
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
3628
|
+
Enabled: pending
|
3629
|
+
VersionAdded: '0.85'
|
3630
|
+
|
3596
3631
|
Style/RedundantReturn:
|
3597
3632
|
Description: "Don't use return where it's not required."
|
3598
3633
|
StyleGuide: '#no-explicit-return'
|
data/lib/cookstyle.rb
CHANGED
@@ -11,7 +11,7 @@ require 'rubocop/monkey_patches/comment_config.rb'
|
|
11
11
|
# monkey patches needed for the TargetChefVersion config option
|
12
12
|
require 'rubocop/monkey_patches/config.rb'
|
13
13
|
require 'rubocop/monkey_patches/cop.rb'
|
14
|
-
require 'rubocop/monkey_patches/
|
14
|
+
require 'rubocop/monkey_patches/team.rb'
|
15
15
|
|
16
16
|
module RuboCop
|
17
17
|
class ConfigLoader
|
data/lib/cookstyle/version.rb
CHANGED
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module ChefCorrectness
|
22
|
-
# When setting a node attribute as
|
22
|
+
# When setting a node attribute as the default value for a custom resource property, wrap the node attribute in `lazy {}` so that its value is available when the resource executes.
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -32,10 +32,10 @@ module RuboCop
|
|
32
32
|
class LazyEvalNodeAttributeDefaults < Cop
|
33
33
|
include RuboCop::Chef::CookbookHelpers
|
34
34
|
|
35
|
-
MSG = 'When setting a node attribute as
|
35
|
+
MSG = 'When setting a node attribute as the default value for a custom resource property, wrap the node attribute in `lazy {}` so that its value is available when the resource executes.'.freeze
|
36
36
|
|
37
37
|
def_node_matcher :non_lazy_node_attribute_default?, <<-PATTERN
|
38
|
-
|
38
|
+
(send nil? :property (sym _) ... (hash <(pair (sym :default) $(send (send _ :node) :[] _) ) ...>))
|
39
39
|
PATTERN
|
40
40
|
|
41
41
|
def on_send(node)
|
@@ -0,0 +1,77 @@
|
|
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
|
+
module RuboCop
|
18
|
+
module Cop
|
19
|
+
module Chef
|
20
|
+
module ChefDeprecations
|
21
|
+
# Starting with Chef Infra Client 16, using `resource_name` without also using `provides` will result in resource failures. Use `provides` to change the name of the resource instead and omit `resource_name` entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
#
|
25
|
+
# # bad
|
26
|
+
# mycookbook/resources/myresource.rb:
|
27
|
+
# resource_name :mycookbook_myresource
|
28
|
+
#
|
29
|
+
class ResourceUsesOnlyResourceName < Cop
|
30
|
+
include RuboCop::Chef::CookbookHelpers
|
31
|
+
include RangeHelp
|
32
|
+
|
33
|
+
MSG = 'Starting with Chef Infra Client 16, using `resource_name` without also using `provides` will result in resource failures. Use `provides` to change the name of the resource instead and omit `resource_name` entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME.'.freeze
|
34
|
+
|
35
|
+
def_node_matcher :resource_name?, <<-PATTERN
|
36
|
+
(send nil? :resource_name (sym $_ ))
|
37
|
+
PATTERN
|
38
|
+
|
39
|
+
def_node_search :cb_name_match, <<~PATTERN
|
40
|
+
(send nil? :name (str $_))
|
41
|
+
PATTERN
|
42
|
+
|
43
|
+
def_node_search :provides_methods?, '(send nil? {:provides :chef_version_for_provides} ... )'
|
44
|
+
|
45
|
+
def cookbook_name
|
46
|
+
cb_path = File.expand_path(File.join(processed_source.file_path, '../..'))
|
47
|
+
|
48
|
+
if File.exist?(File.join(cb_path, 'metadata.rb'))
|
49
|
+
cb_metadata_ast = ProcessedSource.from_file(File.join(cb_path, 'metadata.rb'), @config.target_ruby_version).ast
|
50
|
+
cb_name_match(cb_metadata_ast).first
|
51
|
+
elsif File.exist?(File.join(cb_path, 'metadata.json')) # this exists only for supermarket files that lack metadata.rb
|
52
|
+
JSON.parse(File.read(File.join(cb_path, 'metadata.json')))['name']
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def on_send(node)
|
57
|
+
resource_name?(node) do |_name|
|
58
|
+
add_offense(node, location: :expression, message: MSG, severity: :warning) unless provides_methods?(processed_source.ast)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def autocorrect(node)
|
63
|
+
lambda do |corrector|
|
64
|
+
resource_name?(node) do |name|
|
65
|
+
if name.to_s == "#{cookbook_name}_#{File.basename(processed_source.path, '.rb')}"
|
66
|
+
corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
|
67
|
+
else
|
68
|
+
corrector.replace(node.loc.expression, node.source.gsub('resource_name', 'provides'))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2019, Chef Software Inc.
|
2
|
+
# Copyright:: 2019-2020, 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");
|
@@ -42,13 +42,34 @@ module RuboCop
|
|
42
42
|
(send nil? :require ( str {"chef/mixin/shell_out" "chef/mixin/powershell_out"} ))
|
43
43
|
PATTERN
|
44
44
|
|
45
|
+
def_node_search :hwrp_classes?, <<-PATTERN
|
46
|
+
(class
|
47
|
+
(const ... )
|
48
|
+
{(const
|
49
|
+
(const
|
50
|
+
(const nil? :Chef) :Provider) :LWRPBase)
|
51
|
+
(const
|
52
|
+
(const nil? :Chef) :Provider)
|
53
|
+
}
|
54
|
+
...)
|
55
|
+
PATTERN
|
56
|
+
|
57
|
+
def check_for_offenses(node)
|
58
|
+
containing_dir = File.basename(File.dirname(processed_source.path))
|
59
|
+
|
60
|
+
# only add offenses when we're in a custom resource or HWRP, but not a plain old library
|
61
|
+
if containing_dir == 'resources' || hwrp_classes?(processed_source.ast)
|
62
|
+
add_offense(node, location: :expression, message: MSG, severity: :refactor)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
45
66
|
def on_send(node)
|
46
67
|
require_shellout?(node) do
|
47
|
-
|
68
|
+
check_for_offenses(node)
|
48
69
|
end
|
49
70
|
|
50
71
|
include_shellout?(node) do
|
51
|
-
|
72
|
+
check_for_offenses(node)
|
52
73
|
end
|
53
74
|
end
|
54
75
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
class Team
|
6
|
+
def support_target_chef_version?(cop)
|
7
|
+
return true unless cop.class.respond_to?(:support_target_chef_version?)
|
8
|
+
|
9
|
+
cop.class.support_target_chef_version?(cop.target_chef_version)
|
10
|
+
end
|
11
|
+
|
12
|
+
### START COOKSTYLE MODIFICATION
|
13
|
+
def roundup_relevant_cops(filename)
|
14
|
+
cops.reject do |cop|
|
15
|
+
cop.excluded_file?(filename) ||
|
16
|
+
!support_target_ruby_version?(cop) ||
|
17
|
+
!support_target_chef_version?(cop) ||
|
18
|
+
!support_target_rails_version?(cop)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
### END COOKSTYLE MODIFICATION
|
22
|
+
end
|
23
|
+
end
|
24
|
+
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: 6.
|
4
|
+
version: 6.7.3
|
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-06-02 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.85.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: 0.
|
27
|
+
version: 0.85.0
|
28
28
|
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/rubocop/cop/chef/deprecation/require_recipe.rb
|
120
120
|
- lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb
|
121
121
|
- lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb
|
122
|
+
- lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb
|
122
123
|
- lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb
|
123
124
|
- lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb
|
124
125
|
- lib/rubocop/cop/chef/deprecation/resource_without_name_or_provides.rb
|
@@ -244,9 +245,9 @@ files:
|
|
244
245
|
- lib/rubocop/cop/chef/style/use_platform_helpers.rb
|
245
246
|
- lib/rubocop/cop/target_chef_version.rb
|
246
247
|
- lib/rubocop/monkey_patches/comment_config.rb
|
247
|
-
- lib/rubocop/monkey_patches/commissioner.rb
|
248
248
|
- lib/rubocop/monkey_patches/config.rb
|
249
249
|
- lib/rubocop/monkey_patches/cop.rb
|
250
|
+
- lib/rubocop/monkey_patches/team.rb
|
250
251
|
homepage:
|
251
252
|
licenses:
|
252
253
|
- Apache-2.0
|
@@ -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
|