cookstyle 6.2.5 → 6.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cookstyle/version.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb +5 -2
- data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +9 -2
- data/lib/rubocop/cop/chef/redundant/grouping_metadata.rb +0 -1
- data/lib/rubocop/cop/chef/redundant/sensitive_property_in_resource.rb +3 -3
- data/lib/rubocop/cop/chef/style/negating_only_if.rb +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e4a34f5dc3234aeb3febf3019211d19e70b32538dfe55a13150ba45086767b2
|
4
|
+
data.tar.gz: 6825981876e3882b87e5699c0e9127cf0c0512201771086bc1ad5948cfb9b71f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31bb85b95815744e511f172d62e83c21624c2192d15cd8e766b4b5a960165f5367bcbd289cb0df8db25d842f826889f1e1b9b6f5dfedc1f2fe2bd82dbd428e95
|
7
|
+
data.tar.gz: 4d5ea06716a8559835225d596594deb81e40a61ab38141b0f9ea3e65bfec8460fd53b45a64eea036de136cf56fcec1ade258160d8d74e7f48fc1f1137e9f19e7
|
data/lib/cookstyle/version.rb
CHANGED
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module ChefDeprecations
|
22
|
-
# In Chef Infra Client 16 the log resource no longer notifies when logging so notifications should not be triggered from log resources.
|
22
|
+
# In Chef Infra Client 16 the log resource no longer notifies when logging so notifications should not be triggered from log resources. Use the notify_group resource introduced in Chef Infra Client 15.8 instead to aggregate notifications.
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -45,8 +45,11 @@ module RuboCop
|
|
45
45
|
#
|
46
46
|
class LogResourceNotifications < Cop
|
47
47
|
include RuboCop::Chef::CookbookHelpers
|
48
|
+
extend TargetChefVersion
|
48
49
|
|
49
|
-
|
50
|
+
minimum_target_chef_version '15.8'
|
51
|
+
|
52
|
+
MSG = 'In Chef Infra Client 16 the log resource no longer notifies when logging so notifications should not be triggered from log resources. Use the notify_group resource introduced in Chef Infra Client 15.8 instead to aggregate notifications.'.freeze
|
50
53
|
|
51
54
|
def on_block(node)
|
52
55
|
match_property_in_resource?(:log, 'notifies', node) do |prop_node|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2019, Chef Software Inc.
|
2
|
+
# Copyright:: 2019-2020, Chef Software Inc.
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -35,8 +35,15 @@ module RuboCop
|
|
35
35
|
|
36
36
|
MSG = 'whyrun_supported? no longer needs to be set to true as it is the default in Chef Infra Client 13+'.freeze
|
37
37
|
|
38
|
+
# match on both whyrun_supported? and the typo form why_run_supported?
|
39
|
+
def_node_matcher :whyrun_true?, <<-PATTERN
|
40
|
+
(def {:whyrun_supported? :why_run_supported?}
|
41
|
+
(args)
|
42
|
+
(true))
|
43
|
+
PATTERN
|
44
|
+
|
38
45
|
def on_def(node)
|
39
|
-
|
46
|
+
whyrun_true?(node) do
|
40
47
|
add_offense(node, location: :expression, message: MSG, severity: :refactor)
|
41
48
|
end
|
42
49
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright 2019, Chef Software Inc.
|
2
|
+
# Copyright:: Copyright 2019-2020, Chef Software Inc.
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,13 +18,13 @@ module RuboCop
|
|
18
18
|
module Cop
|
19
19
|
module Chef
|
20
20
|
module ChefRedundantCode
|
21
|
-
# Every Chef Infra
|
21
|
+
# Every Chef Infra resource already includes a sensitive property with a default value of false.
|
22
22
|
#
|
23
23
|
# # bad
|
24
24
|
# property :sensitive, [true, false], default: false
|
25
25
|
#
|
26
26
|
class SensitivePropertyInResource < Cop
|
27
|
-
MSG = 'Every Chef Infra
|
27
|
+
MSG = 'Every Chef Infra resource already includes a sensitive property with a default value of false.'.freeze
|
28
28
|
|
29
29
|
def_node_matcher :sensitive_property?, <<-PATTERN
|
30
30
|
(send nil? {:property :attribute} (sym :sensitive) ... (hash (pair (sym :default) (false))))
|
@@ -18,7 +18,7 @@ module RuboCop
|
|
18
18
|
module Cop
|
19
19
|
module Chef
|
20
20
|
module ChefStyle
|
21
|
-
#
|
21
|
+
# Instead of using only_if conditionals with ! to negate the returned value, use not_if which is easier to read
|
22
22
|
#
|
23
23
|
# @example
|
24
24
|
#
|
@@ -33,7 +33,7 @@ module RuboCop
|
|
33
33
|
# end
|
34
34
|
#
|
35
35
|
class NegatingOnlyIf < Cop
|
36
|
-
MSG = '
|
36
|
+
MSG = 'Instead of using only_if conditionals with ! to negate the returned value, use not_if which is easier to read'.freeze
|
37
37
|
|
38
38
|
def_node_matcher :negated_only_if?, <<-PATTERN
|
39
39
|
(block
|
@@ -45,8 +45,13 @@ module RuboCop
|
|
45
45
|
|
46
46
|
def on_block(node)
|
47
47
|
negated_only_if?(node) do |_only_if, code|
|
48
|
+
# skip inspec controls where we don't have not_if
|
49
|
+
return if node.parent&.parent&.block_type? &&
|
50
|
+
node.parent&.parent&.method_name == :control
|
51
|
+
|
48
52
|
# the value was double negated to work around types: ex: !!systemd?
|
49
|
-
return if code.descendants.first.
|
53
|
+
return if code.descendants.first.send_type? &&
|
54
|
+
code.descendants.first.negation_method?
|
50
55
|
|
51
56
|
add_offense(node, location: :expression, message: MSG, severity: :refactor)
|
52
57
|
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.2.
|
4
|
+
version: 6.2.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: 2020-04-
|
12
|
+
date: 2020-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|