cookstyle 7.24.1 → 7.25.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f15883e8b06ca175e673c9bc97a1d33f2e79da76a8f9a3a60ee0262868890ac3
4
- data.tar.gz: 518d0db21d8525486fc3406898afecd84bb6d27b52ea49c155a4b8000af39cdb
3
+ metadata.gz: 1a67abdf6a42bec1022fc57e53a61a9aa6f371641e6afe429eee6a9489ff2355
4
+ data.tar.gz: c3ff11c1e6ef1be4af29d034d662a6b662a731103082477b0d8d0e9e3a0455e2
5
5
  SHA512:
6
- metadata.gz: 53bde638d1b3829cfece0f84c9d9d25cc69c6d775181155ef154fcc40b310daefb1a01ed424db39e16fcff7fb61fe01469ee3b6cf8d1e320b2dd58f212b70145
7
- data.tar.gz: d24b861cf7b56441c16e2be78fc97650ab093b70fc7734c8b3ee8fa889f2e60406026e23af3b19da3984c4050bf2c1e763d50d5f09a59c55af61bee4cc88e577
6
+ metadata.gz: 79074fc5f3c7ef245dbcb64a4739a49298cda263bc216333215599bbc7e052f0979981e67572eec6d77b33c8e620370087b32ad20f90d2c5f5ddcbfaf99182cc
7
+ data.tar.gz: 116535d0ada1a04fd19bb9af708390402aeeb983a962af1a681d66e9f9fa81afc515450f1bcae187dcf8de83876a8fd5c9a091ea0d93313033821f34263f51a8
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
- gem 'memory_profiler'
19
- gem 'stackprof'
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
  ###############################
@@ -2805,6 +2813,7 @@ Style/GuardClause:
2805
2813
  # Users really shouldn't have a gem, but if they do they should do it securely
2806
2814
  Bundler/InsecureProtocolSource:
2807
2815
  Enabled: true
2816
+ AllowHttpProtocol: false
2808
2817
 
2809
2818
  # It's easier to read a simple .each and they're faster
2810
2819
  Lint/RedundantWithIndex:
@@ -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/InheritException:
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 specificed as a float (i.e. 3.0); the teeny version of Ruby
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'
@@ -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: '0.55'
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
- Safe: false
1496
+ SafeAutoCorrect: false
1489
1497
  VersionAdded: '0.50'
1490
- VersionChanged: '0.83'
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."
@@ -1771,6 +1779,11 @@ Lint/ImplicitStringConcatenation:
1771
1779
  Enabled: true
1772
1780
  VersionAdded: '0.36'
1773
1781
 
1782
+ Lint/IncompatibleIoSelectWithFiberScheduler:
1783
+ Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
1784
+ Enabled: pending
1785
+ VersionAdded: '1.21'
1786
+
1774
1787
  Lint/IneffectiveAccessModifier:
1775
1788
  Description: >-
1776
1789
  Checks for attempts to use `private` or `protected` to set
@@ -2034,6 +2047,11 @@ Lint/RequireParentheses:
2034
2047
  Enabled: true
2035
2048
  VersionAdded: '0.18'
2036
2049
 
2050
+ Lint/RequireRelativeSelfPath:
2051
+ Description: 'Checks for uses a file requiring itself with `require_relative`.'
2052
+ Enabled: pending
2053
+ VersionAdded: '1.22'
2054
+
2037
2055
  Lint/RescueException:
2038
2056
  Description: 'Avoid rescuing the Exception class.'
2039
2057
  StyleGuide: '#no-blind-rescues'
@@ -2563,8 +2581,9 @@ Naming/HeredocDelimiterNaming:
2563
2581
 
2564
2582
  Naming/InclusiveLanguage:
2565
2583
  Description: 'Recommend the use of inclusive language instead of problematic terms.'
2566
- Enabled: pending
2584
+ Enabled: false
2567
2585
  VersionAdded: '1.18'
2586
+ VersionChanged: '1.21'
2568
2587
  CheckIdentifiers: true
2569
2588
  CheckConstants: true
2570
2589
  CheckVariables: true
@@ -2720,6 +2739,14 @@ Security/Eval:
2720
2739
  Enabled: true
2721
2740
  VersionAdded: '0.47'
2722
2741
 
2742
+ Security/IoMethods:
2743
+ Description: >-
2744
+ Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
2745
+ `IO.foreach`, and `IO.readlines`.
2746
+ Enabled: pending
2747
+ Safe: false
2748
+ VersionAdded: '1.22'
2749
+
2723
2750
  Security/JSONLoad:
2724
2751
  Description: >-
