cookstyle 5.0.0 → 5.0.4

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: 800b435721c1606cb6a2e5dc3dc23b5115e6458d33b926d2fe97814f5380cf3e
4
- data.tar.gz: 2f5562bf2a8b921dadde7f99729c3f9f4507bdc6625d564193e6c743b7c72e16
3
+ metadata.gz: 7cbe0d726d24711da59599a15be6d1a6b9904245cb68ad17aa07f390bbad1537
4
+ data.tar.gz: ec624080babc3e2f6295ed610c6700e69d5fae4a383696638d0344ee1e5eaf86
5
5
  SHA512:
6
- metadata.gz: 01d8e5baf238a0591b5561ab6bb944781ab7dcc1fa0b9b1eff85df7128c05cd235abb36a7d9086a37152487841bd838c7724c131d24e04b7cf8559e424bc2292
7
- data.tar.gz: f2911a20dc0b941da2ce8491fdf1ffedc816bb71f9a55f84a8a4f6dd16a7579b279f9e0d12c951f86ee507e2966ec54233a1eb27d637041257f3c8fa0924fe8b
6
+ metadata.gz: 5dac69031554a13e6f8df40ebb38dd816c3f7fd87dc32020d5387af42374066433704ac95db00f692ce1dc1970d2b4b11061fb1ea34a6ec2be459486626c25ec
7
+ data.tar.gz: 2b6f78c5b4859c6fe62f588725da64b40b12c08184a8ca8ce45bac215c771c744ae3ee5c99171a65e05e10177f1e188d0b457067ef1af5964039b333fddeff9f
@@ -38,7 +38,7 @@ Chef/FileMode:
38
38
  Enabled: true
39
39
 
40
40
  Chef/ServiceResource:
41
- Description: Use a service resource to start and stop services
41
+ Description: Use a service resource to start and stop services instead of execute resources
42
42
  Enabled: true
43
43
 
44
44
  Chef/CopyrightCommentFormat:
@@ -49,6 +49,14 @@ Chef/CommentFormat:
49
49
  Description: Use Chef's unique format for comment headers
50
50
  Enabled: true
51
51
 
52
+ Chef/NodeSet:
53
+ Description: Do not use the deprecated node.set method
54
+ Enabled: true
55
+
56
+ Chef/TmpPath:
57
+ Description: Use file_cache_path rather than hard-coding tmp paths
58
+ Enabled: true
59
+
52
60
  #### The base rubocop 0.37 enabled.yml file we started with ####
53
61
 
54
62
  Layout/AccessModifierIndentation:
@@ -34,9 +34,7 @@ require 'rubocop/chef'
34
34
  require 'rubocop/chef/cookbook_only'
35
35
 
36
36
  # Chef specific cops
37
- require 'rubocop/cop/chef/attribute_keys'
38
- require 'rubocop/cop/chef/file_mode'
39
- require 'rubocop/cop/chef/service_resource'
40
- require 'rubocop/cop/chef/comments_format'
41
- require 'rubocop/cop/chef/comments_copyright_format'
42
- require 'rubocop/cop/chef/tmp_path'
37
+ Dir.glob(File.dirname(__FILE__) + '/rubocop/cop/chef/**/*.rb') do |file|
38
+ next if File.directory?(file)
39
+ require_relative file # not actually relative but require_relative is faster
40
+ end
@@ -1,4 +1,4 @@
1
1
  module Cookstyle
2
- VERSION = '5.0.0'.freeze
2
+ VERSION = "5.0.4".freeze # rubocop: disable Style/StringLiterals
3
3
  RUBOCOP_VERSION = '0.72.0'.freeze
4
4
  end
@@ -32,7 +32,7 @@ module RuboCop
32
32
  MSG = 'Use strings for file modes'.freeze
33
33
 
34
34
  def_node_matcher :resource_mode?, <<-PATTERN
35
- (send nil :mode $int)
35
+ (send nil? :mode $int)
36
36
  PATTERN
37
37
 
38
38
  def on_send(node)
@@ -0,0 +1,53 @@
1
+ #
2
+ # Copyright:: Copyright 2019-2019, Chef Software Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ module RuboCop
17
+ module Cop
18
+ module Chef
19
+ # The node.set method has been removed in Chef-13 and must be replaced by node.normal.
20
+ #
21
+ # Note that node.normal keeps the semantics identical, but the use of node.normal is
22
+ # also discouraged.
23
+ #
24
+ # @example
25
+ #
26
+ # # bad
27
+ # node.set['foo'] = true
28
+ #
29
+ # # good
30
+ # node.normal['foo'] = true
31
+ #
32
+ class NodeSet < Cop
33
+ MSG = 'Do not use node.set. Replace with node.normal to keep identical behavior.'.freeze
34
+
35
+ def_node_matcher :node_set?, <<-PATTERN
36
+ (send (send _ :node) :set)
37
+ PATTERN
38
+
39
+ def on_send(node)
40
+ node_set?(node) do
41
+ add_offense(node, location: :expression, message: MSG, severity: :warning)
42
+ end
43
+ end
44
+
45
+ def autocorrect(node)
46
+ lambda do |corrector|
47
+ corrector.replace(node.loc.expression, 'node.normal')
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -29,7 +29,7 @@ module RuboCop
29
29
  MSG = 'Use a service resource to start and stop services'.freeze
30
30
 
31
31
  def_node_matcher :execute_command?, <<-PATTERN
32
- (send nil :command $str)
32
+ (send nil? :command $str)
33
33
  PATTERN
34
34
 
35
35
  def on_send(node)
@@ -32,7 +32,7 @@ module RuboCop
32
32
  MSG = 'Use file_cache_path rather than hard-coding tmp paths'.freeze
33
33
 
34
34
  def_node_matcher :remote_file?, <<-PATTERN
35
- (send nil :remote_file $str)
35
+ (send nil? :remote_file $str)
36
36
  PATTERN
37
37
 
38
38
  def on_send(node)
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: 5.0.0
4
+ version: 5.0.4
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: 2019-07-02 00:00:00.000000000 Z
12
+ date: 2019-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -78,6 +78,7 @@ files:
78
78
  - lib/rubocop/cop/chef/comments_copyright_format.rb
79
79
  - lib/rubocop/cop/chef/comments_format.rb
80
80
  - lib/rubocop/cop/chef/file_mode.rb
81
+ - lib/rubocop/cop/chef/node_set.rb
81
82
  - lib/rubocop/cop/chef/service_resource.rb
82
83
  - lib/rubocop/cop/chef/tmp_path.rb
83
84
  homepage: https://github.com/chef/cookstyle