chefstyle 1.3.2 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53fa6bb2f80dbe12ea389014623ddc52076c9432383e533f21e5c571e069c14d
4
- data.tar.gz: 064cdbbf2ba18a12b09e5db1d4a508bab1c27e36a91007e0c5e03aeaed14b36f
3
+ metadata.gz: 47af66209187f3a802f47d1f8ff8288aab5ddc78a608217b46d7ae18e58d7c47
4
+ data.tar.gz: 765e364cacf5e1e600f47be32c9ff0fdd42a7963e2c7ceaed7c6afaa75cdd718
5
5
  SHA512:
6
- metadata.gz: 7cc1e3008f9624c9868f5d13d4a0010b932c4ce4a41d3b4368405c62b808acf34b712914b580e0334dbdfdb19510da7840866a0a126656ef84eb2a5b829c1f0f
7
- data.tar.gz: 27707feacf6dcd7e0890d95a07fcab77d44d7bb474f56a5e6f4f1c363161683c48881946b920c660b5fe277bf18a8980cdc67379b458d242406803dd4d0c3be1
6
+ metadata.gz: 65645e67536a598db99d8d4c91440cee1bdc9473f01ea251f4c7544e1d864f19eaa041c84c437b2254cf7cf7fe6be28e3817874e0bcfcb9d0e20b411ce55ab12
7
+ data.tar.gz: c5d93ab780c5cd2ed2fccef4156870d8b2d045aa95cd0a2f45934f7fdc780702fd2f6d3c968d0f72fdec5475a59d4b847c83d14f5abd7b9177cc1ab2d4014acc
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w{.. lib})
3
+ $LOAD_PATH.unshift File.join(__dir__, %w{.. lib})
4
4
 
5
5
  require "chefstyle"