2725
2752
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
@@ -2796,8 +2823,9 @@ Style/AndOr:
2796
2823
  Description: 'Use &&/|| instead of and/or.'
2797
2824
  StyleGuide: '#no-and-or-or'
2798
2825
  Enabled: true
2826
+ SafeAutoCorrect: false
2799
2827
  VersionAdded: '0.9'
2800
- VersionChanged: '0.25'
2828
+ VersionChanged: '1.21'
2801
2829
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2802
2830
  # or completely (always).
2803
2831
  EnforcedStyle: conditionals
@@ -2831,9 +2859,9 @@ Style/ArrayJoin:
2831
2859
  Style/AsciiComments:
2832
2860
  Description: 'Use only ascii symbols in comments.'
2833
2861
  StyleGuide: '#english-comments'
2834
- Enabled: true
2862
+ Enabled: false
2835
2863
  VersionAdded: '0.9'
2836
- VersionChanged: '0.52'
2864
+ VersionChanged: '1.21'
2837
2865
  AllowedChars:
2838
2866
  - ©
2839
2867
 
@@ -2995,7 +3023,7 @@ Style/CaseEquality:
2995
3023
  Enabled: true
2996
3024
  VersionAdded: '0.9'
2997
3025
  VersionChanged: '0.89'
2998
- # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
3026
+ # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
2999
3027
  # the case equality operator is a constant.
3000
3028
  #
3001
3029
  # # bad
@@ -3690,7 +3718,7 @@ Style/InPatternThen:
3690
3718
  Style/InfiniteLoop:
3691
3719
  Description: >-
3692
3720
  Use Kernel#loop for infinite loops.
3693
- This cop is unsafe in the body may raise a `StopIteration` exception.
3721
+ This cop is unsafe if the body may raise a `StopIteration` exception.
3694
3722
  Safe: false
3695
3723
  StyleGuide: '#infinite-loop'
3696
3724
  Enabled: true
@@ -4116,6 +4144,21 @@ Style/Not:
4116
4144
  VersionAdded: '0.9'
4117
4145
  VersionChanged: '0.20'
4118
4146
 
4147
+ Style/NumberedParameters:
4148
+ Description: 'Restrict the usage of numbered parameters.'
4149
+ Enabled: pending
4150
+ VersionAdded: '1.22'
4151
+ EnforcedStyle: allow_single_line
4152
+ SupportedStyles:
4153
+ - allow_single_line
4154
+ - disallow
4155
+
4156
+ Style/NumberedParametersLimit:
4157
+ Description: 'Avoid excessive numbered params in a single block.'
4158
+ Enabled: pending
4159
+ VersionAdded: '1.22'
4160
+ Max: 1
4161
+
4119
4162
  Style/NumericLiteralPrefix:
4120
4163
  Description: 'Use smallcase prefixes for numeric literals.'
4121
4164
  StyleGuide: '#numeric-literal-prefixes'
@@ -4126,7 +4169,6 @@ Style/NumericLiteralPrefix:
4126
4169
  - zero_with_o
4127
4170
  - zero_only
4128
4171
 
4129
-
4130
4172
  Style/NumericLiterals:
4131
4173
  Description: >-
4132
4174
  Add underscores to large numeric literals to improve their
@@ -4447,6 +4489,8 @@ Style/RedundantSort:
4447
4489
  `max_by` instead of `sort_by...last`, etc.
4448
4490
  Enabled: true
4449
4491
  VersionAdded: '0.76'
4492
+ VersionChanged: '1.22'
4493
+ Safe: false
4450
4494
 
4451
4495
  Style/RedundantSortBy:
4452
4496
  Description: 'Use `sort` instead of `sort_by { |x| x }`.'
@@ -4527,6 +4571,12 @@ Style/Sample:
4527
4571
  Enabled: true
4528
4572
  VersionAdded: '0.30'
4529
4573
 
4574
+ Style/SelectByRegexp:
4575
+ Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
4576
+ Enabled: pending
4577
+ SafeAutoCorrect: false
4578
+ VersionAdded: '1.22'
4579
+
4530
4580
  Style/SelfAssignment:
4531
4581
  Description: >-
4532
4582
  Checks for places where self-assignment shorthand should have
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.24.1" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '1.20.0'
3
+ VERSION = "7.25.6" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '1.22.0'
5
5
  end
@@ -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
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.24.1
4
+ version: 7.25.6
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-09-02 00:00:00.000000000 Z
12
+ date: 2021-09-30 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.0
20
+ version: 1.22.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.20.0
27
+ version: 1.22.0
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