cookstyle 7.25.6 → 7.26.1

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: 1a67abdf6a42bec1022fc57e53a61a9aa6f371641e6afe429eee6a9489ff2355
4
- data.tar.gz: c3ff11c1e6ef1be4af29d034d662a6b662a731103082477b0d8d0e9e3a0455e2
3
+ metadata.gz: fe0113118edcb59c64b2a176b5f4dc9e4880cedda9cdced9257bdf58901f7ad3
4
+ data.tar.gz: a0124092a6e81ef8062d6ef14e7deb18cd517ca44d26b03efbc28e6f367be220
5
5
  SHA512:
6
- metadata.gz: 79074fc5f3c7ef245dbcb64a4739a49298cda263bc216333215599bbc7e052f0979981e67572eec6d77b33c8e620370087b32ad20f90d2c5f5ddcbfaf99182cc
7
- data.tar.gz: 116535d0ada1a04fd19bb9af708390402aeeb983a962af1a681d66e9f9fa81afc515450f1bcae187dcf8de83876a8fd5c9a091ea0d93313033821f34263f51a8
6
+ metadata.gz: a2be0d6a18f5e3db8a572d2561af13504b7cc752eca1e8fbd9d9d6a443a1d327c6110c93b5541f4c4df98469524f7715c6695bbe41c3489f5459590e194e1cf6
7
+ data.tar.gz: 24e0423ffdab5c801ebb640332f8cb9156f8069dfc4798b2130ca059d01e9f0b5e7962b422c857e66c303e00ec8054d22275afbb0acf6a2b3e792866de0a7322
data/config/cookstyle.yml CHANGED
@@ -1941,6 +1941,15 @@ Chef/Modernize/UseChefLanguageSystemdHelper:
1941
1941
  - '**/metadata.rb'
1942
1942
  - '**/Berksfile'
1943
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
+
1944
1953
  ###############################
1945
1954
  # Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
1946
1955
  ###############################
@@ -3026,3 +3035,11 @@ Lint/DeprecatedConstants:
3026
3035
  # always turn on deprecation cops from rubocop
3027
3036
  Lint/ErbNewArguments:
3028
3037
  Enabled: true
3038
+
3039
+ # reduce file read complexity
3040
+ Style/FileRead:
3041
+ Enabled: true
3042
+
3043
+ # reduce file write complexity
3044
+ Style/FileWrite:
3045
+ Enabled: true
@@ -19,6 +19,8 @@ Gemspec/DuplicatedAssignment:
19
19
  Enabled: false
20
20
  Gemspec/OrderedDependencies:
21
21
  Enabled: false
22
+ Gemspec/RequireMFA:
23
+ Enabled: false
22
24
  Gemspec/RequiredRubyVersion:
23
25
  Enabled: false
24
26
  Gemspec/RubyVersionGlobalsUsage:
@@ -459,6 +461,8 @@ Lint/UselessElseWithoutRescue:
459
461
  Enabled: false
460
462
  Lint/UselessMethodDefinition:
461
463
  Enabled: false
464
+ Lint/UselessRuby2Keywords:
465
+ Enabled: false
462
466
  Lint/UselessSetterCall:
463
467
  Enabled: false
464
468
  Lint/UselessTimes:
@@ -487,6 +491,8 @@ Naming/AccessorMethodName:
487
491
  Enabled: false
488
492
  Naming/AsciiIdentifiers:
489
493
  Enabled: false
494
+ Naming/BlockForwarding:
495
+ Enabled: false
490
496
  Naming/BlockParameterName:
491
497
  Enabled: false
492
498
  Naming/ClassAndModuleCamelCase:
@@ -637,6 +643,10 @@ Style/ExplicitBlockArgument:
637
643
  Enabled: false
638
644
  Style/ExponentialNotation:
639
645
  Enabled: false
646
+ Style/FileRead:
647
+ Enabled: false
648
+ Style/FileWrite:
649
+ Enabled: false
640
650
  Style/FloatDivision:
641
651
  Enabled: false
642
652
  Style/For:
@@ -701,6 +711,8 @@ Style/LambdaCall:
701
711
  Enabled: false
702
712
  Style/LineEndConcatenation:
703
713
  Enabled: false
714
+ Style/MapToHash:
715
+ Enabled: false
704
716
  Style/MethodCallWithoutArgsParentheses:
705
717
  Enabled: false
