cookstyle 6.3.4 → 6.4.4

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: 7a9b1ee43fdd2c9baa768f2cdbd18592bea73293b26ce1ef76ddc4e3cb1827a3
4
- data.tar.gz: 87d8aff860e98ef48aa935345091bd66586b712e52e3b2ed767ba5aededffe6b
3
+ metadata.gz: 8a8c9e4e7d09afb290f4d894de9960bd1a0ffc1ed116321a5887a49206453029
4
+ data.tar.gz: 53389b9ed11b1571f8ce3e8fd108150594d5cb2c6c7e5ef0fc14b3ba2633d8ad
5
5
  SHA512:
6
- metadata.gz: d31f92b56384f5fe012ea3fb39a154b30cc2d02dda3226d4fd2f856de4511efba3e52736886345dfacace945c4c02f74e3f8468537b00d233f7f5180c1553bd0
7
- data.tar.gz: 70c9b88f541824fcd23aafb7bfd4ea9a8ad2d4500d201b65910e0055f538f7a9cdca2c7d8998b06e4cb6a06f865d2d19b93d8edf4c659527335d06b26a84430b
6
+ metadata.gz: 9a5a62cc80a0ebc6af299114f25b1d47af14dc857dc206e5281ee167f49207b8399a962addc8b942c8e14bd7055ea97830861e2419ad05da179e961d25c4ccec
7
+ data.tar.gz: cc44d7eb2418c84131f1916de9a15b83fcd5511ccbc3e19e2eb2103f53e09fd3df2d0828dda31e4b0affe43087abc009d0ec35052e1e63a6aca884ec1c51b2ea
@@ -2,8 +2,8 @@ AllCops:
2
2
  TargetRubyVersion: 2.4
3
3
  TargetChefVersion: ~
4
4
  Exclude:
5
- - '**/files/**/*'
6
- - '**/vendor/**/*'
5
+ - '/**/files/**/*'
6
+ - '/**/vendor/**/*'
7
7
  - Guardfile
8
8
  ChefAttributes:
9
9
  Patterns:
@@ -1158,7 +1158,7 @@ ChefModernize/AllowedActionsFromInitialize:
1158
1158
 
1159
1159
  ChefModernize/FoodcriticComments:
1160
1160
  Description: Remove legacy code comments that disable Foodcritic rules. These comments are no longer necessary if you've migrated from Foodcritic to Cookstyle for cookbook linting.
1161
- Enabled: false
1161
+ Enabled: true
1162
1162
  VersionAdded: '5.16.0'
1163
1163
  Exclude:
1164
1164
  - '**/Berksfile'
@@ -59,6 +59,8 @@ Layout/EmptyLinesAroundAccessModifier:
59
59
  Enabled: false
60
60
  Layout/EmptyLinesAroundArguments:
61
61
  Enabled: false
62
+ Layout/EmptyLinesAroundAttributeAccessor:
63
+ Enabled: false
62
64
  Layout/EmptyLinesAroundBeginBody:
63
65
  Enabled: false
64
66
  Layout/EmptyLinesAroundBlockBody:
@@ -697,6 +699,8 @@ Style/SingleLineBlockParams:
697
699
  Enabled: false
698
700
  Style/SingleLineMethods:
699
701
  Enabled: false
702
+ Style/SlicingWithRange:
703
+ Enabled: false
700
704
  Style/SpecialGlobalVars:
701
705
  Enabled: false
702
706
  Style/StabbyLambdaParentheses:
@@ -770,4 +774,4 @@ Security/MarshalLoad:
770
774
  Security/Open:
771
775
  Enabled: false
772
776
  Security/YAMLLoad:
773
- Enabled: false
777
+ Enabled: false
@@ -35,6 +35,7 @@ AllCops:
35
35
  - '**/*.watchr'
36
36
  - '**/.irbrc'
37
37
  - '**/.pryrc'
