chefstyle 1.5.9 → 1.6.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: b6f67ca0a627efc674ce84e4a44d3cd9672df9a5aa437920419e52d78f54a522
4
- data.tar.gz: b19a72c80e5901bbabec3c471a09eeca2ac52682c8f83a993aaabc2fe563b98b
3
+ metadata.gz: 8f6a4af8c1483231d1585eca05b6374c95b60b6c8446b9151569ba9572661ff8
4
+ data.tar.gz: d2969b37943ff4d69349ec82d75c602d86158e82775052c144a74bff648dc7f1
5
5
  SHA512:
6
- metadata.gz: cdfed9329f20f86c442d23aacb699b1e0490100b2ba442246e60ab42c5037e444f2fa54454c49d9907af999b6597ed3a2249d00f58adb5c56636cb12dadbf60b
7
- data.tar.gz: c688dae316d6366248cc2c7e22eca0fb9cc40935c52f4daaf0e90e5ef74137b1bc50f7ef551768b7d5a341bcae23937543387494360e7c3c4aafe0f22b2bcd45
6
+ metadata.gz: aeb0997f80921e092c541c33bf9182f6368c96d98b396ab8afe9ed5fe28feb897dab7cf1dd24006bd145dbe27d6013f25f3625b76cf777098839b7828ff76d9a
7
+ data.tar.gz: d38b958b953908730fc0977562e9783ae3c5456bdb44a40ce18d39a68fd39dd5b9f24657849cec287a13fefd364c962afef9b9564df2c71ebd97d7dc919ebe1e
@@ -687,6 +687,10 @@ Lint/RedundantWithIndex:
687
687
  Lint/DuplicateRequire:
688
688
  Enabled: true
689
689
 
690
+ # detect assignment typos
691
+ Lint/AmbiguousAssignment:
692
+ Enabled: true
693
+
690
694
  Chef/Ruby/Ruby27KeywordArgumentWarnings:
691
695
  Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
692
696
  Enabled: true
@@ -709,4 +713,9 @@ Chef/Ruby/GemspecRequireRubygems:
709
713
  Chef/Ruby/RequireNetHttps:
710
714
  Description: net/https is deprecated and just includes net/http and openssl. We should include those directly instead
711
715
  Enabled: true
712
- VersionAdded: '1.3.0'
716
+ VersionAdded: '1.3.0'
717
+
718
+ Chef/Ruby/LegacyPowershellOutMethods:
719
+ Description: Use powershell_exec!/powershell_exec instead of the slower legacy powershell_out!/powershell_out methods.
720
+ Enabled: true
721
+ VersionAdded: '1.6.0'
@@ -229,6 +229,8 @@ Lint/Debugger:
229
229
  Enabled: false
230
230
  Lint/DeprecatedClassMethods:
231
231
  Enabled: false
232
+ Lint/DeprecatedConstants:
233
+ Enabled: false
232
234
  Lint/DeprecatedOpenSSLConstant:
233
235
  Enabled: false
234
236
  Lint/DisjunctiveAssignmentInConstructor:
@@ -295,6 +297,8 @@ Lint/IneffectiveAccessModifier:
295
297
  Enabled: false
296
298
  Lint/InterpolationCheck:
297
299
  Enabled: false
300
+ Lint/LambdaWithoutLiteralBlock:
301
+ Enabled: false
298
302
  Lint/LiteralAsCondition:
299
303
  Enabled: false
300
304
  Lint/LiteralInInterpolation:
@@ -323,6 +327,10 @@ Lint/NonLocalExitFromIterator:
323
327
  Enabled: false
324
328
  Lint/NumberConversion:
325
329
  Enabled: false
330
+ Lint/NumberedParameterAssignment:
331
+ Enabled: false
332
+ Lint/OrAssignmentToConstant:
333
+ Enabled: false
326
334
  Lint/OrderedMagicComments:
327
335
  Enabled: false
