cookstyle 7.31.7 → 7.31.9

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: 0041f7691cd8703343c065df3ff9845f59018276336bf8fe0bf199a802533fc8
4
- data.tar.gz: 782fa56469ebdc5895320bcf4c815a1bb9964aced211c52b007b3945cb331adc
3
+ metadata.gz: 77ad4617e8e89f4b34622dfc962e39037e28c5d9779cbc3198a64c7155b426ed
4
+ data.tar.gz: cf9fdce4231a1b0c55e8166628affc51abe3eb188ba5a8d75c08cd57f0d49470
5
5
  SHA512:
6
- metadata.gz: 6a67d211251cf6443c9cdd6fbc5cd696f13d3fdd178fa3ea8bef7bd6c3495869b935f0dd01083cf5ca8a9a705ad32370ea8e640c390dbeda9629ee260fe06234
7
- data.tar.gz: e7fac0be14547d1fb7ac86a61d8a23923d47d2958bc2f5df466eb487d4d67abd0f28b6f0d76afa4c803fc3f952981fa1c3fd3e03d5763d1eb63217665be3f64b
6
+ metadata.gz: db4d6bf2c6a01d8bbd4c49f3ed8a13cf23b70d664f15c515536ae64e509af4d2caa6151825161d9dc554d19088527465b009e37ff13fbac1a04829308fb90684
7
+ data.tar.gz: 192f218ee77783b63d7712a0c51837c2a50ebffef4cf1f12112cfcd0008599e9bdf25fb6250f7f4f2c2206f15ae856ef62a6ee2183abb8cb86ad959823df98f6
data/config/cookstyle.yml CHANGED
@@ -2,6 +2,12 @@ AllCops:
2
2
  SuggestExtensions: false
3
3
  TargetRubyVersion: 2.5
4
4
  TargetChefVersion: ~
5
+ inherit_mode:
6
+ merge:
7
+ - Include
8
+ Include:
9
+ - '**/.delivery/project.toml' # required by Chef/Deprecations/Delivery
10
+ - '**/.delivery/config.json' # required by Chef/Deprecations/Delivery
5
11
  Exclude:
6
12
  - '**/files/**/*'
7
13
  - '**/vendor/**/*'
@@ -1265,12 +1271,13 @@ Chef/Deprecations/PolicyfileCommunitySource:
1265
1271
  - '**/Policyfile.rb'
1266
1272
 
1267
1273
  Chef/Deprecations/Delivery:
1268
- Description: Do not include a `.delivery` directory for the `delivery` command in your cookbooks. Chef Delivery (Workflow) went EOL Dec 31st 2021 and the delivery command was removed from Chef Workstation Feb 2022.
1274
+ Description: Do not include Chef Delivery (Workflow) configuration in your cookbooks. Chef Delivery (Workflow) went EOL Dec 31st 2021 and the delivery command was removed from Chef Workstation Feb 2022.
1269
1275
  StyleGuide: 'chef_deprecations_delivery'
1270
1276
  Enabled: true
1271
1277
  VersionAdded: '7.31.0'
1272
1278
  Include:
1273
- - '**/metadata.rb'
1279
+ - '**/.delivery/project.toml'
1280
+ - '**/.delivery/config.json'
1274
1281
 
1275
1282
  Chef/Deprecations/DeprecatedSudoActions:
1276
1283
  Description: The `sudo` resource in the sudo cookbook 5.0 (2018) or Chef Infra Client 14 and later have replaced the existing `:install` and `:remove` actions with `:create` and `:delete` actions to better match other resources in Chef Infra.
@@ -1954,7 +1961,7 @@ Chef/Modernize/UseChefLanguageCloudHelpers:
1954
1961
  - '**/resources/*.rb'
1955
1962
  - '**/providers/*.rb'
1956
1963
  - '**/recipes/*.rb'
1957
-
1964
+
1958
1965
  Chef/Modernize/ClassEvalActionClass:
1959
1966
  Description: In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block.
1960
1967
  StyleGuide: 'chef_modernize_classevalactionclass'
@@ -2332,7 +2339,7 @@ Chef/Security/SshPrivateKey:
2332
2339
  - '**/recipes/*.rb'
2333
2340
  - '**/attributes/*.rb'
2334
2341
  - '**/definitions/*.rb'
2335
-
2342
+
2336
2343
  #### The base rubocop 0.37 enabled.yml file we started with ####
2337
2344
 
2338
2345
  Layout/AccessModifierIndentation:
@@ -3094,4 +3101,4 @@ Style/FileRead:
3094
3101
 
3095
3102
  # reduce file write complexity
3096
3103
  Style/FileWrite:
3097
- Enabled: true
3104
+ Enabled: true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.31.7" # rubocop: disable Style/StringLiterals
3
+ VERSION = "7.31.9" # rubocop: disable Style/StringLiterals
4
4
  RUBOCOP_VERSION = '1.25.1'
5
5
  end
@@ -27,16 +27,20 @@ module RuboCop
27
27
  class Delivery < Base
28
28
  include RangeHelp
29
29
 
30
- MSG = 'Do not include a `.delivery` directory for the `delivery` command in your cookbooks. Chef Delivery (Workflow) went EOL Dec 31st 2021 and the delivery command was removed from Chef Workstation Feb 2022.'
30
+ MSG = 'Do not include Chef Delivery (Workflow) configuration in your cookbooks. It went EOL Dec 31st 2021 and the delivery command was removed from Chef Workstation Feb 2022.'
31
31
 
32
- def on_new_investigation
33
- return unless File.exist?(File.join(File.dirname(processed_source.path) + '/.delivery'))
32
+ def on_other_file
33
+ return unless processed_source.path.end_with?('/.delivery/project.toml', '/.delivery/config.json')
34
34
 
35
35
  # Using range similar to RuboCop::Cop::Naming::Filename (file_name.rb)
36
36
  range = source_range(processed_source.buffer, 1, 0)
37
37
 
38
38
  add_offense(range, severity: :warning)
39
39
  end
40
+
41
+ # An empty / simple TOML file can also be syntatically valid Ruby, so
42
+ # RuboCop may start an investigation instead of calling on_other_file.
43
+ alias_method :on_new_investigation, :on_other_file
40
44
  end
41
45
  end
42
46
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ require 'rubocop/rspec/expect_offense'
3
+ # rubocop:disable Lint/DuplicateMethods
4
+
5
+ module RuboCop
6
+ module RSpec
7
+ module ExpectOffense
8
+ # Yields to a block with `parse_processed_source` patched to not raise an
9
+ # exception.
10
+ #
11
+ # RSpec's `expect_offense` helper calls a method called
12
+ # `parse_processed_source` that parses source code and raises an exception
13
+ # if it is not valid Ruby. Raising an exception prevents RuboCop from
14
+ # calling the cop's `on_other_file` method for checking non-Ruby files.
15
+ def allow_invalid_ruby(&block)
16
+ alias :parse_processed_source :_parse_invalid_source
17
+ yield block
18
+ alias :parse_processed_source :_orig_parse_processed_source
19
+ end
20
+
21
+ alias :_orig_parse_processed_source :parse_processed_source
22
+
23
+ def _parse_invalid_source(source, file = nil)
24
+ parse_source(source, file)
25
+ end
26
+ end
27
+ end
28
+ 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.31.7
4
+ version: 7.31.9
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: 2022-02-17 00:00:00.000000000 Z
12
+ date: 2022-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -303,6 +303,7 @@ files:
303
303
  - lib/rubocop/cop/inspec/deprecation/attribute_default.rb
304
304
  - lib/rubocop/cop/inspec/deprecation/attribute_helper.rb
305
305
  - lib/rubocop/cop/target_chef_version.rb
306
+ - lib/rubocop/monkey_patches/allow_invalid_ruby.rb
306
307
  - lib/rubocop/monkey_patches/base.rb
307
308
  - lib/rubocop/monkey_patches/config.rb
308
309
  - lib/rubocop/monkey_patches/directive_comment.rb