38
+ - '**/.simplecov'
38
39
  - '**/buildfile'
39
40
  - '**/Appraisals'
40
41
  - '**/Berksfile'
@@ -53,6 +54,7 @@ AllCops:
53
54
  - '**/Podfile'
54
55
  - '**/Puppetfile'
55
56
  - '**/Rakefile'
57
+ - '**/rakefile'
56
58
  - '**/Snapfile'
57
59
  - '**/Steepfile'
58
60
  - '**/Thorfile'
@@ -375,6 +377,7 @@ Layout/ConditionPosition:
375
377
  StyleGuide: '#same-line-condition'
376
378
  Enabled: true
377
379
  VersionAdded: '0.53'
380
+ VersionChanged: '0.83'
378
381
 
379
382
  Layout/DefEndAlignment:
380
383
  Description: 'Align ends corresponding to defs correctly.'
@@ -460,6 +463,12 @@ Layout/EmptyLinesAroundArguments:
460
463
  Enabled: true
461
464
  VersionAdded: '0.52'
462
465
 
466
+ Layout/EmptyLinesAroundAttributeAccessor:
467
+ Description: "Keep blank lines around attribute accessors."
468
+ StyleGuide: '#empty-lines-around-attribute-accessor'
469
+ Enabled: pending
470
+ VersionAdded: '0.83'
471
+
463
472
  Layout/EmptyLinesAroundBeginBody:
464
473
  Description: "Keeps track of empty lines around begin-end bodies."
465
474
  StyleGuide: '#empty-lines-around-bodies'
@@ -1295,8 +1304,8 @@ Layout/TrailingWhitespace:
1295
1304
  StyleGuide: '#no-trailing-whitespace'
1296
1305
  Enabled: true
1297
1306
  VersionAdded: '0.49'
1298
- VersionChanged: '0.55'
1299
- AllowInHeredoc: false
1307
+ VersionChanged: '0.83'
1308
+ AllowInHeredoc: true
1300
1309
 
1301
1310
  #################### Lint ##################################
1302
1311
  ### Warnings
@@ -1316,6 +1325,7 @@ Lint/AmbiguousOperator:
1316
1325
  StyleGuide: '#method-invocation-parens'
1317
1326
  Enabled: true
1318
1327
  VersionAdded: '0.17'
1328
+ VersionChanged: '0.83'
1319
1329
 
1320
1330
  Lint/AmbiguousRegexpLiteral:
1321
1331
  Description: >-
@@ -1323,6 +1333,7 @@ Lint/AmbiguousRegexpLiteral:
1323
1333
  a method invocation without parentheses.
1324
1334
  Enabled: true
1325
1335
  VersionAdded: '0.17'
1336
+ VersionChanged: '0.83'
1326
1337
 
1327
1338
  Lint/AssignmentInCondition:
1328
1339
  Description: "Don't use assignment in conditions."
@@ -1339,8 +1350,9 @@ Lint/BigDecimalNew:
1339
1350
  Lint/BooleanSymbol:
1340
1351
  Description: 'Check for `:true` and `:false` symbols.'
1341
1352
  Enabled: true
1353
+ Safe: false
1342
1354
  VersionAdded: '0.50'
1343
- VersionChanged: '0.81'
1355
+ VersionChanged: '0.83'
1344
1356
 
1345
1357
  Lint/CircularArgumentReference:
1346
1358
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
@@ -1411,13 +1423,16 @@ Lint/EmptyInterpolation:
1411
1423
  Lint/EmptyWhen:
1412
1424
  Description: 'Checks for `when` branches with empty bodies.'
1413
1425
  Enabled: true
1426
+ AllowComments: true
1414
1427
  VersionAdded: '0.45'
1428
+ VersionChanged: '0.83'
1415
1429
 
1416
1430
  Lint/EnsureReturn:
1417
1431
  Description: 'Do not use return in an ensure block.'