6
6
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path("lib", __dir__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "chefstyle/version"
5
5
 
@@ -633,6 +633,42 @@ Style/CommentedKeyword:
633
633
  Lint/DeprecatedOpenSSLConstant:
634
634
  Enabled: true
635
635
 
636
+ # alert on invalid ruby synatx
637
+ Lint/Syntax:
638
+ Enabled: true
639
+
640
+ # remove extra requires like 'thread'
641
+ Lint/RedundantRequireStatement:
642
+ Enabled: true
643
+
644
+ # simplify stripping strings
645
+ Style/Strip:
646
+ Enabled: true
647
+
648
+ # simplify getting min/max
649
+ Style/RedundantSort:
650
+ Enabled: true
651
+
652
+ # no need for .rb in requires
653
+ Style/RedundantFileExtensionInRequire:
654
+ Enabled: true
655
+
656
+ # more code you don't need
657
+ Style/RedundantCondition:
658
+ Enabled: true
659
+
660
+ # Use __dir__ to simplify things
661
+ Style/Dir:
662
+ Enabled: true
663
+
664
+ # Use __FILE__ or __dir__ to simplify expand_paths
665
+ Style/ExpandPathArguments:
666
+ Enabled: true
667
+
668
+ # more code you don't need
669
+ Lint/RedundantSafeNavigation:
670
+ Enabled: true
671
+
636
672
  ChefRuby/Ruby27KeywordArgumentWarnings:
637
673
  Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
638
674
  Enabled: true
@@ -655,4 +691,4 @@ ChefRuby/GemspecRequireRubygems:
655
691
  ChefRuby/RequireNetHttps:
656
692
  Description: net/https is deprecated and just includes net/http and openssl. We should include those directly instead
657
693
  Enabled: true
658
- VersionAdded: '1.3.0'
694
+ VersionAdded: '1.3.0'
@@ -25,6 +25,8 @@ Layout/ArrayAlignment:
25
25
  Enabled: false
26
26
  Layout/AssignmentIndentation:
27
27
  Enabled: false
28
+ Layout/BeginEndAlignment:
29
+ Enabled: false
28
30
  Layout/BlockAlignment:
29
31
  Enabled: false
30
32
  Layout/BlockEndNewline:
@@ -215,6 +217,8 @@ Lint/BooleanSymbol:
215
217
  Enabled: false
216
218
  Lint/CircularArgumentReference:
217
219
  Enabled: false
220
+ Lint/ConstantDefinitionInBlock:
221
+ Enabled: false
218
222
  Lint/ConstantResolution:
219
223
  Enabled: false
220
224
  Lint/Debugger:
@@ -265,8 +269,12 @@ Lint/FloatOutOfRange:
265
269
  Enabled: false
266
270
  Lint/FormatParameterMismatch:
267
271
  Enabled: false
272
+ Lint/HashCompareByIdentity:
273
+ Enabled: false
268
274
  Lint/HeredocMethodCallPosition:
269
275
  Enabled: false
276
+ Lint/IdentityComparison:
277
+ Enabled: false
270
278
  Lint/ImplicitStringConcatenation:
271
279
  Enabled: false
272
280
  Lint/InheritException:
@@ -321,6 +329,8 @@ Lint/RedundantCopEnableDirective:
321
329
  Enabled: false
322
330
  Lint/RedundantRequireStatement:
323
331
  Enabled: false
332
+ Lint/RedundantSafeNavigation:
333
+ Enabled: false
324
334
  Lint/RedundantSplatExpansion:
325
335
  Enabled: false
326
336
  Lint/RedundantStringCoercion:
@@ -395,6 +405,8 @@ Lint/UselessMethodDefinition:
395
405
  Enabled: false
396
406
  Lint/UselessSetterCall:
397
407
  Enabled: false
408
+ Lint/UselessTimes:
409
+ Enabled: false
398
410
  Lint/Void:
399
411
  Enabled: false
400
412
  Metrics/CyclomaticComplexity:
@@ -485,6 +497,8 @@ Style/ClassAndModuleChildren:
485
497
  Enabled: false
486
498
  Style/ClassCheck:
487
499
  Enabled: false
500
+ Style/ClassEqualityComparison:
501
+ Enabled: false
488
502
  Style/ClassMethods:
489
503
  Enabled: false
490
504
  Style/ClassMethodsDefinitions:
@@ -848,4 +862,4 @@ Security/MarshalLoad:
848
862
  Security/Open:
849
863
  Enabled: false
850
864
  Security/YAMLLoad:
851
- Enabled: false
865
+ Enabled: false
@@ -117,6 +117,8 @@ AllCops:
117
117
  # CacheRootDirectory is ~ (nil), which it is by default, the root will be
118
118
  # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
119
119
  # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
120
+ # The CacheRootDirectory can be overwritten by passing the `--cache-root` command
121
+ # line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
120
122
  CacheRootDirectory: ~
121
123
  # It is possible for a malicious user to know the location of RuboCop's cache
122
124
  # directory by looking at CacheRootDirectory, and create a symlink in its
@@ -309,6 +311,19 @@ Layout/AssignmentIndentation:
309
311
  # But it can be overridden by setting this parameter
310
312
  IndentationWidth: ~
311
313
 
314
+ Layout/BeginEndAlignment:
315
+ Description: 'Align ends corresponding to begins correctly.'
316
+ Enabled: pending
317
+ VersionAdded: '0.91'
318
+ # The value `start_of_line` means that `end` should be aligned the start of the line
319
+ # where the `begin` keyword is.
320
+ # The value `begin` means that `end` should be aligned with the `begin` keyword.
321
+ EnforcedStyleAlignWith: start_of_line
322
+ SupportedStylesAlignWith:
323
+ - start_of_line
324
+ - begin
325
+ Severity: warning
326
+
312
327
  Layout/BlockAlignment:
313
328
  Description: 'Align block ends correctly.'
314
329
  Enabled: true
@@ -1380,6 +1395,12 @@ Lint/CircularArgumentReference:
1380
1395
  Enabled: true
1381
1396
  VersionAdded: '0.33'
1382
1397
 
1398
+ Lint/ConstantDefinitionInBlock:
1399
+ Description: 'Do not define constants within a block.'
1400
+ StyleGuide: '#no-constant-definition-in-block'
1401
+ Enabled: pending
1402
+ VersionAdded: '0.91'
1403
+
1383
1404
  Lint/ConstantResolution:
1384
1405
  Description: 'Check that constants are fully qualified with `::`.'
1385
1406
  Enabled: false
@@ -1525,6 +1546,13 @@ Lint/FormatParameterMismatch:
1525
1546
  Enabled: true
1526
1547
  VersionAdded: '0.33'
1527
1548
 
1549
+ Lint/HashCompareByIdentity:
1550
+ Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
1551
+ StyleGuide: '#identity-comparison'
1552
+ Enabled: pending
1553
+ Safe: false
1554
+ VersionAdded: '0.93'
1555
+
1528
1556
  Lint/HeredocMethodCallPosition:
1529
1557
  Description: >-
1530
1558
  Checks for the ordering of a method call where
@@ -1533,6 +1561,12 @@ Lint/HeredocMethodCallPosition:
1533
1561
  StyleGuide: '#heredoc-method-calls'
1534
1562
  VersionAdded: '0.68'
1535
1563
 
1564
+ Lint/IdentityComparison:
1565
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1566
+ Enabled: pending
1567
+ StyleGuide: '#identity-comparison'
1568
+ VersionAdded: '0.91'
1569
+
1536
1570
  Lint/ImplicitStringConcatenation:
1537
1571
  Description: >-
1538
1572
  Checks for adjacent string literals on the same line, which
@@ -1719,6 +1753,19 @@ Lint/RedundantRequireStatement:
1719
1753
  Enabled: true
1720
1754
  VersionAdded: '0.76'
1721
1755
 
1756
+ Lint/RedundantSafeNavigation:
1757
+ Description: 'Checks for redundant safe navigation calls.'
1758
+ Enabled: pending
1759
+ VersionAdded: '0.93'
1760
+ AllowedMethods:
1761
+ - instance_of?
1762
+ - kind_of?
1763
+ - is_a?
1764
+ - eql?
1765
+ - respond_to?
1766
+ - equal?
1767
+ Safe: false
1768
+
1722
1769
  Lint/RedundantSplatExpansion:
1723
1770
  Description: 'Checks for splat unnecessarily being called on literals.'
1724
1771
  Enabled: true
@@ -1784,6 +1831,7 @@ Lint/SafeNavigationChain:
1784
1831
  - presence
1785
1832
  - try
1786
1833
  - try!
1834
+ - in?
1787
1835
 
1788
1836
  Lint/SafeNavigationConsistency:
1789
1837
  Description: >-
@@ -1966,6 +2014,12 @@ Lint/UselessSetterCall:
1966
2014
  VersionChanged: '0.80'
1967
2015
  Safe: false
1968
2016
 
2017
+ Lint/UselessTimes:
2018
+ Description: 'Checks for useless `Integer#times` calls.'
2019
+ Enabled: pending
2020
+ VersionAdded: '0.91'
2021
+ Safe: false
2022
+
1969
2023
  Lint/Void:
1970
2024
  Description: 'Possible use of operator/literal/variable in void context.'
1971
2025
  Enabled: true
@@ -2429,7 +2483,7 @@ Style/ArrayCoercion:
2429
2483
  with a variable you want to treat as an Array, but you're not certain it's an array.
2430
2484
  StyleGuide: '#array-coercion'
2431
2485
  Safe: false
2432
- Enabled: 'pending'
2486
+ Enabled: false
2433
2487
  VersionAdded: '0.88'
2434
2488
 
2435
2489
  Style/ArrayJoin:
@@ -2668,6 +2722,16 @@ Style/ClassCheck:
2668
2722
  - is_a?
2669
2723
  - kind_of?
2670
2724
 
2725
+ Style/ClassEqualityComparison:
2726
+ Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
2727
+ StyleGuide: '#instance-of-vs-class-comparison'
2728
+ Enabled: pending
2729
+ VersionAdded: '0.93'
2730
+ IgnoredMethods:
2731
+ - ==
2732
+ - equal?
2733
+ - eql?
2734
+
2671
2735
  Style/ClassMethods:
2672
2736
  Description: 'Use self when defining module/class methods.'
2673
2737
  StyleGuide: '#def-self-class-methods'
@@ -2829,7 +2893,8 @@ Style/DateTime:
2829
2893
  StyleGuide: '#date--time'
2830
2894
  Enabled: false
2831
2895
  VersionAdded: '0.51'
2832
- VersionChanged: '0.59'
2896
+ VersionChanged: '0.92'
2897
+ SafeAutoCorrect: false
2833
2898
  AllowCoercion: false
2834
2899
 
2835
2900
  Style/DefWithParentheses:
@@ -3074,6 +3139,7 @@ Style/GlobalStdStream:
3074
3139
  StyleGuide: '#global-stdout'
3075
3140
  Enabled: pending
3076
3141
  VersionAdded: '0.89'
3142
+ SafeAutoCorrect: false
3077
3143
 
3078
3144
  Style/GlobalVars:
3079
3145
  Description: 'Do not introduce global variables.'
@@ -3248,11 +3314,16 @@ Style/IpAddresses:
3248
3314
  Description: "Don't include literal IP addresses in code."
3249
3315
  Enabled: false
3250
3316
  VersionAdded: '0.58'
3251
- VersionChanged: '0.77'
3317
+ VersionChanged: '0.91'
3252
3318
  # Allow addresses to be permitted
3253
3319
  AllowedAddresses:
3254
3320
  - "::"
3255
3321
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3322
+ Exclude:
3323
+ - '**/*.gemfile'
3324
+ - '**/Gemfile'
3325
+ - '**/gems.rb'
3326
+ - '**/*.gemspec'
3256
3327
 
3257
3328
  Style/KeywordParametersOrder:
3258
3329
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
@@ -3685,6 +3756,8 @@ Style/OptionalBooleanParameter:
3685
3756
  Enabled: pending
3686
3757
  Safe: false
3687
3758
  VersionAdded: '0.89'
3759
+ AllowedMethods:
3760
+ - respond_to_missing?
3688
3761
 
3689
3762
  Style/OrAssignment:
3690
3763
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3953,6 +4026,8 @@ Style/SafeNavigation:
3953
4026
  This cop transforms usages of a method call safeguarded by
3954
4027
  a check for the existence of the object to
3955
4028
  safe navigation (`&.`).
4029
+ Auto-correction is unsafe as it assumes the object will
4030
+ be `nil` or truthy, but never `false`.
3956
4031
  Enabled: true
3957
4032
  VersionAdded: '0.43'
3958
4033
  VersionChanged: '0.77'
@@ -3965,6 +4040,7 @@ Style/SafeNavigation:
3965
4040
  - presence
3966
4041
  - try
3967
4042
  - try!
4043
+ SafeAutoCorrect: false
3968
4044
 
3969
4045
  Style/Sample:
3970
4046
  Description: >-
@@ -9,7 +9,7 @@ module RuboCop
9
9
  class ConfigLoader
10
10
  RUBOCOP_HOME.gsub!(
11
11
  /^.*$/,
12
- File.realpath(File.join(File.dirname(__FILE__), ".."))
12
+ File.realpath(File.join(__dir__, ".."))
13
13
  )
14
14
 
15
15
  DEFAULT_FILE.gsub!(
@@ -31,7 +31,7 @@ end
31
31
  require_relative "rubocop/chef"
32
32
 
33
33
  # Chef custom cops
34
- Dir.glob(File.dirname(__FILE__) + "/rubocop/cop/chef/**/*.rb") do |file|
34
+ Dir.glob(__dir__ + "/rubocop/cop/chef/**/*.rb") do |file|
35
35
  next if File.directory?(file)
36
36
 
37
37
  require_relative file # not actually relative but require_relative is faster
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Chefstyle
3
- VERSION = "1.3.2"
4
- RUBOCOP_VERSION = "0.90"
5
- end
3
+ VERSION = "1.4.5"
4
+ RUBOCOP_VERSION = "0.93.1"
5
+ end
@@ -34,7 +34,8 @@ module RuboCop
34
34
  "base64" => "Base64",
35
35
  "benchmark" => "Benchmark",
36
36
  "cgi" => "CGI",
37
- "chef-utils" => "ChefUtils",
37
+ "chef-utils" => "ChefUtils::CANARY",
38
+ "chef-utils/dist" => "ChefUtils::Dist",
38
39
  "csv" => "CSV",
39
40
  "digest" => "Digest",
40
41
  "digest/md5" => "Digest::MD5",
@@ -94,10 +95,10 @@ module RuboCop
94
95
  "win32/registry" => "Win32::Registry",
95
96
  "win32ole" => "WIN32OLE",
96
97
  "winrm" => "WinRM::Connection",
97
- "yaml" => "YAML",
98
98
  "yard" => "YARD",
99
99
  "zip" => "Zip",
100
100
  "zlib" => "Zlib",
101
+ "pastel" => "Pastel",
101
102
  }.freeze
102
103
 
103
104
  def_node_matcher :require?, <<-PATTERN
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.3.2
4
+ version: 1.4.5
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-09-01 00:00:00.000000000 Z
11
+ date: 2020-10-12 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: '0.90'
19
+ version: 0.93.1
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: '0.90'
26
+ version: 0.93.1
27
27
  description:
28
28
  email:
29
29
  - oss@chef.io