328
336
  Lint/OutOfRangeRegexpRef:
@@ -341,6 +349,8 @@ Lint/RedundantCopDisableDirective:
341
349
  Enabled: false
342
350
  Lint/RedundantCopEnableDirective:
343
351
  Enabled: false
352
+ Lint/RedundantDirGlobSort:
353
+ Enabled: false
344
354
  Lint/RedundantRequireStatement:
345
355
  Enabled: false
346
356
  Lint/RedundantSafeNavigation:
@@ -385,6 +395,8 @@ Lint/StructNewOverride:
385
395
  Enabled: false
386
396
  Lint/SuppressedException:
387
397
  Enabled: false
398
+ Lint/SymbolConversion:
399
+ Enabled: false
388
400
  Lint/Syntax:
389
401
  Enabled: false
390
402
  Lint/ToEnumArguments:
@@ -395,6 +407,8 @@ Lint/TopLevelReturnWithArgument:
395
407
  Enabled: false
396
408
  Lint/TrailingCommaInAttributeDeclaration:
397
409
  Enabled: false
410
+ Lint/TripleQuotes:
411
+ Enabled: false
398
412
  Lint/UnderscorePrefixedVariableName:
399
413
  Enabled: false
400
414
  Lint/UnexpectedBlockArity:
@@ -583,6 +597,8 @@ Style/EmptyLiteral:
583
597
  Enabled: false
584
598
  Style/EmptyMethod:
585
599
  Enabled: false
600
+ Style/EndlessMethod:
601
+ Enabled: false
586
602
  Style/Encoding:
587
603
  Enabled: false
588
604
  Style/EndBlock:
@@ -635,6 +651,8 @@ Style/IfUnlessModifier:
635
651
  Enabled: false
636
652
  Style/IfUnlessModifierOfIfUnless:
637
653
  Enabled: false
654
+ Style/IfWithBooleanLiteralBranches:
655
+ Enabled: false
638
656
  Style/IfWithSemicolon:
639
657
  Enabled: false
640
658
  Style/ImplicitRuntimeError:
@@ -132,12 +132,13 @@ AllCops:
132
132
  # If a value is specified for TargetRubyVersion then it is used. Acceptable
133
133
  # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
134
134
  # should not be included. If the project specifies a Ruby version in the
135
- # .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
136
- # the desired version of Ruby by inspecting the .ruby-version file first,
137
- # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
138
- # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
139
- # from the lock file.) If the Ruby version is still unresolved, RuboCop will
140
- # use the oldest officially supported Ruby version (currently Ruby 2.4).
135
+ # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
136
+ # try to determine the desired version of Ruby by inspecting the
137
+ # .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
138
+ # or gems.locked file. (Although the Ruby version is specified in the Gemfile
139
+ # or gems.rb file, RuboCop reads the final value from the lock file.) If the
140
+ # Ruby version is still unresolved, RuboCop will use the oldest officially
141
+ # supported Ruby version (currently Ruby 2.4).
141
142
  TargetRubyVersion: ~
142
143
  # Determines if a notification for extension libraries should be shown when
143
144
  # rubocop is run. Keys are the name of the extension, and values are an array
@@ -1197,7 +1198,6 @@ Layout/SpaceBeforeBrackets:
1197
1198
  StyleGuide: '#space-in-brackets-access'
1198
1199
  Enabled: pending
1199
1200
  VersionAdded: '1.7'
1200
- Safe: false
1201
1201
 
1202
1202
  Layout/SpaceBeforeComma:
1203
1203
  Description: 'No spaces before commas.'
@@ -1469,6 +1469,34 @@ Lint/DeprecatedClassMethods:
1469
1469
  Enabled: true
1470
1470
  VersionAdded: '0.19'
1471
1471
 