1418
1432
  StyleGuide: '#no-return-ensure'
1419
1433
  Enabled: true
1420
1434
  VersionAdded: '0.9'
1435
+ VersionChanged: '0.83'
1421
1436
 
1422
1437
  Lint/ErbNewArguments:
1423
1438
  Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
@@ -1565,6 +1580,7 @@ Lint/ParenthesesAsGroupedExpression:
1565
1580
  StyleGuide: '#parens-no-spaces'
1566
1581
  Enabled: true
1567
1582
  VersionAdded: '0.12'
1583
+ VersionChanged: '0.83'
1568
1584
 
1569
1585
  Lint/PercentStringArray:
1570
1586
  Description: >-
@@ -1808,7 +1824,7 @@ Lint/UselessAccessModifier:
1808
1824
  Description: 'Checks for useless access modifiers.'
1809
1825
  Enabled: true
1810
1826
  VersionAdded: '0.20'
1811
- VersionChanged: '0.47'
1827
+ VersionChanged: '0.83'
1812
1828
  ContextCreatingMethods: []
1813
1829
  MethodCreatingMethods: []
1814
1830
 
@@ -2948,6 +2964,7 @@ Style/IfWithSemicolon:
2948
2964
  StyleGuide: '#no-semicolon-ifs'
2949
2965
  Enabled: true
2950
2966
  VersionAdded: '0.9'
2967
+ VersionChanged: '0.83'
2951
2968
 
2952
2969
  Style/ImplicitRuntimeError:
2953
2970
  Description: >-
@@ -3425,7 +3442,9 @@ Style/OptionalArguments:
3425
3442
  of the argument list.
3426
3443
  StyleGuide: '#optional-arguments'
3427
3444
  Enabled: true
3445
+ Safe: false
3428
3446
  VersionAdded: '0.33'
3447
+ VersionChanged: '0.83'
3429
3448
 
3430
3449
  Style/OrAssignment:
3431
3450
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3730,6 +3749,12 @@ Style/SingleLineMethods:
3730
3749
  VersionChanged: '0.19'
3731
3750
  AllowIfMethodIsEmpty: true
3732
3751
 
3752
+ Style/SlicingWithRange:
3753
+ Description: 'Checks array slicing is done with endless ranges when suitable.'
3754
+ Enabled: pending
3755
+ VersionAdded: '0.83'
3756
+ Safe: false
3757
+
3733
3758
  Style/SpecialGlobalVars:
3734
3759
  Description: 'Avoid Perl-style global variables.'
3735
3760
  StyleGuide: '#no-cryptic-perlisms'
@@ -1,4 +1,4 @@
1
1
  module Cookstyle
2
- VERSION = "6.3.4".freeze # rubocop: disable Style/StringLiterals
3
- RUBOCOP_VERSION = '0.82.0'.freeze
2
+ VERSION = "6.4.4".freeze # rubocop: disable Style/StringLiterals
3
+ RUBOCOP_VERSION = '0.83.0'.freeze
4
4
  end
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Chef
19
19
  module ChefCorrectness
20
20
  # Normal attributes are discouraged since their semantics differ importantly from the
21
- # default and override levels. Their values persist in the node object even after
21
+ # default and override levels. Their values persist in the node object even after
22
22
  # all code referencing them has been deleted, unlike default and override.
23
23
  #
24
24
  # Code should be updated to use default or override levels, but this will change
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Chef
19
19
  module ChefCorrectness
20
20
  # Normal attributes are discouraged since their semantics differ importantly from the
21
- # default and override levels. Their values persist in the node object even after
21
+ # default and override levels. Their values persist in the node object even after
22
22
  # all code referencing them has been deleted, unlike default and override.
23
23
  #
24
24
  # Code should be updated to use default or override levels, but this will change
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Cop
19
19
  module Chef
20
20
  module ChefDeprecations
21
- # Don't depend on the deprecated compat_resource cookbook made obsolete by Chef 12.19+
21
+ # Don't depend on the deprecated compat_resource cookbook made obsolete by Chef Infra Client 12.19+
22
22
  #
23
23
  # @example
24
24
  #
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Cop
19
19
  module Chef
20
20
  module ChefDeprecations
21
- # Don't depend on the partial_search cookbook made obsolete by Chef 13
21
+ # Don't depend on the partial_search cookbook made obsolete by Chef Infra Client 13
22
22
  #
23
23
  # @example
24
24
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module ChefDeprecations
22
- # Don't use the deprecated easy_install resource removed in Chef 13
22
+ # Don't use the deprecated easy_install resource removed in Chef Infra Client 13
23
23
  #
24
24
  # @example
25
25
  #
@@ -29,7 +29,7 @@ module RuboCop
29
29
  # end
30
30
  #
31
31
  class EasyInstallResource < Cop
32
- MSG = "Don't use the deprecated easy_install resource removed in Chef 13".freeze
32
+ MSG = "Don't use the deprecated easy_install resource removed in Chef Infra Client 13".freeze
33
33
 
34
34
  def on_send(node)
35
35
  add_offense(node, location: :expression, message: MSG, severity: :warning) if node.method_name == :easy_install
@@ -29,7 +29,7 @@ module RuboCop
29
29
  # end
30
30
  #
31
31
  class ErlCallResource < Cop
32
- MSG = "Don't use the deprecated erl_call resource removed in Chef 13".freeze
32
+ MSG = "Don't use the deprecated erl_call resource removed in Chef Infra Client 13".freeze
33
33
 
34
34
  def on_send(node)
35
35
  add_offense(node, location: :expression, message: MSG, severity: :warning) if node.method_name == :erl_call
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Cop
19
19
  module Chef
20
20
  module ChefDeprecations
21
- # The local resource's lc_all property has been deprecated and will be removed in Chef Infra Client 16
21
+ # The local resource's lc_all property has been deprecated and will be removed in Chef Infra Client 17
22
22
  #
23
23
  # @example
24
24
  #
@@ -31,7 +31,7 @@ module RuboCop
31
31
  class LocaleDeprecatedLcAllProperty < Cop
32
32
  include RuboCop::Chef::CookbookHelpers
33
33
 
34
- MSG = "The local resource's lc_all property has been deprecated and will be removed in Chef Infra Client 16".freeze
34
+ MSG = "The local resource's lc_all property has been deprecated and will be removed in Chef Infra Client 17".freeze
35
35
 
36
36
  def on_block(node)
37
37
  match_property_in_resource?(:locale, 'lc_all', node) do |property|
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Cop
19
19
  module Chef
20
20
  module ChefDeprecations
21
- # Incorrectly using node methods for Ohai data when you really want node attributes
21
+ # Use node attributes to access data provided by Ohai instead of using node methods to access that data.
22
22
  #
23
23
  # @example
24
24
  #
@@ -17,10 +17,9 @@ module RuboCop
17
17
  module Cop
18
18
  module Chef
19
19
  module ChefDeprecations
20
- # The node.set method has been removed in Chef-13 and must be replaced by node.normal.
20
+ # The `node.set` method has been removed in Chef Infra Client 13 and usage must be replaced with `node.normal`.
21
21
  #
22
- # Note that node.normal keeps the semantics identical, but the use of node.normal is
23
- # also discouraged.
22
+ # This cop will autocorrect code to use node.normal, which is functionally identical to node.set, but we also discourage the use of that method as normal level attributes persist on the node even if the code setting the attribute is later removed.
24
23
  #
25
24
  # @example
26
25
  #
@@ -17,10 +17,9 @@ module RuboCop
17
17
  module Cop
18
18
  module Chef
19
19
  module ChefDeprecations
