cookstyle 7.25.8 → 7.27.0
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 +16 -0
- data/config/disable_all.yml +14 -0
- data/config/upstream.yml +87 -5
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/invalid_cookbook_name.rb +47 -0
- data/lib/rubocop/monkey_patches/directive_comment.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 897bcf0f8e234120fb9cfcb1077210e70fbe23e1fb82bde3d7eac7a549eee3ec
|
4
|
+
data.tar.gz: 15a3664f0d54c8b1c4404d4c21d000d328090fc73280ee888819b8d6f1a8625b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d8ea69d16659e4fdb8c13a33cffd486321f44b9040d308702f3018c4ab4372becd941701bbf21127d6bd5db3b35b235a9295d12a2c7276a33b17e41a2066366
|
7
|
+
data.tar.gz: afcf222bfddc0bdc6816b0221beb4a975f9d215e36a809a32af45ea1ccd1dbda2c31eb5ebbd5f2fbd9e253b4dce84ed8ad6c5a43cf105f77626f8b48a07af228
|
data/config/cookstyle.yml
CHANGED
@@ -506,6 +506,14 @@ Chef/Correctness/MetadataMissingVersion:
|
|
506
506
|
Include:
|
507
507
|
- '**/metadata.rb'
|
508
508
|
|
509
|
+
Chef/Correctness/InvalidCookbookName:
|
510
|
+
Description: Cookbook names should not contain invalid characters such as periods.
|
511
|
+
StyleGuide: 'chef_correctness_invalidcookbookname'
|
512
|
+
Enabled: true
|
513
|
+
VersionAdded: '7.27'
|
514
|
+
Include:
|
515
|
+
- '**/metadata.rb'
|
516
|
+
|
509
517
|
###############################
|
510
518
|
# Chef/Sharing: Issues that prevent sharing code with other teams or with the Chef community in general
|
511
519
|
###############################
|
@@ -3035,3 +3043,11 @@ Lint/DeprecatedConstants:
|
|
3035
3043
|
# always turn on deprecation cops from rubocop
|
3036
3044
|
Lint/ErbNewArguments:
|
3037
3045
|
Enabled: true
|
3046
|
+
|
3047
|
+
# reduce file read complexity
|
3048
|
+
Style/FileRead:
|
3049
|
+
Enabled: true
|
3050
|
+
|
3051
|
+
# reduce file write complexity
|
3052
|
+
Style/FileWrite:
|
3053
|
+
Enabled: true
|
data/config/disable_all.yml
CHANGED
@@ -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,6 +261,15 @@ 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
|
@@ -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.
|
530
|
+
VersionChanged: '1.23'
|
515
531
|
EmptyLineBetweenMethodDefs: true
|
516
532
|
EmptyLineBetweenClassDefs: true
|
517
533
|
EmptyLineBetweenModuleDefs: true
|
518
|
-
#
|
519
|
-
# need an empty line between them.
|
520
|
-
AllowAdjacentOneLineDefs:
|
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
|
@@ -3465,6 +3510,18 @@ Style/ExponentialNotation:
|
|
3465
3510
|
- engineering
|
3466
3511
|
- integral
|
3467
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
|
+
|
3468
3525
|
Style/FloatDivision:
|
3469
3526
|
Description: 'For performing float division, coerce one side only.'
|
3470
3527
|
StyleGuide: '#float-division'
|
@@ -3623,7 +3680,7 @@ Style/HashSyntax:
|
|
3623
3680
|
StyleGuide: '#hash-literals'
|
3624
3681
|
Enabled: true
|
3625
3682
|
VersionAdded: '0.9'
|
3626
|
-
VersionChanged: '
|
3683
|
+
VersionChanged: '1.24'
|
3627
3684
|
EnforcedStyle: ruby19
|
3628
3685
|
SupportedStyles:
|
3629
3686
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -3634,6 +3691,13 @@ Style/HashSyntax:
|
|
3634
3691
|
- no_mixed_keys
|
3635
3692
|
# enforces both ruby19 and no_mixed_keys styles
|
3636
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
|
3637
3701
|
# Force hashes that have a symbol value to use hash rockets
|
3638
3702
|
UseHashRocketsWithSymbolValues: false
|
3639
3703
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
@@ -3810,6 +3874,12 @@ Style/LineEndConcatenation:
|
|
3810
3874
|
VersionAdded: '0.18'
|
3811
3875
|
VersionChanged: '0.64'
|
3812
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
|
+
|
3813
3883
|
Style/MethodCallWithArgsParentheses:
|
3814
3884
|
Description: 'Use parentheses for method calls with arguments.'
|
3815
3885
|
StyleGuide: '#method-invocation-parens'
|
@@ -4178,6 +4248,8 @@ Style/NumericLiterals:
|
|
4178
4248
|
VersionChanged: '0.48'
|
4179
4249
|
MinDigits: 5
|
4180
4250
|
Strict: false
|
4251
|
+
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
4252
|
+
AllowedNumbers: []
|
4181
4253
|
|
4182
4254
|
Style/NumericPredicate:
|
4183
4255
|
Description: >-
|
@@ -4212,6 +4284,16 @@ Style/OneLineConditional:
|
|
4212
4284
|
VersionAdded: '0.9'
|
4213
4285
|
VersionChanged: '0.90'
|
4214
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
|
+
|
4215
4297
|
Style/OptionHash:
|
4216
4298
|
Description: "Don't use option hashes when you can use keyword arguments."
|
4217
4299
|
Enabled: false
|
data/lib/cookstyle/version.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: 2022, 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
|
+
# Cookbook names should not contain invalid characters such as periods.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### incorrect
|
27
|
+
# name 'foo.bar'
|
28
|
+
#
|
29
|
+
# #### correct
|
30
|
+
# name 'foo_bar'
|
31
|
+
#
|
32
|
+
class InvalidCookbookName < Base
|
33
|
+
RESTRICT_ON_SEND = [:name].freeze
|
34
|
+
MSG = 'Cookbook names should not contain invalid characters such as periods.'
|
35
|
+
|
36
|
+
def_node_matcher :has_name?, '(send nil? :name $str)'
|
37
|
+
|
38
|
+
def on_send(node)
|
39
|
+
has_name?(node) do |val|
|
40
|
+
add_offense(node, message: MSG, severity: :refactor) if val.value.include?('.')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
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(
|
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.
|
4
|
+
version: 7.27.0
|
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:
|
12
|
+
date: 2022-01-13 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.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.
|
27
|
+
version: 1.24.1
|
28
28
|
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb
|
56
56
|
- lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
|
57
57
|
- lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb
|
58
|
+
- lib/rubocop/cop/chef/correctness/invalid_cookbook_name.rb
|
58
59
|
- lib/rubocop/cop/chef/correctness/invalid_default_action.rb
|
59
60
|
- lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb
|
60
61
|
- lib/rubocop/cop/chef/correctness/invalid_platform_family_helper.rb
|