cookstyle 8.1.4 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/chefstyle.yml +17 -1
- data/config/cookstyle.yml +16 -0
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/execute_relative_creates_without_cwd.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +4 -8
- data/lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb +1 -1
- data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +1 -1
- data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +1 -1
- metadata +5 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a112e54131a04e30238454352863d369ac970da0b4ef2ff85c0bb38ceaeec0d7
|
4
|
+
data.tar.gz: 65961294e7f5e942c1ad8867d72c95fb5e758f310eb517d38e8bbdfeac85d3cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40ed170a3026d9c516df5bdd6c9689556c2346f152a616e198a8c71b9ec3afbbff999298d3a62f644f8508a52edc9dd965fd69ebb182288977068163353a9269
|
7
|
+
data.tar.gz: 1274df60cb1b12de06ff21aa1fe58af6f80b7867db6d223c9d97fcd22640613bfee162c7ac4aa0af4c5ca4b757137cae78001ecc48467b7e52a7ec7693c7f4f7
|
data/config/chefstyle.yml
CHANGED
@@ -613,7 +613,7 @@ Bundler/OrderedGems:
|
|
613
613
|
# is also perfectly descriptive even though its only 2 characters...).
|
614
614
|
Naming/HeredocDelimiterNaming:
|
615
615
|
Enabled: false
|
616
|
-
Naming/
|
616
|
+
Naming/PredicatePrefix:
|
617
617
|
Enabled: false
|
618
618
|
Naming/MethodParameterName:
|
619
619
|
Enabled: false
|
@@ -852,6 +852,22 @@ Style/RedundantFormat:
|
|
852
852
|
Lint/RedundantTypeConversion:
|
853
853
|
Enabled: true
|
854
854
|
|
855
|
+
# Don't use .flatten and then .join when you can use .join directly
|
856
|
+
Style/RedundantArrayFlatten:
|
857
|
+
Enabled: true
|
858
|
+
|
859
|
+
# Avoid the use of || when the left side will never be nil
|
860
|
+
Lint/UselessOr:
|
861
|
+
Enabled: true
|
862
|
+
|
863
|
+
# Warn when default values are passed that won't be used
|
864
|
+
Lint/UselessDefaultValueArgument:
|
865
|
+
Enabled: true
|
866
|
+
|
867
|
+
# use helpers like .any?, .none?, and .one? instead of using count on collections which is much slower
|
868
|
+
Style/CollectionQuerying:
|
869
|
+
Enabled: true
|
870
|
+
|
855
871
|
Chef/Deprecations/Ruby27KeywordArgumentWarnings:
|
856
872
|
Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
|
857
873
|
Enabled: true
|
data/config/cookstyle.yml
CHANGED
@@ -3271,3 +3271,19 @@ Style/RedundantFormat:
|
|
3271
3271
|
# Don't convert types if we don't need to
|
3272
3272
|
Lint/RedundantTypeConversion:
|
3273
3273
|
Enabled: true
|
3274
|
+
|
3275
|
+
# Don't use .flatten and then .join when you can use .join directly
|
3276
|
+
Style/RedundantArrayFlatten:
|
3277
|
+
Enabled: true
|
3278
|
+
|
3279
|
+
# Avoid the use of || when the left side will never be nil
|
3280
|
+
Lint/UselessOr:
|
3281
|
+
Enabled: true
|
3282
|
+
|
3283
|
+
# Warn when default values are passed that won't be used
|
3284
|
+
Lint/UselessDefaultValueArgument:
|
3285
|
+
Enabled: true
|
3286
|
+
|
3287
|
+
# use helpers like .any?, .none?, and .one? instead of using count on collections which is much slower
|
3288
|
+
Style/CollectionQuerying:
|
3289
|
+
Enabled: true
|
data/lib/cookstyle/version.rb
CHANGED
@@ -45,7 +45,7 @@ module RuboCop
|
|
45
45
|
|
46
46
|
def on_block(node)
|
47
47
|
match_property_in_resource?(:execute, 'creates', node) do |offense|
|
48
|
-
return unless offense.arguments.
|
48
|
+
return unless offense.arguments.one? # we can only analyze simple string args
|
49
49
|
return unless offense.arguments.first.str_type? # we can only analyze simple string args
|
50
50
|
|
51
51
|
# skip any creates that are abs paths https://rubular.com/r/3TbDsgcAa1EaIF
|
@@ -117,17 +117,13 @@ module RuboCop
|
|
117
117
|
|
118
118
|
def has_provides?
|
119
119
|
provides_ast = provides(processed_source.ast)
|
120
|
-
return false if provides_ast.
|
120
|
+
return false if provides_ast.none?
|
121
121
|
|
122
122
|
resource_ast = resource_name(processed_source.ast)
|
123
123
|
|
124
|
-
if
|
125
|
-
|
126
|
-
|
127
|
-
# since we have a resource and provides make sure the there is a provides that
|
128
|
-
# matches the resource name
|
129
|
-
provides_ast.include?(resource_ast.first)
|
130
|
-
end
|
124
|
+
# if no resource ast then resource_name, but not provides
|
125
|
+
# else make sure the provides matches the resource name
|
126
|
+
resource_ast.none? || provides_ast.include?(resource_ast.first)
|
131
127
|
end
|
132
128
|
|
133
129
|
def indentation(node)
|
@@ -45,7 +45,7 @@ module RuboCop
|
|
45
45
|
|
46
46
|
def on_block(node)
|
47
47
|
match_property_in_resource?(:windows_package, 'installer_type', node) do |offense|
|
48
|
-
return unless offense.arguments.
|
48
|
+
return unless offense.arguments.one? # we can only analyze simple string args
|
49
49
|
return unless offense.arguments.first.str_type? # anything else is fine
|
50
50
|
|
51
51
|
add_offense(offense, severity: :warning) do |corrector|
|
@@ -50,7 +50,7 @@ module RuboCop
|
|
50
50
|
platform_version_check?(node) do
|
51
51
|
if parent_method_equals?(node, :[])
|
52
52
|
node = node.parent
|
53
|
-
if node&.arguments.
|
53
|
+
if node&.arguments.one? &&
|
54
54
|
node&.arguments&.first&.int_type? &&
|
55
55
|
node&.arguments&.first.source == '0'
|
56
56
|
add_offense_to_i_if_present(node)
|
@@ -55,7 +55,7 @@ module RuboCop
|
|
55
55
|
|
56
56
|
def on_case(node)
|
57
57
|
platform_case?(node) do |node_, type|
|
58
|
-
return unless node&.when_branches&.
|
58
|
+
return unless node&.when_branches&.one?
|
59
59
|
add_offense(node, severity: :refactor) do |corrector|
|
60
60
|
# we have at least one supermarket cookbook with an entirely empty platform case statement
|
61
61
|
# we can't actually fix that so let's do nothing here.
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookstyle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.1
|
4
|
+
version: 8.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom May
|
8
8
|
- Tim Smith
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rubocop
|
@@ -17,15 +16,14 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - '='
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
19
|
+
version: 1.77.0
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - '='
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
28
|
-
description:
|
26
|
+
version: 1.77.0
|
29
27
|
email:
|
30
28
|
- thom@chef.io
|
31
29
|
- tsmith84@gmail.com
|
@@ -324,7 +322,6 @@ metadata:
|
|
324
322
|
source_code_uri: https://github.com/chef/cookstyle
|
325
323
|
documentation_uri: https://docs.chef.io/workstation/cookstyle/
|
326
324
|
bug_tracker_uri: https://github.com/chef/cookstyle/issues
|
327
|
-
post_install_message:
|
328
325
|
rdoc_options: []
|
329
326
|
require_paths:
|
330
327
|
- lib
|
@@ -339,8 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
339
336
|
- !ruby/object:Gem::Version
|
340
337
|
version: '0'
|
341
338
|
requirements: []
|
342
|
-
rubygems_version: 3.
|
343
|
-
signing_key:
|
339
|
+
rubygems_version: 3.6.7
|
344
340
|
specification_version: 4
|
345
341
|
summary: Cookstyle is a code linting tool that helps you to write better Chef Infra
|
346
342
|
cookbooks by detecting and automatically correcting style, syntax, and logic mistakes
|