cookstyle 6.20.2 → 6.21.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: a36b09fd24530545b460de33db7f7239f2f64af587d5ccdf417335b9726be284
4
- data.tar.gz: d2e4de150fee0df25842ced5f5b073b684e37922703111ac18e06125c68b0a41
3
+ metadata.gz: e79caedf06c2358db6d9d303270d2245f46e66eb65119f4c8a1181081fb57994
4
+ data.tar.gz: b79613983ad7cdfb9715674680c0ac429490ee79cd843892489e3ced7f5f243d
5
5
  SHA512:
6
- metadata.gz: 7b5dac93d379ff0a7445e9eb2d5743e1c547ec0c3e8c5bff64e1d6c44b45817131b9f7c24ae94dc02b969fd652cb917529a74305b37827d9c317093223a11949
7
- data.tar.gz: f7dc13cb996e1d78e7660e50b3431401e85a64cd54529c99ccee33fd6f273c73e3ffe54f0cbaa6dd5b9bd0c500a40b0a5d0bbe94c7ae87f5b563aeb4e4b669f5
6
+ metadata.gz: 2e32c80c8e7b16e49d8cfdc89b0c8adafa122e55ab9aad418c23f0b7becf569c3e725cf58c0853a561916e9522ef42584aa37e78f0e5e906e6e0955e0f0d14ef
7
+ data.tar.gz: b015d7a4c96c353d37589210a88c9e1e13472d0695a38a630b6bbdfa18049d63287529359e199770d20eb67040f1eb9047e2561e32bdab4c3c18ee4cbc5b6b6b
@@ -469,6 +469,16 @@ ChefCorrectness/PropertyWithoutType:
469
469
  - '**/libraries/*.rb'
470
470
  - '**/resources/*.rb'
471
471
 
472
+ ChefCorrectness/OctalModeAsString:
473
+ Description: Don't represent file modes as strings containing octal values. Use standard base 10 file modes instead.
474
+ StyleGuide: '#chefcorrectnessoctalmodeasstring'
475
+ Enabled: true
476
+ VersionAdded: '6.21.0'
477
+ Exclude:
478
+ - '**/attributes/*.rb'
479
+ - '**/metadata.rb'
480
+ - '**/Berksfile'
481
+
472
482
  ###############################
473
483
  # ChefSharing: Issues that prevent sharing code with other teams or with the Chef community in general
474
484
  ###############################
@@ -1121,6 +1131,12 @@ ChefDeprecations/WindowsPackageInstallerTypeString:
1121
1131
  - '**/attributes/*.rb'
1122
1132
  - '**/Berksfile'
1123
1133
 
1134
+ ChefDeprecations/UseYamlDump:
1135
+ Description: Chef Infra Client 16.5 introduced performance enhancements to Ruby library loading. Due to the underlying implementation of Ruby's `.to_yaml` method, it does not automatically load the `yaml` library and `YAML.dump()` should be used instead to properly load the `yaml` library.
1136
+ StyleGuide: '#chefdeprecationsuseyamldump'
1137
+ Enabled: true
1138
+ VersionAdded: '6.21.0'
1139
+
1124
1140
  ###############################
1125
1141
  # ChefModernize: Cleaning up legacy code and using new built-in resources
1126
1142
  ###############################
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "6.20.2" # rubocop: disable Style/StringLiterals
3
+ VERSION = "6.21.1" # rubocop: disable Style/StringLiterals
4
4
  RUBOCOP_VERSION = '0.93.1'
5
5
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright 2020, 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
+ module RuboCop
19
+ module Cop
20
+ module Chef
21
+ module ChefCorrectness
22
+ # Don't represent file modes as Strings containing octal values.
23
+ #
24
+ # @example
25
+ #
26
+ # # bad
27
+ # file '/etc/some_file' do
28
+ # mode '0o755'
29
+ # end
30
+ #
31
+ # # good
32
+ # file '/etc/some_file' do
33
+ # mode '0755'
34
+ # end
35
+ #
36
+ class OctalModeAsString < Base
37
+ MSG = "Don't represent file modes as strings containing octal values. Use standard base 10 file modes instead. For example: '0755'."
38
+ RESTRICT_ON_SEND = [:mode].freeze
39
+
40
+ def on_send(node)
41
+ return unless node.arguments.first&.str_type? && node.arguments.first.value.match?(/^0o/)
42
+ add_offense(node, message: MSG, severity: :refactor)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: 2020, 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
+ module RuboCop
19
+ module Cop
20
+ module Chef
21
+ module ChefDeprecations
22
+ # Chef Infra Client 16.5 introduced performance enhancements to Ruby library loading. Due to the underlying implementation of Ruby's `.to_yaml` method, it does not automatically load the `yaml` library and `YAML.dump()` should be used instead to properly load the `yaml` library.
23
+ #
24
+ # @example
25
+ #
26
+ # # bad
27
+ # {"foo" => "bar"}.to_yaml
28
+ #
29
+ # # good
30
+ # YAML.dump({"foo" => "bar"})
31
+ #
32
+ class UseYamlDump < Base
33
+ extend AutoCorrector
34
+
35
+ MSG = "Chef Infra Client 16.5 introduced performance enhancements to Ruby library loading. Due to the underlying implementation of Ruby's `.to_yaml` method, it does not automatically load the `yaml` library and `YAML.dump()` should be used instead to properly load the `yaml` library."
36
+ RESTRICT_ON_SEND = [:to_yaml].freeze
37
+
38
+ def on_send(node)
39
+ add_offense(node, message: MSG, severity: :warning) do |corrector|
40
+ corrector.replace(node, "YAML.dump(#{node.receiver.source})")
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ 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: 6.20.2
4
+ version: 6.21.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: 2020-10-12 00:00:00.000000000 Z
12
+ date: 2020-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -74,6 +74,7 @@ files:
74
74
  - lib/rubocop/cop/chef/correctness/node_normal_unless.rb
75
75
  - lib/rubocop/cop/chef/correctness/node_save.rb
76
76
  - lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb
77
+ - lib/rubocop/cop/chef/correctness/octal_mode_as_string.rb
77
78
  - lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb
78
79
  - lib/rubocop/cop/chef/correctness/powershell_delete_file.rb
79
80
  - lib/rubocop/cop/chef/correctness/property_without_type.rb
@@ -141,6 +142,7 @@ files:
141
142
  - lib/rubocop/cop/chef/deprecation/run_command_helper.rb
142
143
  - lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb
143
144
  - lib/rubocop/cop/chef/deprecation/use_inline_resources.rb
145
+ - lib/rubocop/cop/chef/deprecation/use_yaml_dump.rb
144
146
  - lib/rubocop/cop/chef/deprecation/user_supports_property.rb
145
147
  - lib/rubocop/cop/chef/deprecation/verify_property_file_expansion.rb
146
148
  - lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb