cookstyle 7.8.0 → 7.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,8 @@ Bundler/DuplicatedGem:
5
5
  Enabled: false
6
6
  Bundler/GemComment:
7
7
  Enabled: false
8
+ Bundler/GemVersion:
9
+ Enabled: false
8
10
  Bundler/InsecureProtocolSource:
9
11
  Enabled: false
10
12
  Bundler/OrderedGems:
@@ -147,8 +149,12 @@ Layout/MultilineOperationIndentation:
147
149
  Enabled: false
148
150
  Layout/ParameterAlignment:
149
151
  Enabled: false
152
+ Layout/RedundantLineBreak:
153
+ Enabled: false
150
154
  Layout/RescueEnsureAlignment:
151
155
  Enabled: false
156
+ Layout/SingleLineBlockChain:
157
+ Enabled: false
152
158
  Layout/SpaceAfterColon:
153
159
  Enabled: false
154
160
  Layout/SpaceAfterComma:
@@ -851,6 +857,8 @@ Style/StabbyLambdaParentheses:
851
857
  Enabled: false
852
858
  Style/StderrPuts:
853
859
  Enabled: false
860
+ Style/StringChars:
861
+ Enabled: false
854
862
  Style/StringConcatenation:
855
863
  Enabled: false
856
864
  Style/StringHashKeys:
@@ -897,6 +905,8 @@ Style/TrivialAccessors:
897
905
  Enabled: false
898
906
  Style/UnlessElse:
899
907
  Enabled: false
908
+ Style/UnlessLogicalOperators:
909
+ Enabled: false
900
910
  Style/UnpackFirst:
901
911
  Enabled: false
902
912
  Style/VariableInterpolation:
data/config/upstream.yml CHANGED
@@ -130,7 +130,7 @@ AllCops:
130
130
  # What MRI version of the Ruby interpreter is the inspected code intended to
131
131
  # run on? (If there is more than one, set this to the lowest version.)
132
132
  # If a value is specified for TargetRubyVersion then it is used. Acceptable
133
- # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
133
+ # values are specificed as a float (i.e. 3.0); the teeny version of Ruby
134
134
  # should not be included. If the project specifies a Ruby version in the
135
135
  # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
136
136
  # try to determine the desired version of Ruby by inspecting the
@@ -138,7 +138,7 @@ AllCops:
138
138
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
139
139
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
140
140
  # Ruby version is still unresolved, RuboCop will use the oldest officially
141
- # supported Ruby version (currently Ruby 2.4).
141
+ # supported Ruby version (currently Ruby 2.5).
142
142
  TargetRubyVersion: ~
143
143
  # Determines if a notification for extension libraries should be shown when
144
144
  # rubocop is run. Keys are the name of the extension, and values are an array
@@ -174,6 +174,20 @@ Bundler/GemComment:
174
174
  IgnoredGems: []
175
175
  OnlyFor: []
176
176
 
177
+ Bundler/GemVersion:
178
+ Description: 'Requires or forbids specifying gem versions.'
179
+ Enabled: false
180
+ VersionAdded: '1.14'
181
+ EnforcedStyle: 'required'
182
+ SupportedStyles:
183
+ - 'required'
184
+ - 'forbidden'
185
+ Include:
186
+ - '**/*.gemfile'
187
+ - '**/Gemfile'
188
+ - '**/gems.rb'
189
+ AllowedGems: []
190
+
177
191
  Bundler/InsecureProtocolSource:
178
192
  Description: >-
179
193
  The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
@@ -1101,11 +1115,24 @@ Layout/ParameterAlignment:
1101
1115
  # But it can be overridden by setting this parameter
1102
1116
  IndentationWidth: ~
1103
1117
 
1118
+ Layout/RedundantLineBreak:
1119
+ Description: >-
1120
+ Do not break up an expression into multiple lines when it fits
1121
+ on a single line.
1122
+ Enabled: false
1123
+ InspectBlocks: false
1124
+ VersionAdded: '1.13'
1125
+
1104
1126
  Layout/RescueEnsureAlignment:
1105
1127
  Description: 'Align rescues and ensures correctly.'
1106
1128
  Enabled: true
1107
1129
  VersionAdded: '0.49'
1108
1130
 