706
718
  Style/MethodCallWithArgsParentheses:
@@ -709,6 +721,8 @@ Style/MultilineInPatternThen:
709
721
  Enabled: false
710
722
  Style/NumberedParameters:
711
723
  Enabled: false
724
+ Style/OpenStructUse:
725
+ Enabled: false
712
726
  Style/RedundantAssignment:
713
727
  Enabled: false
714
728
  Style/RedundantFetchBlock:
data/config/upstream.yml CHANGED
@@ -78,6 +78,8 @@ AllCops:
78
78
  # When specifying style guide URLs, any paths and/or fragments will be
79
79
  # evaluated relative to the base URL.
80
80
  StyleGuideBaseURL: https://rubystyle.guide
81
+ # Documentation URLs will be constructed using the base URL.
82
+ DocumentationBaseURL: https://docs.rubocop.org/rubocop
81
83
  # Extra details are not displayed in offense messages by default. Change
82
84
  # behavior by overriding ExtraDetails, or by giving the
83
85
  # `-E/--extra-details` option.
@@ -150,6 +152,7 @@ AllCops:
150
152
  rubocop-minitest: [minitest]
151
153
  rubocop-sequel: [sequel]
152
154
  rubocop-rake: [rake]
155
+ rubocop-graphql: [graphql]
153
156
 
154
157
  #################### Bundler ###############################
155
158
 
@@ -258,11 +261,20 @@ Gemspec/OrderedDependencies:
258
261
  Include:
259
262
  - '**/*.gemspec'
260
263
 
264
+ Gemspec/RequireMFA:
265
+ Description: 'Checks that the gemspec has metadata to require MFA from RubyGems.'
266
+ Enabled: pending
267
+ VersionAdded: '1.23'
268
+ Reference:
269
+ - https://guides.rubygems.org/mfa-requirement-opt-in/
270
+ Include:
271
+ - '**/*.gemspec'
272
+
261
273
  Gemspec/RequiredRubyVersion:
262
274
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
263
275
  Enabled: true
264
276
  VersionAdded: '0.52'
265
- VersionChanged: '0.89'
277
+ VersionChanged: '1.22'
266
278
  Include:
267
279
  - '**/*.gemspec'
268
280
 
@@ -439,7 +451,11 @@ Layout/ClosingParenthesisIndentation:
439
451
  Layout/CommentIndentation:
440
452
  Description: 'Indentation of comments.'
441
453
  Enabled: true
454
+ # When true, allows comments to have extra indentation if that aligns them
455
+ # with a comment on the preceding line.
456
+ AllowForAlignment: false
442
457
  VersionAdded: '0.49'
458
+ VersionChanged: '1.24'
443
459
 
444
460
  Layout/ConditionPosition:
445
461
  Description: >-
@@ -511,13 +527,13 @@ Layout/EmptyLineBetweenDefs:
511
527
  StyleGuide: '#empty-lines-between-methods'
512
528
  Enabled: true
513
529
  VersionAdded: '0.49'
514
- VersionChanged: '1.7'
530
+ VersionChanged: '1.23'
515
531
  EmptyLineBetweenMethodDefs: true
516
532
  EmptyLineBetweenClassDefs: true
517
533
  EmptyLineBetweenModuleDefs: true
518
- # If `true`, this parameter means that single line method definitions don't
519
- # need an empty line between them.
520
- AllowAdjacentOneLineDefs: false
534
+ # `AllowAdjacentOneLineDefs` means that single line method definitions don't
535
+ # need an empty line between them. `true` by default.
536
+ AllowAdjacentOneLineDefs: true
521
537
  # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
522
538
  NumberOfEmptyLines: 1
523
539
 
@@ -1568,6 +1584,7 @@ Lint/DeprecatedConstants:
1568
1584
  Description: 'Checks for deprecated constants.'
1569
1585
  Enabled: pending
1570
1586
  VersionAdded: '1.8'
1587
+ VersionChanged: '1.22'
1571
1588
  # You can configure deprecated constants.
1572
1589
  # If there is an alternative method, you can set alternative value as `Alternative`.
1573
1590
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1588,6 +1605,9 @@ Lint/DeprecatedConstants:
1588
1605
  'FALSE':
1589
1606
  Alternative: 'false'
1590
1607
  DeprecatedVersion: '2.4'
