Skip to content

Commit 04966be

Browse files
committed
rubocop: autofix
1 parent 7e7c52b commit 04966be

16 files changed

Lines changed: 179 additions & 143 deletions

File tree

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
inherit_from: .rubocop_todo.yml
3+
24
# Managed by modulesync - DO NOT EDIT
35
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
46

.rubocop_todo.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
3+
# using RuboCop version 1.85.1.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 5
10+
# This cop supports unsafe autocorrection (--autocorrect-all).
11+
RSpec/IncludeExamples:
12+
Exclude:
13+
- 'spec/acceptance/tests/class_v5_spec.rb'
14+
- 'spec/acceptance/tests/snapshot.rb'
15+
- 'spec/helpers/acceptance/tests/class_shared_examples.rb'
16+
- 'spec/unit/provider/kibana_plugin/kibana_plugin_spec.rb'
17+
- 'spec/unit/provider/kibana_plugin/kibana_spec.rb'
18+
19+
# Offense count: 1
20+
RSpec/LeakyLocalVariable:
21+
Exclude:
22+
- 'spec/helpers/acceptance/tests/basic_shared_examples.rb'
23+
24+
# Offense count: 1
25+
# This cop supports unsafe autocorrection (--autocorrect-all).
26+
RSpec/Output:
27+
Exclude:
28+
- 'spec/spec_utilities.rb'
29+
30+
# Offense count: 2
31+
RSpec/SpecFilePathSuffix:
32+
Exclude:
33+
- 'spec/acceptance/tests/snapshot.rb'
34+
- 'spec/functions/kibana_hash2yaml.rb'

lib/puppet/functions/kibana/hash2yaml.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
def yaml(input, options = {})
1818
settings = {
19-
'header' => '# File managed by Puppet.'
19+
'header' => '# File managed by Puppet.',
2020
}
2121

2222
settings.merge!(options)

lib/puppet/provider/elastic_kibana.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def self.present_plugins
3535
name: File.basename(plugin),
3636
ensure: :present,
3737
provider: name,
38-
version: j['version']
38+
version: j['version'],
3939
}
4040
end
4141
end
@@ -146,7 +146,7 @@ def self.prefetch(resources)
146146

147147
# Provider constructor
148148
def initialize(value = {})
149-
super(value)
149+
super
150150
@property_flush = {}
151151
end
152152
end

lib/puppet/provider/kibana_plugin/kibana.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
home_path: File.join(%w[/ opt kibana]),
1010
install_args: ['plugin', '--install'],
1111
plugin_directory: 'installedPlugins',
12-
remove_args: ['plugin', '--remove']
12+
remove_args: ['plugin', '--remove'],
1313
) do
1414
desc 'Native command-line provider for Kibana v4 plugins.'
1515

lib/puppet/provider/kibana_plugin/kibana_plugin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
home_path: File.join(%w[/ usr share kibana]),
99
install_args: ['install'],
1010
plugin_directory: 'plugins',
11-
remove_args: ['remove']
11+
remove_args: ['remove'],
1212
) do
1313
desc 'Native command-line provider for Kibana v5 plugins.'
1414

lib/puppet/type/kibana_plugin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
end
2828

2929
autorequire(:package) do
30-
self[:ensure] == :absent ? [] : 'kibana'
30+
(self[:ensure] == :absent) ? [] : 'kibana'
3131
end
3232

3333
validate do

spec/acceptance/tests/class_v5_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
let(:plugin) { 'health_metric_vis' }
99
let(:plugin_version) { '0.3.4' }
1010
let(:port) { 5602 }
11-
let(:version) { fact('osfamily') == 'RedHat' ? '5.2.0-1' : '5.2.0' }
11+
let(:version) { (fact('osfamily') == 'RedHat') ? '5.2.0-1' : '5.2.0' }
1212

1313
let(:manifest) do
1414
<<-MANIFEST

spec/classes/kibana_spec.rb

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@
1717
it 'sets expected defaults' do
1818
expect(subject).to contain_class('kibana').with(
1919
ensure: 'present',
20-
manage_repo: true
20+
manage_repo: true,
2121
)
2222
end
2323

2424
it 'declares install before config' do
25-
expect(subject).to contain_class('kibana::install').
26-
that_comes_before('Class[kibana::config]')
25+
expect(subject).to contain_class('kibana::install')
26+
.that_comes_before('Class[kibana::config]')
2727
end
2828

2929
it { is_expected.to contain_class('kibana::config') }
3030

3131
it 'subscribes service to config' do
32-
expect(subject).to contain_class('kibana::service').
33-
that_subscribes_to('Class[kibana::config]')
32+
expect(subject).to contain_class('kibana::service')
33+
.that_subscribes_to('Class[kibana::config]')
3434
end
3535

