chefstyle 1.3.2 → 1.4.0

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: 53fa6bb2f80dbe12ea389014623ddc52076c9432383e533f21e5c571e069c14d
4
- data.tar.gz: 064cdbbf2ba18a12b09e5db1d4a508bab1c27e36a91007e0c5e03aeaed14b36f
3
+ metadata.gz: 066e8ac793f64512443174f9e09c8919b03bbe9559a16a041e8d986f95de3278
4
+ data.tar.gz: 72e56fd44dac3fd344959b2920611ead077ff18b2517b6b2fedd545375041190
5
5
  SHA512:
6
- metadata.gz: 7cc1e3008f9624c9868f5d13d4a0010b932c4ce4a41d3b4368405c62b808acf34b712914b580e0334dbdfdb19510da7840866a0a126656ef84eb2a5b829c1f0f
7
- data.tar.gz: 27707feacf6dcd7e0890d95a07fcab77d44d7bb474f56a5e6f4f1c363161683c48881946b920c660b5fe277bf18a8980cdc67379b458d242406803dd4d0c3be1
6
+ metadata.gz: ef9db45e45112086e38e265ceb5c745010c18265b4b12e0096b38112ad91dca303cf9f469e2f8fdb60d73659ead6eb2a59591a440554a59a6b4f9b4494d1c9f8
7
+ data.tar.gz: ebd7a40b197ec5f97f19b5ed4f57af9e74254fb05641cda8734719c43e9b89aaf2a3fab937d118be2f1808a43f0c77f2151548808be9d0dba45e94e7bc8cacf9
@@ -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,38 @@ 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
+
636
668
  ChefRuby/Ruby27KeywordArgumentWarnings:
637
669
  Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
638
670
  Enabled: true
@@ -655,4 +687,4 @@ ChefRuby/GemspecRequireRubygems:
655
687
  ChefRuby/RequireNetHttps:
656
688
  Description: net/https is deprecated and just includes net/http and openssl. We should include those directly instead
657
689
  Enabled: true
658
- VersionAdded: '1.3.0'
690
+ 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:
@@ -267,6 +271,8 @@ Lint/FormatParameterMismatch:
267
271
  Enabled: false
268
272
  Lint/HeredocMethodCallPosition:
269
273
  Enabled: false
274
+ Lint/IdentityComparison:
275
+ Enabled: false
270
276
  Lint/ImplicitStringConcatenation:
271
277
  Enabled: false
272
278
  Lint/InheritException:
@@ -395,6 +401,8 @@ Lint/UselessMethodDefinition:
395
401
  Enabled: false
396
402
  Lint/UselessSetterCall:
397
403
  Enabled: false
404
+ Lint/UselessTimes:
405
+ Enabled: false
398
406
  Lint/Void:
399
407
  Enabled: false
400
408
  Metrics/CyclomaticComplexity:
@@ -848,4 +856,4 @@ Security/MarshalLoad:
848
856
  Security/Open:
849
857
  Enabled: false
850
858
  Security/YAMLLoad:
851
- Enabled: false
859
+ 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
@@ -1533,6 +1554,12 @@ Lint/HeredocMethodCallPosition:
1533
1554
  StyleGuide: '#heredoc-method-calls'
1534
1555
  VersionAdded: '0.68'
1535
1556
 
1557
+ Lint/IdentityComparison:
1558
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1559
+ Enabled: pending
1560
+ StyleGuide: '#identity-comparison'
1561
+ VersionAdded: '0.91'
1562
+
1536
1563
  Lint/ImplicitStringConcatenation:
1537
1564
  Description: >-
1538
1565
  Checks for adjacent string literals on the same line, which
@@ -1784,6 +1811,7 @@ Lint/SafeNavigationChain:
1784
1811
  - presence
1785
1812
  - try
1786
1813
  - try!
1814
+ - in?
1787
1815
 
1788
1816
  Lint/SafeNavigationConsistency:
1789
1817
  Description: >-
@@ -1966,6 +1994,12 @@ Lint/UselessSetterCall:
1966
1994
  VersionChanged: '0.80'
1967
1995
  Safe: false
1968
1996
 