1608
+ 'Net::HTTPServerException':
1609
+ Alternative: 'Net::HTTPClientException'
1610
+ DeprecatedVersion: '2.6'
1591
1611
  'Random::DEFAULT':
1592
1612
  Alternative: 'Random.new'
1593
1613
  DeprecatedVersion: '3.0'
@@ -1782,7 +1802,9 @@ Lint/ImplicitStringConcatenation:
1782
1802
  Lint/IncompatibleIoSelectWithFiberScheduler:
1783
1803
  Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
1784
1804
  Enabled: pending
1805
+ SafeAutoCorrect: false
1785
1806
  VersionAdded: '1.21'
1807
+ VersionChanged: '1.24'
1786
1808
 
1787
1809
  Lint/IneffectiveAccessModifier:
1788
1810
  Description: >-
@@ -2304,6 +2326,11 @@ Lint/UselessMethodDefinition:
2304
2326
  Safe: false
2305
2327
  AllowComments: true
2306
2328
 
2329
+ Lint/UselessRuby2Keywords:
2330
+ Description: 'Finds unnecessary uses of `ruby2_keywords`.'
2331
+ Enabled: pending
2332
+ VersionAdded: '1.23'
2333
+
2307
2334
  Lint/UselessSetterCall:
2308
2335
  Description: 'Checks for useless setter call to a local variable.'
2309
2336
  Enabled: true
@@ -2460,6 +2487,16 @@ Naming/BinaryOperatorParameterName:
2460
2487
  VersionAdded: '0.50'
2461
2488
  VersionChanged: '1.2'
2462
2489
 
2490
+ Naming/BlockForwarding:
2491
+ Description: 'Use anonymous block forwarding.'
2492
+ StyleGuide: '#block-forwarding'
2493
+ Enabled: pending
2494
+ VersionAdded: '1.24'
2495
+ EnforcedStyle: anonymous
2496
+ SupportedStyles:
2497
+ - anonymous
2498
+ - explicit
2499
+
2463
2500
  Naming/BlockParameterName:
2464
2501
  Description: >-
2465
2502
  Checks for block parameter names that contain capital letters,
@@ -2497,6 +2534,7 @@ Naming/FileName:
2497
2534
  StyleGuide: '#snake-case-files'
2498
2535
  Enabled: true
2499
2536
  VersionAdded: '0.50'
2537
+ VersionChanged: '1.23'
2500
2538
  # Camel case file names listed in `AllCops:Include` and all file names listed
2501
2539
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2502
2540
  Exclude: []
@@ -2509,6 +2547,13 @@ Naming/FileName:
2509
2547
  # whether each source file's class or module name matches the file name --
2510
2548
  # not whether the nested module hierarchy matches the subdirectory path.
2511
2549
  CheckDefinitionPathHierarchy: true
2550
+ # paths that are considered root directories, for example "lib" in most ruby projects
2551
+ # or "app/models" in rails projects
2552
+ CheckDefinitionPathHierarchyRoots:
2553
+ - lib
2554
+ - spec
2555
+ - test
2556
+ - src
2512
2557
  # If non-`nil`, expect all source file names to match the following regex.
2513
2558
  # Only the file name itself is matched, not the entire file path.
2514
2559
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2754,10 +2799,9 @@ Security/JSONLoad:
2754
2799
  Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2755
2800
  Enabled: true
2756
2801
  VersionAdded: '0.43'
2757
- VersionChanged: '0.44'
2802
+ VersionChanged: '1.22'
2758
2803
  # Autocorrect here will change to a method that may cause crashes depending
2759
2804
  # on the value of the argument.
2760
- AutoCorrect: false
2761
2805
  SafeAutoCorrect: false
2762
2806
 
2763
2807
  Security/MarshalLoad:
@@ -3466,6 +3510,18 @@ Style/ExponentialNotation:
3466
3510
  - engineering
3467
3511
  - integral
3468
3512
 
3513
+ Style/FileRead:
3514
+ Description: 'Favor `File.(bin)read` convenience methods.'
3515
+ StyleGuide: '#file-read'
3516
+ Enabled: pending
3517
+ VersionAdded: '1.24'
3518
+
3519
+ Style/FileWrite:
3520
+ Description: 'Favor `File.(bin)write` convenience methods.'
3521
+ StyleGuide: '#file-write'
3522
+ Enabled: pending
3523
+ VersionAdded: '1.24'
3524
+
3469
3525
  Style/FloatDivision:
3470
3526
  Description: 'For performing float division, coerce one side only.'
