cookstyle 7.23.0 → 7.25.9
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/Gemfile +4 -4
- data/config/cookstyle.yml +27 -0
- data/config/disable_all.yml +15 -1
- data/config/upstream.yml +68 -15
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/metadata_missing_version.rb +48 -0
- data/lib/rubocop/cop/chef/modernize/class_eval_action_class.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/declare_action_class.rb +54 -0
- data/lib/rubocop/cop/chef/modernize/use_chef_language_cloud_helpers.rb +3 -0
- data/lib/rubocop/cop/chef/modernize/use_chef_language_env_helpers.rb +3 -0
- data/lib/rubocop/cop/chef/modernize/use_chef_language_systemd_helper.rb +60 -0
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9eb0efc1571e7c41eb101724d88451edf016e1a7e19ed90a20d72879ee5b08ff
|
|
4
|
+
data.tar.gz: 02ccfda204d3fa46056c093d1258fa361d730f2da893e39aa4f227ae9105191f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7531239e1f04dcdee653d5c41c36c1a63b546e5a468ca5688eacda2b126aec1780f97cb49615bbcc5833c4cbbc8aff98833297884ad7d30c02a4ea959b9c291
|
|
7
|
+
data.tar.gz: cc5742cd59d0c1b416727d7e66eff1c735d485a2261c1dab54d12a8aa716cb1ebd8af1d36a745c45cb08aef876a56efed28c844edd04dd331f5a293694854c05
|
data/Gemfile
CHANGED
|
@@ -6,8 +6,6 @@ gemspec
|
|
|
6
6
|
|
|
7
7
|
group :debug do
|
|
8
8
|
gem 'pry'
|
|
9
|
-
gem 'pry-byebug'
|
|
10
|
-
gem 'pry-stack_explorer', '<= 0.4.13' # 0.4.13+ drops support for Ruby < 2.6
|
|
11
9
|
end
|
|
12
10
|
|
|
13
11
|
group :docs do
|
|
@@ -15,8 +13,10 @@ group :docs do
|
|
|
15
13
|
end
|
|
16
14
|
|
|
17
15
|
group :profiling do
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
platforms :ruby do
|
|
17
|
+
gem 'memory_profiler'
|
|
18
|
+
gem 'stackprof'
|
|
19
|
+
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
group :rubocop_gems do
|
data/config/cookstyle.yml
CHANGED
|
@@ -498,6 +498,14 @@ Chef/Correctness/PowershellFileExists:
|
|
|
498
498
|
- '**/metadata.rb'
|
|
499
499
|
- '**/Berksfile'
|
|
500
500
|
|
|
501
|
+
Chef/Correctness/MetadataMissingVersion:
|
|
502
|
+
Description: metadata.rb should define a version for the cookbook.
|
|
503
|
+
StyleGuide: 'chef_correctness_metadatamissingversion'
|
|
504
|
+
Enabled: true
|
|
505
|
+
VersionAdded: '7.25'
|
|
506
|
+
Include:
|
|
507
|
+
- '**/metadata.rb'
|
|
508
|
+
|
|
501
509
|
###############################
|
|
502
510
|
# Chef/Sharing: Issues that prevent sharing code with other teams or with the Chef community in general
|
|
503
511
|
###############################
|
|
@@ -1924,6 +1932,24 @@ Chef/Modernize/ClassEvalActionClass:
|
|
|
1924
1932
|
Include:
|
|
1925
1933
|
- '**/resources/*.rb'
|
|
1926
1934
|
|
|
1935
|
+
Chef/Modernize/UseChefLanguageSystemdHelper:
|
|
1936
|
+
Description: Chef Infra Client 15.5 and later include a `systemd?` helper for checking if a Linux system uses systemd.
|
|
1937
|
+
StyleGuide: 'chef_modernize_usecheflanguagesystemdhelper'
|
|
1938
|
+
Enabled: true
|
|
1939
|
+
VersionAdded: '7.24.0'
|
|
1940
|
+
Exclude:
|
|
1941
|
+
- '**/metadata.rb'
|
|
1942
|
+
- '**/Berksfile'
|
|
1943
|
+
|
|
1944
|
+
Chef/Modernize/DeclareActionClass:
|
|
1945
|
+
Description: In Chef Infra Client 12.9 and later `action_class` can be used instead of `declare_action_class`.
|
|
1946
|
+
StyleGuide: 'chef_modernize_declareactionclass'
|
|
1947
|
+
Enabled: true
|
|
1948
|
+
VersionAdded: '7.26.0'
|
|
1949
|
+
Include:
|
|
1950
|
+
- '**/resources/*.rb'
|
|
1951
|
+
- '**/libraries/*.rb'
|
|
1952
|
+
|
|
1927
1953
|
###############################
|
|
1928
1954
|
# Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
|
|
1929
1955
|
###############################
|
|
@@ -2796,6 +2822,7 @@ Style/GuardClause:
|
|
|
2796
2822
|
# Users really shouldn't have a gem, but if they do they should do it securely
|
|
2797
2823
|
Bundler/InsecureProtocolSource:
|
|
2798
2824
|
Enabled: true
|
|
2825
|
+
AllowHttpProtocol: false
|
|
2799
2826
|
|
|
2800
2827
|
# It's easier to read a simple .each and they're faster
|
|
2801
2828
|
Lint/RedundantWithIndex:
|
data/config/disable_all.yml
CHANGED
|
@@ -221,6 +221,8 @@ Lint/AmbiguousBlockAssociation:
|
|
|
221
221
|
Enabled: false
|
|
222
222
|
Lint/AmbiguousOperator:
|
|
223
223
|
Enabled: false
|
|
224
|
+
Lint/AmbiguousOperatorPrecedence:
|
|
225
|
+
Enabled: false
|
|
224
226
|
Lint/AmbiguousRange:
|
|
225
227
|
Enabled: false
|
|
226
228
|
Lint/AmbiguousRegexpLiteral:
|
|
@@ -307,10 +309,12 @@ Lint/IdentityComparison:
|
|
|
307
309
|
Enabled: false
|
|
308
310
|
Lint/ImplicitStringConcatenation:
|
|
309
311
|
Enabled: false
|
|
310
|
-
Lint/
|
|
312
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
|
311
313
|
Enabled: false
|
|
312
314
|
Lint/IneffectiveAccessModifier:
|
|
313
315
|
Enabled: false
|
|
316
|
+
Lint/InheritException:
|
|
317
|
+
Enabled: false
|
|
314
318
|
Lint/InterpolationCheck:
|
|
315
319
|
Enabled: false
|
|
316
320
|
Lint/LambdaWithoutLiteralBlock:
|
|
@@ -383,6 +387,8 @@ Lint/RegexpAsCondition:
|
|
|
383
387
|
Enabled: false
|
|
384
388
|
Lint/RequireParentheses:
|
|
385
389
|
Enabled: false
|
|
390
|
+
Lint/RequireRelativeSelfPath:
|
|
391
|
+
Enabled: false
|
|
386
392
|
Lint/RescueException:
|
|
387
393
|
Enabled: false
|
|
388
394
|
Lint/RescueType:
|
|
@@ -701,6 +707,8 @@ Style/MethodCallWithArgsParentheses:
|
|
|
701
707
|
Enabled: false
|
|
702
708
|
Style/MultilineInPatternThen:
|
|
703
709
|
Enabled: false
|
|
710
|
+
Style/NumberedParameters:
|
|
711
|
+
Enabled: false
|
|
704
712
|
Style/RedundantAssignment:
|
|
705
713
|
Enabled: false
|
|
706
714
|
Style/RedundantFetchBlock:
|
|
@@ -773,6 +781,8 @@ Style/NonNilCheck:
|
|
|
773
781
|
Enabled: false
|
|
774
782
|
Style/Not:
|
|
775
783
|
Enabled: false
|
|
784
|
+
Style/NumberedParametersLimit:
|
|
785
|
+
Enabled: false
|
|
776
786
|
Style/NumericLiterals:
|
|
777
787
|
Enabled: false
|
|
778
788
|
Style/NumericLiteralPrefix:
|
|
@@ -853,6 +863,8 @@ Style/SafeNavigation:
|
|
|
853
863
|
Enabled: false
|
|
854
864
|
Style/Sample:
|
|
855
865
|
Enabled: false
|
|
866
|
+
Style/SelectByRegexp:
|
|
867
|
+
Enabled: false
|
|
856
868
|
Style/SelfAssignment:
|
|
857
869
|
Enabled: false
|
|
858
870
|
Style/Semicolon:
|
|
@@ -945,6 +957,8 @@ Style/ZeroLengthPredicate:
|
|
|
945
957
|
Enabled: false
|
|
946
958
|
Security/Eval:
|
|
947
959
|
Enabled: false
|
|
960
|
+
Security/IoMethods:
|
|
961
|
+
Enabled: false
|
|
948
962
|
Security/JSONLoad:
|
|
949
963
|
Enabled: false
|
|
950
964
|
Security/MarshalLoad:
|
data/config/upstream.yml
CHANGED
|
@@ -130,7 +130,7 @@ AllCops:
|
|
|
130
130
|
# What MRI version of the Ruby interpreter is the inspected code intended to
|
|
131
131
|
# run on? (If there is more than one, set this to the lowest version.)
|
|
132
132
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
|
133
|
-
# values are
|
|
133
|
+
# values are specified as a float (i.e. 3.0); the teeny version of Ruby
|
|
134
134
|
# should not be included. If the project specifies a Ruby version in the
|
|
135
135
|
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
|
136
136
|
# try to determine the desired version of Ruby by inspecting the
|
|
@@ -209,6 +209,7 @@ Bundler/InsecureProtocolSource:
|
|
|
209
209
|
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
|
210
210
|
Enabled: true
|
|
211
211
|
VersionAdded: '0.50'
|
|
212
|
+
AllowHttpProtocol: true
|
|
212
213
|
Include:
|
|
213
214
|
- '**/*.gemfile'
|
|
214
215
|
- '**/Gemfile'
|
|
@@ -261,7 +262,7 @@ Gemspec/RequiredRubyVersion:
|
|
|
261
262
|
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
|
262
263
|
Enabled: true
|
|
263
264
|
VersionAdded: '0.52'
|
|
264
|
-
VersionChanged: '
|
|
265
|
+
VersionChanged: '1.22'
|
|
265
266
|
Include:
|
|
266
267
|
- '**/*.gemspec'
|
|
267
268
|
|
|
@@ -957,7 +958,6 @@ Layout/LineLength:
|
|
|
957
958
|
Enabled: true
|
|
958
959
|
VersionAdded: '0.25'
|
|
959
960
|
VersionChanged: '1.4'
|
|
960
|
-
AutoCorrect: true
|
|
961
961
|
Max: 120
|
|
962
962
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
|
963
963
|
# containing a URI to be longer than Max.
|
|
@@ -1361,10 +1361,11 @@ Layout/SpaceInsideParens:
|
|
|
1361
1361
|
StyleGuide: '#spaces-braces'
|
|
1362
1362
|
Enabled: true
|
|
1363
1363
|
VersionAdded: '0.49'
|
|
1364
|
-
VersionChanged: '
|
|
1364
|
+
VersionChanged: '1.22'
|
|
1365
1365
|
EnforcedStyle: no_space
|
|
1366
1366
|
SupportedStyles:
|
|
1367
1367
|
- space
|
|
1368
|
+
- compact
|
|
1368
1369
|
- no_space
|
|
1369
1370
|
|
|
1370
1371
|
Layout/SpaceInsidePercentLiteralDelimiters:
|
|
@@ -1448,6 +1449,13 @@ Lint/AmbiguousOperator:
|
|
|
1448
1449
|
VersionAdded: '0.17'
|
|
1449
1450
|
VersionChanged: '0.83'
|
|
1450
1451
|
|
|
1452
|
+
Lint/AmbiguousOperatorPrecedence:
|
|
1453
|
+
Description: >-
|
|
1454
|
+
Checks for expressions containing multiple binary operations with
|
|
1455
|
+
ambiguous precedence.
|
|
1456
|
+
Enabled: pending
|
|
1457
|
+
VersionAdded: '1.21'
|
|
1458
|
+
|
|
1451
1459
|
Lint/AmbiguousRange:
|
|
1452
1460
|
Description: Checks for ranges with ambiguous boundaries.
|
|
1453
1461
|
Enabled: pending
|
|
@@ -1485,9 +1493,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
|
1485
1493
|
Lint/BooleanSymbol:
|
|
1486
1494
|
Description: 'Check for `:true` and `:false` symbols.'
|
|
1487
1495
|
Enabled: true
|
|
1488
|
-
|
|
1496
|
+
SafeAutoCorrect: false
|
|
1489
1497
|
VersionAdded: '0.50'
|
|
1490
|
-
VersionChanged: '
|
|
1498
|
+
VersionChanged: '1.22'
|
|
1491
1499
|
|
|
1492
1500
|
Lint/CircularArgumentReference:
|
|
1493
1501
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
|
@@ -1560,6 +1568,7 @@ Lint/DeprecatedConstants:
|
|
|
1560
1568
|
Description: 'Checks for deprecated constants.'
|
|
1561
1569
|
Enabled: pending
|
|
1562
1570
|
VersionAdded: '1.8'
|
|
1571
|
+
VersionChanged: '1.22'
|
|
1563
1572
|
# You can configure deprecated constants.
|
|
1564
1573
|
# If there is an alternative method, you can set alternative value as `Alternative`.
|
|
1565
1574
|
# And you can set the deprecated version as `DeprecatedVersion`.
|
|
@@ -1580,6 +1589,9 @@ Lint/DeprecatedConstants:
|
|
|
1580
1589
|
'FALSE':
|
|
1581
1590
|
Alternative: 'false'
|
|
1582
1591
|
DeprecatedVersion: '2.4'
|
|
1592
|
+
'Net::HTTPServerException':
|
|
1593
|
+
Alternative: 'Net::HTTPClientException'
|
|
1594
|
+
DeprecatedVersion: '2.6'
|
|
1583
1595
|
'Random::DEFAULT':
|
|
1584
1596
|
Alternative: 'Random.new'
|
|
1585
1597
|
DeprecatedVersion: '3.0'
|
|
@@ -1771,6 +1783,11 @@ Lint/ImplicitStringConcatenation:
|
|
|
1771
1783
|
Enabled: true
|
|
1772
1784
|
VersionAdded: '0.36'
|
|
1773
1785
|
|
|
1786
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
|
1787
|
+
Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
|
|
1788
|
+
Enabled: pending
|
|
1789
|
+
VersionAdded: '1.21'
|
|
1790
|
+
|
|
1774
1791
|
Lint/IneffectiveAccessModifier:
|
|
1775
1792
|
Description: >-
|
|
1776
1793
|
Checks for attempts to use `private` or `protected` to set
|
|
@@ -2034,6 +2051,11 @@ Lint/RequireParentheses:
|
|
|
2034
2051
|
Enabled: true
|
|
2035
2052
|
VersionAdded: '0.18'
|
|
2036
2053
|
|
|
2054
|
+
Lint/RequireRelativeSelfPath:
|
|
2055
|
+
Description: 'Checks for uses a file requiring itself with `require_relative`.'
|
|
2056
|
+
Enabled: pending
|
|
2057
|
+
VersionAdded: '1.22'
|
|
2058
|
+
|
|
2037
2059
|
Lint/RescueException:
|
|
2038
2060
|
Description: 'Avoid rescuing the Exception class.'
|
|
2039
2061
|
StyleGuide: '#no-blind-rescues'
|
|
@@ -2563,8 +2585,9 @@ Naming/HeredocDelimiterNaming:
|
|
|
2563
2585
|
|
|
2564
2586
|
Naming/InclusiveLanguage:
|
|
2565
2587
|
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
|
2566
|
-
Enabled:
|
|
2588
|
+
Enabled: false
|
|
2567
2589
|
VersionAdded: '1.18'
|
|
2590
|
+
VersionChanged: '1.21'
|
|
2568
2591
|
CheckIdentifiers: true
|
|
2569
2592
|
CheckConstants: true
|
|
2570
2593
|
CheckVariables: true
|
|
@@ -2720,6 +2743,14 @@ Security/Eval:
|
|
|
2720
2743
|
Enabled: true
|
|
2721
2744
|
VersionAdded: '0.47'
|
|
2722
2745
|
|
|
2746
|
+
Security/IoMethods:
|
|
2747
|
+
Description: >-
|
|
2748
|
+
Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
|
|
2749
|
+
`IO.foreach`, and `IO.readlines`.
|
|
2750
|
+
Enabled: pending
|
|
2751
|
+
Safe: false
|
|
2752
|
+
VersionAdded: '1.22'
|
|
2753
|
+
|
|
2723
2754
|
Security/JSONLoad:
|
|
2724
2755
|
Description: >-
|
|
2725
2756
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
|
@@ -2727,10 +2758,9 @@ Security/JSONLoad:
|
|
|
2727
2758
|
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
|
2728
2759
|
Enabled: true
|
|
2729
2760
|
VersionAdded: '0.43'
|
|
2730
|
-
VersionChanged: '
|
|
2761
|
+
VersionChanged: '1.22'
|
|
2731
2762
|
# Autocorrect here will change to a method that may cause crashes depending
|
|
2732
2763
|
# on the value of the argument.
|
|
2733
|
-
AutoCorrect: false
|
|
2734
2764
|
SafeAutoCorrect: false
|
|
2735
2765
|
|
|
2736
2766
|
Security/MarshalLoad:
|
|
@@ -2796,8 +2826,9 @@ Style/AndOr:
|
|
|
2796
2826
|
Description: 'Use &&/|| instead of and/or.'
|
|
2797
2827
|
StyleGuide: '#no-and-or-or'
|
|
2798
2828
|
Enabled: true
|
|
2829
|
+
SafeAutoCorrect: false
|
|
2799
2830
|
VersionAdded: '0.9'
|
|
2800
|
-
VersionChanged: '
|
|
2831
|
+
VersionChanged: '1.21'
|
|
2801
2832
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
|
2802
2833
|
# or completely (always).
|
|
2803
2834
|
EnforcedStyle: conditionals
|
|
@@ -2831,9 +2862,9 @@ Style/ArrayJoin:
|
|
|
2831
2862
|
Style/AsciiComments:
|
|
2832
2863
|
Description: 'Use only ascii symbols in comments.'
|
|
2833
2864
|
StyleGuide: '#english-comments'
|
|
2834
|
-
Enabled:
|
|
2865
|
+
Enabled: false
|
|
2835
2866
|
VersionAdded: '0.9'
|
|
2836
|
-
VersionChanged: '
|
|
2867
|
+
VersionChanged: '1.21'
|
|
2837
2868
|
AllowedChars:
|
|
2838
2869
|
- ©
|
|
2839
2870
|
|
|
@@ -2995,7 +3026,7 @@ Style/CaseEquality:
|
|
|
2995
3026
|
Enabled: true
|
|
2996
3027
|
VersionAdded: '0.9'
|
|
2997
3028
|
VersionChanged: '0.89'
|
|
2998
|
-
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
|
3029
|
+
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
|
2999
3030
|
# the case equality operator is a constant.
|
|
3000
3031
|
#
|
|
3001
3032
|
# # bad
|
|
@@ -3690,7 +3721,7 @@ Style/InPatternThen:
|
|
|
3690
3721
|
Style/InfiniteLoop:
|
|
3691
3722
|
Description: >-
|
|
3692
3723
|
Use Kernel#loop for infinite loops.
|
|
3693
|
-
This cop is unsafe
|
|
3724
|
+
This cop is unsafe if the body may raise a `StopIteration` exception.
|
|
3694
3725
|
Safe: false
|
|
3695
3726
|
StyleGuide: '#infinite-loop'
|
|
3696
3727
|
Enabled: true
|
|
@@ -4116,6 +4147,21 @@ Style/Not:
|
|
|
4116
4147
|
VersionAdded: '0.9'
|
|
4117
4148
|
VersionChanged: '0.20'
|
|
4118
4149
|
|
|
4150
|
+
Style/NumberedParameters:
|
|
4151
|
+
Description: 'Restrict the usage of numbered parameters.'
|
|
4152
|
+
Enabled: pending
|
|
4153
|
+
VersionAdded: '1.22'
|
|
4154
|
+
EnforcedStyle: allow_single_line
|
|
4155
|
+
SupportedStyles:
|
|
4156
|
+
- allow_single_line
|
|
4157
|
+
- disallow
|
|
4158
|
+
|
|
4159
|
+
Style/NumberedParametersLimit:
|
|
4160
|
+
Description: 'Avoid excessive numbered params in a single block.'
|
|
4161
|
+
Enabled: pending
|
|
4162
|
+
VersionAdded: '1.22'
|
|
4163
|
+
Max: 1
|
|
4164
|
+
|
|
4119
4165
|
Style/NumericLiteralPrefix:
|
|
4120
4166
|
Description: 'Use smallcase prefixes for numeric literals.'
|
|
4121
4167
|
StyleGuide: '#numeric-literal-prefixes'
|
|
@@ -4126,7 +4172,6 @@ Style/NumericLiteralPrefix:
|
|
|
4126
4172
|
- zero_with_o
|
|
4127
4173
|
- zero_only
|
|
4128
4174
|
|
|
4129
|
-
|
|
4130
4175
|
Style/NumericLiterals:
|
|
4131
4176
|
Description: >-
|
|
4132
4177
|
Add underscores to large numeric literals to improve their
|
|
@@ -4447,6 +4492,8 @@ Style/RedundantSort:
|
|
|
4447
4492
|
`max_by` instead of `sort_by...last`, etc.
|
|
4448
4493
|
Enabled: true
|
|
4449
4494
|
VersionAdded: '0.76'
|
|
4495
|
+
VersionChanged: '1.22'
|
|
4496
|
+
Safe: false
|
|
4450
4497
|
|
|
4451
4498
|
Style/RedundantSortBy:
|
|
4452
4499
|
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
|
@@ -4527,6 +4574,12 @@ Style/Sample:
|
|
|
4527
4574
|
Enabled: true
|
|
4528
4575
|
VersionAdded: '0.30'
|
|
4529
4576
|
|
|
4577
|
+
Style/SelectByRegexp:
|
|
4578
|
+
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
|
4579
|
+
Enabled: pending
|
|
4580
|
+
SafeAutoCorrect: false
|
|
4581
|
+
VersionAdded: '1.22'
|
|
4582
|
+
|
|
4530
4583
|
Style/SelfAssignment:
|
|
4531
4584
|
Description: >-
|
|
4532
4585
|
Checks for places where self-assignment shorthand should have
|
data/lib/cookstyle/version.rb
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
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 Chef
|
|
21
|
+
module Correctness
|
|
22
|
+
# metadata.rb should define a version for the cookbook.
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
#
|
|
26
|
+
# #### correct
|
|
27
|
+
# name 'foo'
|
|
28
|
+
# version '1.0.0'
|
|
29
|
+
#
|
|
30
|
+
class MetadataMissingVersion < Base
|
|
31
|
+
extend AutoCorrector
|
|
32
|
+
include RangeHelp
|
|
33
|
+
|
|
34
|
+
MSG = 'metadata.rb should define a version for the cookbook.'
|
|
35
|
+
|
|
36
|
+
def_node_search :cb_version?, '(send nil? :version str ...)'
|
|
37
|
+
|
|
38
|
+
def on_new_investigation
|
|
39
|
+
# Using range similar to RuboCop::Cop::Naming::Filename (file_name.rb)
|
|
40
|
+
return if cb_version?(processed_source.ast)
|
|
41
|
+
range = source_range(processed_source.buffer, 1, 0)
|
|
42
|
+
add_offense(range, message: MSG, severity: :refactor)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -40,7 +40,6 @@ module RuboCop
|
|
|
40
40
|
minimum_target_chef_version '12.9'
|
|
41
41
|
|
|
42
42
|
MSG = 'In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block.'
|
|
43
|
-
RESTRICT_ON_SEND = [:include_recipe].freeze
|
|
44
43
|
|
|
45
44
|
def_node_matcher :class_eval_action_class?, <<-PATTERN
|
|
46
45
|
(block
|
|
@@ -0,0 +1,54 @@
|
|
|
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 Chef
|
|
21
|
+
module Modernize
|
|
22
|
+
# In Chef Infra Client 12.9 and later `action_class` can be used instead of `declare_action_class`.
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
#
|
|
26
|
+
# #### incorrect
|
|
27
|
+
# declare_action_class do
|
|
28
|
+
# foo
|
|
29
|
+
# end
|
|
30
|
+
#
|
|
31
|
+
# #### correct
|
|
32
|
+
# action_class do
|
|
33
|
+
# foo
|
|
34
|
+
# end
|
|
35
|
+
#
|
|
36
|
+
class DeclareActionClass < Base
|
|
37
|
+
extend TargetChefVersion
|
|
38
|
+
extend AutoCorrector
|
|
39
|
+
|
|
40
|
+
minimum_target_chef_version '12.9'
|
|
41
|
+
|
|
42
|
+
MSG = 'In Chef Infra Client 12.9 and later `action_class` can be used instead of `declare_action_class`.'
|
|
43
|
+
RESTRICT_ON_SEND = [:declare_action_class].freeze
|
|
44
|
+
|
|
45
|
+
def on_send(node)
|
|
46
|
+
add_offense(node, message: MSG, severity: :refactor) do |corrector|
|
|
47
|
+
corrector.replace(node, node.source.gsub('declare_action_class', 'action_class'))
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -49,6 +49,9 @@ module RuboCop
|
|
|
49
49
|
#
|
|
50
50
|
class UseChefLanguageCloudHelpers < Base
|
|
51
51
|
extend AutoCorrector
|
|
52
|
+
extend TargetChefVersion
|
|
53
|
+
|
|
54
|
+
minimum_target_chef_version '15.5'
|
|
52
55
|
|
|
53
56
|
MSG = 'Chef Infra Client 15.5 and later include cloud helpers to make detecting instances that run on public and private clouds easier.'
|
|
54
57
|
RESTRICT_ON_SEND = [:==, :[]].freeze
|
|
@@ -0,0 +1,60 @@
|
|
|
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 Chef
|
|
21
|
+
module Modernize
|
|
22
|
+
# Chef Infra Client 15.5 and later include a `systemd?` helper for checking if a Linux system uses systemd.
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
#
|
|
26
|
+
# #### incorrect
|
|
27
|
+
# node['init_package'] == 'systemd'
|
|
28
|
+
#
|
|
29
|
+
# #### correct
|
|
30
|
+
# systemd?
|
|
31
|
+
#
|
|
32
|
+
class UseChefLanguageSystemdHelper < Base
|
|
33
|
+
extend AutoCorrector
|
|
34
|
+
extend TargetChefVersion
|
|
35
|
+
|
|
36
|
+
minimum_target_chef_version '15.5'
|
|
37
|
+
|
|
38
|
+
MSG = 'Chef Infra Client 15.5 and later include a `systemd?` helper for checking if a Linux system uses systemd.'
|
|
39
|
+
RESTRICT_ON_SEND = [:==].freeze
|
|
40
|
+
|
|
41
|
+
def_node_matcher :node_init_package?, <<-PATTERN
|
|
42
|
+
(send
|
|
43
|
+
(send
|
|
44
|
+
(send nil? :node) :[]
|
|
45
|
+
(str "init_package")) :==
|
|
46
|
+
(str "systemd"))
|
|
47
|
+
PATTERN
|
|
48
|
+
|
|
49
|
+
def on_send(node)
|
|
50
|
+
node_init_package?(node) do |_cloud_name|
|
|
51
|
+
add_offense(node, message: MSG, severity: :refactor) do |corrector|
|
|
52
|
+
corrector.replace(node, 'systemd?')
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
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.25.9
|
|
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-10-27 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.22.3
|
|
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.22.3
|
|
28
28
|
description:
|
|
29
29
|
email:
|
|
30
30
|
- thom@chef.io
|
|
@@ -71,6 +71,7 @@ files:
|
|
|
71
71
|
- lib/rubocop/cop/chef/correctness/malformed_value_for_platform.rb
|
|
72
72
|
- lib/rubocop/cop/chef/correctness/metadata_malformed_version.rb
|
|
73
73
|
- lib/rubocop/cop/chef/correctness/metadata_missing_name.rb
|
|
74
|
+
- lib/rubocop/cop/chef/correctness/metadata_missing_version.rb
|
|
74
75
|
- lib/rubocop/cop/chef/correctness/node_normal.rb
|
|
75
76
|
- lib/rubocop/cop/chef/correctness/node_normal_unless.rb
|
|
76
77
|
- lib/rubocop/cop/chef/correctness/node_save.rb
|
|
@@ -187,6 +188,7 @@ files:
|
|
|
187
188
|
- lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb
|
|
188
189
|
- lib/rubocop/cop/chef/modernize/cron_manage_resource.rb
|
|
189
190
|
- lib/rubocop/cop/chef/modernize/databag_helpers.rb
|
|
191
|
+
- lib/rubocop/cop/chef/modernize/declare_action_class.rb
|
|
190
192
|
- lib/rubocop/cop/chef/modernize/default_action_initializer.rb
|
|
191
193
|
- lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb
|
|
192
194
|
- lib/rubocop/cop/chef/modernize/definitions.rb
|
|
@@ -239,6 +241,7 @@ files:
|
|
|
239
241
|
- lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb
|
|
240
242
|
- lib/rubocop/cop/chef/modernize/use_chef_language_cloud_helpers.rb
|
|
241
243
|
- lib/rubocop/cop/chef/modernize/use_chef_language_env_helpers.rb
|
|
244
|
+
- lib/rubocop/cop/chef/modernize/use_chef_language_systemd_helper.rb
|
|
242
245
|
- lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb
|
|
243
246
|
- lib/rubocop/cop/chef/modernize/use_require_relative.rb
|
|
244
247
|
- lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb
|