3636
it 'installs the kibana config file' do
37-
expect(subject).to contain_file('/etc/kibana/kibana.yml').
38-
with(
37+
expect(subject).to contain_file('/etc/kibana/kibana.yml')
38+
.with(
3939
ensure: 'file',
4040
owner: 'kibana',
4141
group: 'kibana',
42-
mode: '0660'
43-
).
44-
with_content(sensitive(%r{
42+
mode: '0660',
43+
)
44+
.with_content(sensitive(%r{
4545
# Managed by Puppet..
4646
---.
4747
}xm))
@@ -50,23 +50,23 @@
5050
it 'enables and starts the service' do
5151
expect(subject).to contain_service('kibana').with(
5252
ensure: true,
53-
enable: true
53+
enable: true,
5454
)
5555
end
5656

5757
it { is_expected.to contain_package('kibana').with_ensure('present') }
5858

5959
it do
60-
expect(subject).to contain_class('elastic_stack::repo').
61-
that_comes_before('Class[kibana::install]')
60+
expect(subject).to contain_class('elastic_stack::repo')
61+
.that_comes_before('Class[kibana::install]')
6262
end
6363

6464
case facts[:os]['family']
6565
when 'Debian'
6666
describe "#{facts[:os]['family']} resources" do
6767
it 'updates package cache before installing kibana' do
68-
expect(subject).to contain_class('apt::update').
69-
that_comes_before('Package[kibana]')
68+
expect(subject).to contain_class('apt::update')
69+
.that_comes_before('Package[kibana]')
7070
end
7171
end
7272
end
@@ -76,41 +76,41 @@
7676
describe 'removal' do
7777
let :params do
7878
{
79-
ensure: 'absent'
79+
ensure: 'absent',
8080
}
8181
end
8282

8383
it { is_expected.to compile.with_all_deps }
8484

8585
it 'sets expected defaults' do
8686
expect(subject).to contain_class('kibana').with(
87-
ensure: 'absent'
87+
ensure: 'absent',
8888
)
8989
end
9090

9191
it 'manages service before config' do
92-
expect(subject).to contain_class('kibana::service').
93-
that_comes_before('Class[kibana::config]')
92+
expect(subject).to contain_class('kibana::service')
93+
.that_comes_before('Class[kibana::config]')
9494
end
9595

9696
it 'manages config before install' do
97-
expect(subject).to contain_class('kibana::config').
98-
that_comes_before('Class[kibana::install]')
97+
expect(subject).to contain_class('kibana::config')
98+
.that_comes_before('Class[kibana::install]')
9999
end
100100

101101
it { is_expected.to contain_class('kibana::install') }
102102

103103
it 'stops and disables the service' do
104-
expect(subject).to contain_service('kibana').
105-
with(
104+
expect(subject).to contain_service('kibana')
105+
.with(
106106
ensure: false,
107-
enable: false
107+
enable: false,
108108
)
109109
end
110110

111111
it 'removes the kibana config file' do
112-
expect(subject).to contain_file('/etc/kibana/kibana.yml').
113-
with(ensure: 'absent')
112+
expect(subject).to contain_file('/etc/kibana/kibana.yml')
113+
.with(ensure: 'absent')
114114
end
115115

116116
it { is_expected.to contain_package('kibana').with_ensure('absent') }
@@ -126,8 +126,8 @@
126126
it { is_expected.to compile.with_all_deps }
127127

128128
it {
129-
expect(subject).to contain_package('kibana').
130-
with_ensure(param)
129+
expect(subject).to contain_package('kibana')
130+
.with_ensure(param)
131131
}
132132
end
133133
end
@@ -147,7 +147,7 @@
147147
'server.port' => 5601,
148148
'elasticsearch.ssl.verify' => true,
149149
'elasticsearch.requestHeadersWhitelist' => ['authorization'],
150-
'tilemap' => { 'url' => 'https://test' }
150+
'tilemap' => { 'url' => 'https://test' },
151151
}.each do |key, val|
152152
context "'#{val}'" do
153153
let(:params) { { config: { key => val } } }
@@ -161,7 +161,7 @@
161161
{
162162
'server.basePath' => 4.2,
163163
5601 => :undef,
164-
'' => :undef
164+
'' => :undef,
165165
}.each do |key, val|
166166
context "'#{val}'" do
167167
let(:params) { { config: { key => val } } }
@@ -190,7 +190,7 @@
190190
it 'enables and starts the custom service' do
191191
expect(subject).to contain_service('kibana-custom').with(
192192
ensure: true,
193-
enable: true
193+
enable: true,
194194
)
195195
end
196196
end
@@ -217,20 +217,20 @@
217217
let(:params) { { package_source: package_source } }
218218

219219
it {
220-
expect(subject).to contain_package('kibana').
221-
with_source(package_source)
220+
expect(subject).to contain_package('kibana')
221+
.with_source(package_source)
222222
}
223223

224224
case facts[:os]['family']
225225
when 'Debian'
226226
it {
227-
expect(subject).to contain_package('kibana').
228-
with_provider('dpkg')
227+
expect(subject).to contain_package('kibana')
228+
.with_provider('dpkg')
229229
}
230230
when 'RedHat'
231231
it {
232-
expect(subject).to contain_package('kibana').
233-
with_provider('rpm')
232+
expect(subject).to contain_package('kibana')
233+
.with_provider('rpm')
234234
}
235235
else
236236
it { is_expected.not_to compile.with_all_deps }
@@ -242,8 +242,8 @@
242242
let(:params) { { package_name: 'kibana-custom' } }
243243

244244
it {
245-
expect(subject).to contain_package('kibana').
246-
with_name('kibana-custom')
245+
expect(subject).to contain_package('kibana')
246+
.with_name('kibana-custom')
247247
}
248248
end
249249

spec/helpers/acceptance/tests/basic_shared_examples.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
it { apply_manifest(manifest, catch_failures: true) }
1212
it { apply_manifest(manifest, catch_changes: true) }
1313

14-
describe package("kibana#{RSpec.configuration.oss ? '-oss' : ''}") do
14+
describe package("kibana#{'-oss' if RSpec.configuration.oss}") do
1515
it { is_expected.to be_installed }
1616
end
1717

0 commit comments

Comments
 (0)