1997
+ Lint/UselessTimes:
1998
+ Description: 'Checks for useless `Integer#times` calls.'
1999
+ Enabled: pending
2000
+ VersionAdded: '0.91'
2001
+ Safe: false
2002
+
1969
2003
  Lint/Void:
1970
2004
  Description: 'Possible use of operator/literal/variable in void context.'
1971
2005
  Enabled: true
@@ -3074,6 +3108,7 @@ Style/GlobalStdStream:
3074
3108
  StyleGuide: '#global-stdout'
3075
3109
  Enabled: pending
3076
3110
  VersionAdded: '0.89'
3111
+ SafeAutoCorrect: false
3077
3112
 
3078
3113
  Style/GlobalVars:
3079
3114
  Description: 'Do not introduce global variables.'
@@ -5,11 +5,14 @@ require_relative "chefstyle/version"
5
5
  gem "rubocop", "= #{Chefstyle::RUBOCOP_VERSION}"
6
6
  require "rubocop"
7
7
 
8
+ # @TODO remove this monkeypatch after we upgrade from 0.91.0
9
+ require_relative "rubocop/monkey_patches/rescue_ensure_alignment"
10
+
8
11
  module RuboCop
9
12
  class ConfigLoader
10
13
  RUBOCOP_HOME.gsub!(
11
14
  /^.*$/,
12
- File.realpath(File.join(File.dirname(__FILE__), ".."))
15
+ File.realpath(File.join(__dir__, ".."))
13
16
  )
14
17
 
15
18
  DEFAULT_FILE.gsub!(
@@ -31,7 +34,7 @@ end
31
34
  require_relative "rubocop/chef"
32
35
 
33
36
  # Chef custom cops
34
- Dir.glob(File.dirname(__FILE__) + "/rubocop/cop/chef/**/*.rb") do |file|
37
+ Dir.glob(__dir__ + "/rubocop/cop/chef/**/*.rb") do |file|
35
38
  next if File.directory?(file)
36
39
 
37
40
  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.0"
4
+ RUBOCOP_VERSION = "0.91.0"
5
+ end
@@ -35,6 +35,7 @@ module RuboCop
35
35
  "benchmark" => "Benchmark",
36
36
  "cgi" => "CGI",
37
37
  "chef-utils" => "ChefUtils",
38
+ "chef-utils/dist" => "ChefUtils::Dist",
38
39
  "csv" => "CSV",
39
40
  "digest" => "Digest",
40
41
  "digest/md5" => "Digest::MD5",
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ module RuboCop
3
+ module Cop
4
+ module Layout
5
+ class RescueEnsureAlignment < Base
6
+ # @TODO remove this monkeypatch after we upgrade from RuboCop 0.91.0
7
+ def begin_end_alignment_style
8
+ # FIXME: Workaround for pending status for `Layout/BeginEndAlignment` cop
9
+ # When RuboCop 1.0 is released, please replace it with the following condition.
10
+ #
11
+ # config.for_cop('Layout/BeginEndAlignment')['Enabled'] &&
12
+ # config.for_cop('Layout/BeginEndAlignment')['EnforcedStyleAlignWith']
13
+ if config.for_all_cops["NewCops"] == "enable" ||
14
+ config.for_cop("Layout/BeginEndAlignment")["Enabled"] &&
15
+ config.for_cop("Layout/BeginEndAlignment")["Enabled"] != "pending"
16
+ config.for_cop("Layout/BeginEndAlignment")["EnforcedStyleAlignWith"]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ 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.3.2
4
+ version: 1.4.0
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-09-17 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.91.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: '0.90'
26
+ version: 0.91.0
27
27
  description:
28
28
  email:
29
29
  - oss@chef.io
@@ -46,6 +46,7 @@ files:
46
46
  - lib/rubocop/cop/chef/ruby/require_net_https.rb
47
47
  - lib/rubocop/cop/chef/ruby/ruby_27_keyword_argument_warnings.rb
48
48
  - lib/rubocop/cop/chef/ruby/unless_defined_require.rb
49
+ - lib/rubocop/monkey_patches/rescue_ensure_alignment.rb
49
50
  homepage: https://github.com/chef/chefstyle
50
51
  licenses:
51
52
  - Apache-2.0