1472
+ Lint/DeprecatedConstants:
1473
+ Description: 'Checks for deprecated constants.'
1474
+ Enabled: pending
1475
+ VersionAdded: '1.8'
1476
+ # You can configure deprecated constants.
1477
+ # If there is an alternative method, you can set alternative value as `Alternative`.
1478
+ # And you can set the deprecated version as `DeprecatedVersion`.
1479
+ # These options can be omitted if they are not needed.
1480
+ #
1481
+ # DeprecatedConstants:
1482
+ # 'DEPRECATED_CONSTANT':
1483
+ # Alternative: 'alternative_value'
1484
+ # DeprecatedVersion: 'deprecated_version'
1485
+ #
1486
+ DeprecatedConstants:
1487
+ 'NIL':
1488
+ Alternative: 'nil'
1489
+ DeprecatedVersion: '2.4'
1490
+ 'TRUE':
1491
+ Alternative: 'true'
1492
+ DeprecatedVersion: '2.4'
1493
+ 'FALSE':
1494
+ Alternative: 'false'
1495
+ DeprecatedVersion: '2.4'
1496
+ 'Random::DEFAULT':
1497
+ Alternative: 'Random.new'
1498
+ DeprecatedVersion: '3.0'
1499
+
1472
1500
  Lint/DeprecatedOpenSSLConstant:
1473
1501
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1474
1502
  Enabled: true
@@ -1674,6 +1702,11 @@ Lint/InterpolationCheck:
1674
1702
  VersionAdded: '0.50'
1675
1703
  VersionChanged: '0.87'
1676
1704
 
1705
+ Lint/LambdaWithoutLiteralBlock:
1706
+ Description: 'Checks uses of lambda without a literal block.'
1707
+ Enabled: pending
1708
+ VersionAdded: '1.8'
1709
+
1677
1710
  Lint/LiteralAsCondition:
1678
1711
  Description: 'Checks of literals used in conditions.'
1679
1712
  Enabled: true
@@ -1773,6 +1806,17 @@ Lint/NumberConversion:
1773
1806
  - Time
1774
1807
  - DateTime
1775
1808
 
1809
+ Lint/NumberedParameterAssignment:
1810
+ Description: 'Checks for uses of numbered parameter assignment.'
1811
+ Enabled: pending
1812
+ VersionAdded: '1.9'
1813
+
1814
+ Lint/OrAssignmentToConstant:
1815
+ Description: 'Checks unintended or-assignment to constant.'
1816
+ Enabled: pending
1817
+ Safe: false
1818
+ VersionAdded: '1.9'
1819
+
1776
1820
  Lint/OrderedMagicComments:
1777
1821
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1778
1822
  Enabled: true
@@ -1836,6 +1880,11 @@ Lint/RedundantCopEnableDirective:
1836
1880
  Enabled: true
1837
1881
  VersionAdded: '0.76'
1838
1882
 
1883
+ Lint/RedundantDirGlobSort:
1884
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1885
+ Enabled: pending
1886
+ VersionAdded: '1.8'
1887
+
1839
1888
  Lint/RedundantRequireStatement:
1840
1889
  Description: 'Checks for unnecessary `require` statement.'
1841
1890
  Enabled: true
@@ -1994,12 +2043,16 @@ Lint/SuppressedException:
1994
2043
  VersionAdded: '0.9'
1995
2044
  VersionChanged: '0.81'
1996
2045
 
2046
+ Lint/SymbolConversion:
2047
+ Description: 'Checks for unnecessary symbol conversions.'
2048
+ Enabled: pending
2049
+ VersionAdded: '1.9'
2050
+
1997
2051
  Lint/Syntax:
1998
- Description: 'Checks syntax error.'
2052
+ Description: 'Checks for syntax errors.'
1999
2053
  Enabled: true
2000
2054
  VersionAdded: '0.9'
2001
2055
 
2002
-
2003
2056
  Lint/ToEnumArguments:
2004
2057
  Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2005
2058
  Enabled: pending