3471
3527
  StyleGuide: '#float-division'
@@ -3624,7 +3680,7 @@ Style/HashSyntax:
3624
3680
  StyleGuide: '#hash-literals'
3625
3681
  Enabled: true
3626
3682
  VersionAdded: '0.9'
3627
- VersionChanged: '0.43'
3683
+ VersionChanged: '1.24'
3628
3684
  EnforcedStyle: ruby19
3629
3685
  SupportedStyles:
3630
3686
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -3635,6 +3691,13 @@ Style/HashSyntax:
3635
3691
  - no_mixed_keys
3636
3692
  # enforces both ruby19 and no_mixed_keys styles
3637
3693
  - ruby19_no_mixed_keys
3694
+ # Force hashes that have a hash value omission
3695
+ EnforcedShorthandSyntax: always
3696
+ SupportedShorthandSyntax:
3697
+ # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3698
+ - always
3699
+ # forces use of explicit hash literal value.
3700
+ - never
3638
3701
  # Force hashes that have a symbol value to use hash rockets
3639
3702
  UseHashRocketsWithSymbolValues: false
3640
3703
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3811,6 +3874,12 @@ Style/LineEndConcatenation:
3811
3874
  VersionAdded: '0.18'
3812
3875
  VersionChanged: '0.64'
3813
3876
 
3877
+ Style/MapToHash:
3878
+ Description: 'Prefer `to_h` with a block over `map.to_h`.'
3879
+ Enabled: pending
3880
+ VersionAdded: '1.24'
3881
+ Safe: false
3882
+
3814
3883
  Style/MethodCallWithArgsParentheses:
3815
3884
  Description: 'Use parentheses for method calls with arguments.'
3816
3885
  StyleGuide: '#method-invocation-parens'
@@ -4179,6 +4248,8 @@ Style/NumericLiterals:
4179
4248
  VersionChanged: '0.48'
4180
4249
  MinDigits: 5
4181
4250
  Strict: false
4251
+ # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4252
+ AllowedNumbers: []
4182
4253
 
4183
4254
  Style/NumericPredicate:
4184
4255
  Description: >-
@@ -4213,6 +4284,16 @@ Style/OneLineConditional:
4213
4284
  VersionAdded: '0.9'
4214
4285
  VersionChanged: '0.90'
4215
4286
 
4287
+ Style/OpenStructUse:
4288
+ Description: >-
4289
+ Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4290
+ version compatibility, and potential security issues.
4291
+ Reference:
4292
+ - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4293
+
4294
+ Enabled: pending
4295
+ VersionAdded: '1.23'
4296
+
4216
4297
  Style/OptionHash:
4217
4298
  Description: "Don't use option hashes when you can use keyword arguments."
4218
4299
  Enabled: false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.25.6" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '1.22.0'
3
+ VERSION = "7.26.1" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '1.24.1'
5
5
  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
@@ -3,7 +3,7 @@ module RuboCop
3
3
  # we're monkey patching the config regex to allow for # cookstyle: disable whatever
4
4
  # in addition to the # rubocop: disable whatever that comes with RuboCop
5
5
  class DirectiveComment
6
- remove_const('DIRECTIVE_COMMENT_REGEXP')
6
+ remove_const(:DIRECTIVE_COMMENT_REGEXP)
7
7
  DIRECTIVE_COMMENT_REGEXP = Regexp.new(
8
8
  "# (?:rubocop|cookstyle) : ((?:disable|enable|todo))\\b #{COPS_PATTERN}"
9
9
  .gsub(' ', '\s*')
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.25.6
4
+ version: 7.26.1
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-30 00:00:00.000000000 Z
12
+ date: 2021-12-31 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.22.0
20
+ version: 1.24.1
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.22.0
27
+ version: 1.24.1
28
28
  description:
29
29
  email:
30
30
  - thom@chef.io
@@ -188,6 +188,7 @@ files:
188
188
  - lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb
189
189
  - lib/rubocop/cop/chef/modernize/cron_manage_resource.rb
190
190
  - lib/rubocop/cop/chef/modernize/databag_helpers.rb
191
+ - lib/rubocop/cop/chef/modernize/declare_action_class.rb
191
192
  - lib/rubocop/cop/chef/modernize/default_action_initializer.rb
192
193
  - lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb
193
194
  - lib/rubocop/cop/chef/modernize/definitions.rb