File tree 4 files changed +11
-30
lines changed
lib/puppet/provider/apt_key
4 files changed +11
-30
lines changed Original file line number Diff line number Diff line change 6
6
# Note that changes in the inspected code, or installation of new
7
7
# versions of RuboCop, may require this file to be generated again.
8
8
9
- # Offense count: 1
10
- # This cop supports unsafe autocorrection (--autocorrect-all).
11
- Lint/BooleanSymbol :
12
- Exclude :
13
- - ' spec/unit/puppet/type/apt_key_spec.rb'
14
-
15
9
# Offense count: 3
16
10
# Configuration parameters: AllowedMethods.
17
11
# AllowedMethods: enums
@@ -53,13 +47,6 @@ Performance/CollectionLiteralInLoop:
53
47
Exclude :
54
48
- ' spec/classes/apt_update_spec.rb'
55
49
56
- # Offense count: 6
57
- # This cop supports unsafe autocorrection (--autocorrect-all).
58
- RSpec/BeEq :
59
- Exclude :
60
- - ' spec/unit/facter/apt_reboot_required_spec.rb'
61
- - ' spec/unit/puppet/type/apt_key_spec.rb'
62
-
63
50
# Offense count: 6
64
51
# Configuration parameters: Prefixes, AllowedPatterns.
65
52
# Prefixes: when, with, without
@@ -141,13 +128,6 @@ Security/Open:
141
128
Exclude :
142
129
- ' lib/puppet/provider/apt_key/apt_key.rb'
143
130
144
- # Offense count: 1
145
- # This cop supports unsafe autocorrection (--autocorrect-all).
146
- # Configuration parameters: MinBranchesCount.
147
- Style/CaseLikeIf :
148
- Exclude :
149
- - ' lib/puppet/provider/apt_key/apt_key.rb'
150
-
151
131
# Offense count: 1
152
132
# This cop supports unsafe autocorrection (--autocorrect-all).
153
133
Style/GlobalStdStream :
Original file line number Diff line number Diff line change @@ -71,13 +71,14 @@ def self.instances
71
71
def self . prefetch ( resources )
72
72
apt_keys = instances
73
73
resources . each_key do |name |
74
- if name . length == 40
74
+ case name . length
75
+ when 40
75
76
provider = apt_keys . find { |key | key . fingerprint == name }
76
77
resources [ name ] . provider = provider if provider
77
- elsif name . length == 16
78
+ when 16
78
79
provider = apt_keys . find { |key | key . long == name }
79
80
resources [ name ] . provider = provider if provider
80
- elsif name . length == 8
81
+ when 8
81
82
provider = apt_keys . find { |key | key . short == name }
82
83
resources [ name ] . provider = provider if provider
83
84
end
Original file line number Diff line number Diff line change 14
14
allow ( File ) . to receive ( :file? ) . once . with ( '/var/run/reboot-required' ) . and_return ( true )
15
15
end
16
16
17
- it { is_expected . to eq true }
17
+ it { is_expected . to be true }
18
18
end
19
19
20
20
describe 'if a reboot is not required' do
24
24
allow ( File ) . to receive ( :file? ) . once . with ( '/var/run/reboot-required' ) . and_return ( false )
25
25
end
26
26
27
- it { is_expected . to eq false }
27
+ it { is_expected . to be false }
28
28
end
29
29
end
Original file line number Diff line number Diff line change 24
24
end
25
25
26
26
it 'source is not set' do
27
- expect ( resource [ :source ] ) . to eq nil
27
+ expect ( resource [ :source ] ) . to be_nil
28
28
end
29
29
30
30
it 'content is not set' do
31
- expect ( resource [ :content ] ) . to eq nil
31
+ expect ( resource [ :content ] ) . to be_nil
32
32
end
33
33
34
34
it 'refresh is not set' do
35
- expect ( resource [ :refresh ] ) . to eq nil
35
+ expect ( resource [ :refresh ] ) . to be_nil
36
36
end
37
37
38
38
it 'weak_ssl is not set' do
39
- expect ( resource [ :weak_ssl ] ) . to eq nil
39
+ expect ( resource [ :weak_ssl ] ) . to be_nil
40
40
end
41
41
end
42
42
167
167
Puppet ::Type . type ( :apt_key ) . new ( id : 'EF8D349F' ,
168
168
source : 'http://apt.puppetlabs.com/pubkey.gpg' ,
169
169
ensure : :absent ,
170
- refresh : : true)
170
+ refresh : true )
171
171
} . to raise_error ( %r{ensure => absent and refresh => true are mutually exclusive} )
172
172
end
173
173
You can’t perform that action at this time.
0 commit comments