@@ -2020,6 +2073,11 @@ Lint/TrailingCommaInAttributeDeclaration:
2020
2073
  Enabled: true
2021
2074
  VersionAdded: '0.90'
2022
2075
 
2076
+ Lint/TripleQuotes:
2077
+ Description: 'Checks for useless triple quote constructs.'
2078
+ Enabled: pending
2079
+ VersionAdded: '1.9'
2080
+
2023
2081
  Lint/UnderscorePrefixedVariableName:
2024
2082
  Description: 'Do not use prefix `_` for a variable that is used.'
2025
2083
  Enabled: true
@@ -2502,10 +2560,12 @@ Naming/VariableName:
2502
2560
  StyleGuide: '#snake-case-symbols-methods-vars'
2503
2561
  Enabled: true
2504
2562
  VersionAdded: '0.50'
2563
+ VersionChanged: '1.8'
2505
2564
  EnforcedStyle: snake_case
2506
2565
  SupportedStyles:
2507
2566
  - snake_case
2508
2567
  - camelCase
2568
+ AllowedIdentifiers: []
2509
2569
 
2510
2570
  Naming/VariableNumber:
2511
2571
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2649,7 +2709,8 @@ Style/AsciiComments:
2649
2709
  Enabled: true
2650
2710
  VersionAdded: '0.9'
2651
2711
  VersionChanged: '0.52'
2652
- AllowedChars: []
2712
+ AllowedChars:
2713
+ - ©
2653
2714
 
2654
2715
  Style/Attr:
2655
2716
  Description: 'Checks for uses of Module#attr.'
@@ -3080,6 +3141,8 @@ Style/DisableCopsWithinSourceCodeDirective:
3080
3141
  Forbids disabling/enabling cops within source code.
3081
3142
  Enabled: false
3082
3143
  VersionAdded: '0.82'
3144
+ VersionChanged: '1.9'
3145
+ AllowedCops: []
3083
3146
 
3084
3147
  Style/DocumentDynamicEvalDefinition:
3085
3148
  Description: >-
@@ -3197,6 +3260,17 @@ Style/EndBlock:
3197
3260
  VersionAdded: '0.9'
3198
3261
  VersionChanged: '0.81'
3199
3262
 
3263
+ Style/EndlessMethod:
3264
+ Description: 'Avoid the use of multi-lined endless method definitions.'
3265
+ StyleGuide: '#endless-methods'
3266
+ Enabled: pending
3267
+ VersionAdded: '1.8'
3268
+ EnforcedStyle: allow_single_line
3269
+ SupportedStyles:
3270
+ - allow_single_line
3271
+ - allow_always
3272
+ - disallow
3273
+
3200
3274
  Style/EvalWithLocation:
3201
3275
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3202
3276
  Enabled: true
@@ -3220,9 +3294,8 @@ Style/ExplicitBlockArgument:
3220
3294
  that just passes its arguments to another block.
3221
3295
  StyleGuide: '#block-argument'
3222
3296
  Enabled: true
3223
- # May change the yielding arity.
3224
- Safe: false
3225
3297
  VersionAdded: '0.89'
3298
+ VersionChanged: '1.8'
3226
3299
 
3227
3300
  Style/ExponentialNotation:
3228
3301
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
@@ -3241,7 +3314,8 @@ Style/FloatDivision:
3241
3314
  Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3242
3315
  Enabled: true
3243
3316
  VersionAdded: '0.72'
3244
- VersionChanged: '1.6'
3317
+ VersionChanged: '1.9'
3318
+ Safe: false
3245
3319
  EnforcedStyle: single_coerce
3246
3320
  SupportedStyles:
3247
3321
  - left_coerce
@@ -3289,6 +3363,7 @@ Style/FormatStringToken:
3289
3363
  MaxUnannotatedPlaceholdersAllowed: 1
3290
3364
  VersionAdded: '0.49'