1131
+ Layout/SingleLineBlockChain:
1132
+ Description: 'Put method call on a separate line if chained to a single line block.'
1133
+ Enabled: false
1134
+ VersionAdded: '1.14'
1135
+
1109
1136
  Layout/SpaceAfterColon:
1110
1137
  Description: 'Use spaces after colons.'
1111
1138
  StyleGuide: '#spaces-operators'
@@ -1380,6 +1407,8 @@ Lint/AmbiguousBlockAssociation:
1380
1407
  StyleGuide: '#syntax'
1381
1408
  Enabled: true
1382
1409
  VersionAdded: '0.48'
1410
+ VersionChanged: '1.13'
1411
+ IgnoredMethods: []
1383
1412
 
1384
1413
  Lint/AmbiguousOperator:
1385
1414
  Description: >-
@@ -2055,13 +2084,18 @@ Lint/SuppressedException:
2055
2084
  StyleGuide: '#dont-hide-exceptions'
2056
2085
  Enabled: true
2057
2086
  AllowComments: true
2087
+ AllowNil: true
2058
2088
  VersionAdded: '0.9'
2059
- VersionChanged: '0.81'
2089
+ VersionChanged: '1.12'
2060
2090
 
2061
2091
  Lint/SymbolConversion:
2062
2092
  Description: 'Checks for unnecessary symbol conversions.'
2063
2093
  Enabled: pending
2064
2094
  VersionAdded: '1.9'
2095
+ EnforcedStyle: strict
2096
+ SupportedStyles:
2097
+ - strict
2098
+ - consistent
2065
2099
 
2066
2100
  Lint/Syntax:
2067
2101
  Description: 'Checks for syntax errors.'
@@ -2489,6 +2523,7 @@ Naming/MemoizedInstanceVariableName:
2489
2523
  - disallowed
2490
2524
  - required
2491
2525
  - optional
2526
+ Safe: false
2492
2527
 
2493
2528
  Naming/MethodName:
2494
2529
  Description: 'Use the configured style when naming methods.'
@@ -3174,6 +3209,7 @@ Style/Documentation:
3174
3209
  Description: 'Document classes and non-namespace modules.'
3175
3210
  Enabled: true
3176
3211
  VersionAdded: '0.9'
3212
+ AllowedConstants: []
3177
3213
  Exclude:
3178
3214
  - 'spec/**/*'
3179
3215
  - 'test/**/*'
@@ -3446,6 +3482,8 @@ Style/HashConversion:
3446
3482
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3447
3483
  Enabled: pending
3448
3484
  VersionAdded: '1.10'
3485
+ VersionChanged: '1.11'
3486
+ AllowSplatArgument: true
3449
3487
 
3450
3488
  Style/HashEachMethods:
3451
3489
  Description: 'Use Hash#each_key and Hash#each_value.'
@@ -3670,6 +3708,7 @@ Style/MethodCallWithArgsParentheses:
3670
3708
  AllowParenthesesInMultilineCall: false
3671
3709
  AllowParenthesesInChaining: false
3672
3710
  AllowParenthesesInCamelCaseMethod: false
3711
+ AllowParenthesesInStringInterpolation: false
3673
3712
  EnforcedStyle: require_parentheses
3674
3713
  SupportedStyles:
3675
3714
  - require_parentheses
@@ -4489,6 +4528,13 @@ Style/StderrPuts:
4489
4528
  Enabled: true
4490
4529
  VersionAdded: '0.51'
4491
4530
 
4531
+ Style/StringChars:
4532
+ Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
4533
+ StyleGuide: '#string-chars'
4534
+ Enabled: pending
4535
+ Safe: false
4536
+ VersionAdded: '1.12'
4537
+
4492
4538
  Style/StringConcatenation:
4493
4539
  Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4494
4540
  StyleGuide: '#string-interpolation'
@@ -4586,6 +4632,7 @@ Style/SymbolProc:
4586
4632
  Safe: false
4587
4633
  VersionAdded: '0.26'
4588
4634
  VersionChanged: '1.5'
4635
+ AllowMethodsWithArguments: false
4589
4636
  # A list of method names to be ignored by the check.
4590
4637
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4591
4638
  IgnoredMethods:
@@ -4738,6 +4785,16 @@ Style/UnlessElse:
4738
4785
  Enabled: true
4739
4786
  VersionAdded: '0.9'
4740
4787
 