20
- # The node.set_unless method has been removed in Chef-13 and must be replaced by node.normal_unless.
20
+ # The node.set_unless method has been removed in Chef Infra Client 13 and usage must be replaced with node.normal_unless.
21
21
  #
22
- # Note that node.normal_unless keeps the semantics identical, but the use of node.normal is
23
- # also discouraged.
22
+ # This cop will autocorrect code to use node.normal_unless, which is functionally identical to node.set_unless, but we also discourage the use of that method as normal level attributes persist on the node even if the code setting the attribute is later removed.
24
23
  #
25
24
  # @example
26
25
  #
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Cop
19
19
  module Chef
20
20
  module ChefDeprecations
21
- # Use node['powershell']['version'] or the new powershell_version helper available in Chef Infra Client 16+ instead of the deprecated PowerShell cookbook helpers
21
+ # Use `node['powershell']['version']` or the new `powershell_version` helper available in Chef Infra Client 15.8+ instead of the deprecated PowerShell cookbook helpers
22
22
  #
23
23
  # @example
24
24
  #
@@ -28,11 +28,11 @@ module RuboCop
28
28
  # # good
29
29
  # node['powershell']['version'].to_f == 4.0
30
30
  #
31
- # # good (Chef Infra Client 16+)
31
+ # # better (Chef Infra Client 15.8+)
32
32
  # powershell_version == 4.0
33
33
  #
34
34
  class PowershellCookbookHelpers < Cop
35
- MSG = "Use node['powershell']['version'] or the new powershell_version helper available in Chef Infra Client 16+ instead of the deprecated PowerShell cookbook helpers.".freeze
35
+ MSG = "Use node['powershell']['version'] or the new powershell_version helper available in Chef Infra Client 15.8+ instead of the deprecated PowerShell cookbook helpers.".freeze
36
36
 
37
37
  def_node_matcher :ps_cb_helper?, <<-PATTERN
38
38
  (send
@@ -54,8 +54,13 @@ module RuboCop
54
54
  def autocorrect(node)
55
55
  lambda do |corrector|
56
56
  new_text = []
57
+
57
58
  node.arguments.first.each_pair do |k, v|
58
- new_text << "#{k.value} #{v.source}"
59
+ # account for a strange edge case where the person incorrectly makes "manage_home a method
60
+ # the code would be broken, but without this handling cookstyle would explode
61
+ key_value = (k.send_type? && k.method_name == :manage_home) ? 'manage_home' : k.value
62
+
63
+ new_text << "#{key_value} #{v.source}"
59
64
  end
60
65
 
61
66
  corrector.replace(node.loc.expression, new_text.join("\n "))
@@ -18,7 +18,7 @@ module RuboCop
18
18
  module Cop
19
19
  module Chef
20
20
  module ChefStyle
21
- # Don't loop over an array to set cookbook dependencies or supported platforms if you have fewer than three values to set. Setting multiple `supports` or `depends` values is simpler and easier to understand for new users.
21
+ # Don't loop over an array to set cookbook dependencies or supported platforms if you have fewer than three values to set. Setting multiple `supports` or `depends` values is simpler and easier to understand for new users.
22
22
  #
23
23
  # @example
24
24
  #
@@ -6,6 +6,10 @@ module RuboCop
6
6
  module Cop
7
7
  # Common functionality for checking target chef version.
8
8
  module TargetChefVersion
9
+ def required_minimum_chef_version
10
+ @minimum_target_chef_version
11
+ end
12
+
9
13
  def minimum_target_chef_version(version)
10
14
  @minimum_target_chef_version = version
11
15
  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: 6.3.4
4
+ version: 6.4.4
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: 2020-04-16 00:00:00.000000000 Z
12
+ date: 2020-05-12 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: 0.82.0
20
+ version: 0.83.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: 0.82.0
27
+ version: 0.83.0
28
28
  description:
29
29
  email:
30
30
  - thom@chef.io