3291
3365
  VersionChanged: '1.0'
3366
+ IgnoredMethods: []
3292
3367
 
3293
3368
  Style/FrozenStringLiteralComment:
3294
3369
  Description: >-
@@ -3442,6 +3517,11 @@ Style/IfUnlessModifierOfIfUnless:
3442
3517
  VersionAdded: '0.39'
3443
3518
  VersionChanged: '0.87'
3444
3519
 
3520
+ Style/IfWithBooleanLiteralBranches:
3521
+ Description: 'Checks for redundant `if` with boolean literal branches.'
3522
+ Enabled: pending
3523
+ VersionAdded: '1.9'
3524
+
3445
3525
  Style/IfWithSemicolon:
3446
3526
  Description: 'Do not use if x; .... Use the ternary operator instead.'
3447
3527
  StyleGuide: '#no-semicolon-ifs'
@@ -3726,7 +3806,8 @@ Style/MutableConstant:
3726
3806
  Description: 'Do not assign mutable objects to constants.'
3727
3807
  Enabled: true
3728
3808
  VersionAdded: '0.34'
3729
- VersionChanged: '0.65'
3809
+ VersionChanged: '1.8'
3810
+ SafeAutoCorrect: false
3730
3811
  EnforcedStyle: literals
3731
3812
  SupportedStyles:
3732
3813
  # literals: freeze literals assigned to constants
@@ -4330,7 +4411,7 @@ Style/SingleLineMethods:
4330
4411
  StyleGuide: '#no-single-line-methods'
4331
4412
  Enabled: true
4332
4413
  VersionAdded: '0.9'
4333
- VersionChanged: '1.7'
4414
+ VersionChanged: '1.8'
4334
4415
  AllowIfMethodIsEmpty: true
4335
4416
 
4336
4417
  Style/SlicingWithRange:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Chefstyle
3
- VERSION = "1.5.9"
4
- RUBOCOP_VERSION = "1.7.0"
5
- end
3
+ VERSION = "1.6.1"
4
+ RUBOCOP_VERSION = "1.9.0"
5
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: 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
+
19
+ module RuboCop
20
+ module Cop
21
+ module Chef
22
+ module Ruby
23
+ # Use powershell_exec!/powershell_exec instead of powershell_out!/powershell_out. The new
24
+ # methods don't spawn 2 shells per shellout and instead use .NET bindings to call PS directly.
25
+ class LegacyPowershellOutMethods < Base
26
+ MSG = "Use powershell_exec!/powershell_exec instead of the slower legacy powershell_out!/powershell_out methods."
27
+ RESTRICT_ON_SEND = %i{powershell_out! powershell_out}.freeze
28
+
29
+ def on_send(node)
30
+ add_offense(node, message: MSG, severity: :refactor)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chefstyle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.9
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-28 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.0
19
+ version: 1.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.7.0
26
+ version: 1.9.0
27
27
  description:
28
28
  email:
29
29
  - oss@chef.io
@@ -43,6 +43,7 @@ files:
43
43
  - lib/chefstyle/version.rb
44
44
  - lib/rubocop/chef.rb
45
45
  - lib/rubocop/cop/chef/ruby/gemspec_require_rubygems.rb
46
+ - lib/rubocop/cop/chef/ruby/legacy_powershell_out_methods.rb
46
47
  - lib/rubocop/cop/chef/ruby/require_net_https.rb
47
48
  - lib/rubocop/cop/chef/ruby/ruby_27_keyword_argument_warnings.rb
48
49
  - lib/rubocop/cop/chef/ruby/unless_defined_require.rb
@@ -65,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  - !ruby/object:Gem::Version
66
67
  version: '0'
67
68
  requirements: []
68
- rubygems_version: 3.0.3
69
+ rubygems_version: 3.1.4
69
70
  signing_key:
70
71
  specification_version: 4
71
72
  summary: RuboCop configuration for Chef's ruby projects