4788
+ Style/UnlessLogicalOperators:
4789
+ Description: >-
4790
+ Checks for use of logical operators in an unless condition.
4791
+ Enabled: false
4792
+ VersionAdded: '1.11'
4793
+ EnforcedStyle: forbid_mixed_logical_operators
4794
+ SupportedStyles:
4795
+ - forbid_mixed_logical_operators
4796
+ - forbid_logical_operators
4797
+
4741
4798
  Style/UnpackFirst:
4742
4799
  Description: >-
4743
4800
  Checks for accessing the first element of `String#unpack`
data/cookstyle.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'Cookstyle is a code linting tool that helps you to write better Chef Infra cookbooks by detecting and automatically correcting style, syntax, and logic mistakes in your code.'
12
12
  spec.license = 'Apache-2.0'
13
13
  spec.homepage = 'https://docs.chef.io/workstation/cookstyle/'
14
- spec.required_ruby_version = '>= 2.4'
14
+ spec.required_ruby_version = '>= 2.5'
15
15
 
16
16
  # the gemspec and Gemfile are necessary for appbundling of the gem
17
17
  spec.files = %w(LICENSE cookstyle.gemspec Gemfile) + Dir.glob('{lib,bin,config}/**/*')
data/lib/cookstyle.rb CHANGED
@@ -7,7 +7,7 @@ require 'yaml' unless defined?(YAML)
7
7
  # ensure the desired target version of RuboCop is gem activated
8
8
  gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
9
9
  require 'rubocop'
10
- require_relative 'rubocop/monkey_patches/comment_config'
10
+ require_relative 'rubocop/monkey_patches/directive_comment'
11
11
 
12
12
  # monkey patches needed for the TargetChefVersion config option
13
13
  require_relative 'rubocop/monkey_patches/config'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.8.0" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '1.10.0'
3
+ VERSION = "7.11.1" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '1.14.0'
5
5
  end
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it to be executed as Ruby code which will always returns true instead of a shell command that will actually run.
22
+ # A resource guard (not_if/only_if) that is a string should not be wrapped in `{}`. Wrapping a guard string in {} causes it to be executed as Ruby code which will always returns true instead of a shell command that will actually run.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Use raise to force Chef Infra Client to fail instead of using Chef::Application.fatal, which masks the full stack trace of the failure and makes debugging difficult.
22
+ # Use `raise` to force Chef Infra Client to fail instead of using `Chef::Application.fatal`, which masks the full stack trace of the failure and makes debugging difficult.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Don't use Ruby to shellout in a only_if / not_if conditional when you can just shellout directly. Any string value used with only_if / not_if is executed in your system's shell and the return code of the command is the result for the not_if / only_if determination.
22
+ # Don't use Ruby to shellout in a `only_if` / `not_if` conditional. Any string value used in an `only_if` / `not_if` is executed in your system's shell and the return code of the command is the result for the `not_if` / `only_if` determination.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # dnf_package does not support the allow_downgrades property
22
+ # The `dnf_package` resource does not support the `allow_downgrades` property.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Libraries should be injected into the Chef::DSL::Recipe class and not Chef::Recipe or Chef::Provider classes directly.
22
+ # Libraries should be injected into the `Chef::DSL::Recipe` class and not `Chef::Recipe` or `Chef::Provider` classes directly.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Valid notification timings are :immediately, :immediate (alias for :immediately), :delayed, and :before.
22
+ # Valid notification timings are `:immediately`, `:immediate` (alias for :immediately), `:delayed`, and `:before`.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Pass valid platform families to the platform_family? helper.
22
+ # Pass valid platform families to the `platform_family?` helper. See [Infra Language: Platform Family](https://docs.chef.io/infra_language/checking_platforms/#platform_family-values) for a complete list of platform families.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Use valid platform family values in case statements.
22
+ # Use valid platform family values in case statements. See [Infra Language: Platform Family](https://docs.chef.io/infra_language/checking_platforms/#platform_family-values) for a complete list of platform families.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Pass valid platforms to the platform? helper.
22
+ # Pass valid platforms to the `platform?` helper. See [Infra Language: Platform](https://docs.chef.io/infra_language/checking_platforms/#platform-values) for a list of many common platform values.
23
23
  #
24
24
  # @example
25
25
  #
@@ -32,6 +32,7 @@ module RuboCop
32
32
  # platform?('mac_os_x')
33
33
  # platform?('redhat)
34
34
  # platform?('suse')
35
+ #
35
36
  class InvalidPlatformHelper < Base
36
37
  include ::RuboCop::Chef::PlatformHelpers
37
38
 
@@ -20,7 +20,7 @@ module RuboCop
20
20
  module Cop
21
21
  module Chef
22
22
  module Correctness
23
- # metadata.rb supports methods should contain valid platforms.
23
+ # metadata.rb supports methods should contain valid platforms. See [Infra Language: Platform](https://docs.chef.io/infra_language/checking_platforms/#platform-values) for a list of many common platform values.
24
24
  #
25
25
  # @example
26
26
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Use valid platform values in case statements.
22
+ # Use valid platform values in case statements. See [Infra Language: Platform](https://docs.chef.io/infra_language/checking_platforms/#platform-values) for a list of many common platform values.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Pass valid platforms families to the value_for_platform_family helper.
22
+ # Pass valid platforms families to the value_for_platform_family helper. See [Infra Language: Platform Family](https://docs.chef.io/infra_language/checking_platforms/#platform_family-values) for a complete list of platform families.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Pass valid platforms to the value_for_platform helper.
22
+ # Pass valid platforms to the value_for_platform helper. See [Infra Language: Platform](https://docs.chef.io/infra_language/checking_platforms/#platform-values) for a list of many common platform values.
23
23
  #
24
24
  # @example
25
25
  #
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Style
22
- # Use the platform_family?() helpers instead of node['os] == 'foo' for platform_families that match one-to-one with OS values. These helpers are easier to read and can accept multiple platform arguments, which greatly simplifies complex platform logic. All values of `os` from Ohai match one-to-one with `platform_family` values except for `linux`, which has no single equivalent `plaform_family`.
22
+ # Use the platform_family?() helpers instead of node['os] == 'foo' for platform_families that match one-to-one with OS values. These helpers are easier to read and can accept multiple platform arguments, which greatly simplifies complex platform logic. All values of `os` from Ohai match one-to-one with `platform_family` values except for `linux`, which has no single equivalent `platform_family`.
23
23
  #
24
24
  # @example
25
25
  #
@@ -2,10 +2,11 @@
2
2
  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
- class CommentConfig
6
- remove_const('COMMENT_DIRECTIVE_REGEXP')
7
- COMMENT_DIRECTIVE_REGEXP = Regexp.new(
8
- "# (?:rubocop|cookstyle): ((?:disable|enable|todo))\\b #{COPS_PATTERN}".gsub(' ', '\s*')
5
+ class DirectiveComment
6
+ remove_const('DIRECTIVE_COMMENT_REGEXP')
7
+ DIRECTIVE_COMMENT_REGEXP = Regexp.new(
8
+ "# (?:rubocop|cookstyle) : ((?:disable|enable|todo))\\b #{COPS_PATTERN}"
9
+ .gsub(' ', '\s*')
9
10
  )
10
11
  end
11
12
  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: 7.8.0
4
+ version: 7.11.1
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: 2021-02-15 00:00:00.000000000 Z
12
+ date: 2021-05-05 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.10.0
20
+ version: 1.14.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: 1.10.0
27
+ version: 1.14.0
28
28
  description:
29
29
  email:
30
30
  - thom@chef.io
@@ -275,8 +275,8 @@ files:
275
275
  - lib/rubocop/cop/chef/style/use_platform_helpers.rb
276
276
  - lib/rubocop/cop/target_chef_version.rb
277
277
  - lib/rubocop/monkey_patches/base.rb
278
- - lib/rubocop/monkey_patches/comment_config.rb
279
278
  - lib/rubocop/monkey_patches/config.rb
279
+ - lib/rubocop/monkey_patches/directive_comment.rb
280
280
  - lib/rubocop/monkey_patches/registry_cop.rb
281
281
  - lib/rubocop/monkey_patches/team.rb
282
282
  homepage: https://docs.chef.io/workstation/cookstyle/
@@ -296,7 +296,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - ">="
298
298
  - !ruby/object:Gem::Version
299
- version: '2.4'
299
+ version: '2.5'
300
300
  required_rubygems_version: !ruby/object:Gem::Requirement
301
301
  requirements:
302
302
  - - ">="