cookstyle 5.0.0 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/cookstyle.yml +9 -1
- data/lib/cookstyle.rb +4 -6
- data/lib/cookstyle/version.rb +1 -1
- data/lib/rubocop/cop/chef/file_mode.rb +1 -1
- data/lib/rubocop/cop/chef/node_set.rb +53 -0
- data/lib/rubocop/cop/chef/service_resource.rb +1 -1
- data/lib/rubocop/cop/chef/tmp_path.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cbe0d726d24711da59599a15be6d1a6b9904245cb68ad17aa07f390bbad1537
|
4
|
+
data.tar.gz: ec624080babc3e2f6295ed610c6700e69d5fae4a383696638d0344ee1e5eaf86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dac69031554a13e6f8df40ebb38dd816c3f7fd87dc32020d5387af42374066433704ac95db00f692ce1dc1970d2b4b11061fb1ea34a6ec2be459486626c25ec
|
7
|
+
data.tar.gz: 2b6f78c5b4859c6fe62f588725da64b40b12c08184a8ca8ce45bac215c771c744ae3ee5c99171a65e05e10177f1e188d0b457067ef1af5964039b333fddeff9f
|
data/config/cookstyle.yml
CHANGED
@@ -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:
|
data/lib/cookstyle.rb
CHANGED
@@ -34,9 +34,7 @@ require 'rubocop/chef'
|
|
34
34
|
require 'rubocop/chef/cookbook_only'
|
35
35
|
|
36
36
|
# Chef specific cops
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
data/lib/cookstyle/version.rb
CHANGED
@@ -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
|
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.
|
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-
|
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
|