Skip to content

Commit 6cbd7e0

Browse files
committed
rubocop autocorrects and ignores
1 parent d7a851d commit 6cbd7e0

8 files changed

+33
-11
lines changed

.rubocop.yml

+2
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

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2024-02-11 16:22:05 UTC using RuboCop version 1.50.2.
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: 32
10+
# Configuration parameters: Max.
11+
RSpec/IndexedLet:
12+
Exclude:
13+
- 'spec/unit/provider/elasticsearch_component_template/ruby_spec.rb'
14+
- 'spec/unit/provider/elasticsearch_ilm_policy/ruby_spec.rb'
15+
- 'spec/unit/provider/elasticsearch_index/ruby_spec.rb'
16+
- 'spec/unit/provider/elasticsearch_index_template/ruby_spec.rb'
17+
- 'spec/unit/provider/elasticsearch_pipeline/ruby_spec.rb'
18+
- 'spec/unit/provider/elasticsearch_slm_policy/ruby_spec.rb'
19+
- 'spec/unit/provider/elasticsearch_snapshot_repository/ruby_spec.rb'
20+
- 'spec/unit/provider/elasticsearch_template/ruby_spec.rb'

lib/puppet/type/elasticsearch_component_template.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def insync?(value)
4848
val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index'
4949
(val['template']['settings'].keys - ['index']).each do |setting|
5050
new_key = if setting.start_with? 'index.'
51-
setting[6..-1]
51+
setting[6..]
5252
else
5353
setting
5454
end

lib/puppet/type/elasticsearch_index_template.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def insync?(value)
5454
val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index'
5555
(val['template']['settings'].keys - ['index']).each do |setting|
5656
new_key = if setting.start_with? 'index.'
57-
setting[6..-1]
57+
setting[6..]
5858
else
5959
setting
6060
end

lib/puppet/type/elasticsearch_license.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ def insync?(value)
3131
def should_to_s(newvalue)
3232
newvalue.transform_values do |license_data|
3333
if license_data.is_a? Hash
34-
license_data.map do |field, value|
34+
license_data.to_h do |field, value|
3535
[field, field == 'signature' ? '[redacted]' : value]
36-
end.to_h
36+
end
3737
else
3838
v
3939
end

lib/puppet/type/elasticsearch_template.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
val['settings']['index'] = {} unless val['settings'].key? 'index'
5151
(val['settings'].keys - ['index']).each do |setting|
5252
new_key = if setting.start_with? 'index.'
53-
setting[6..-1]
53+
setting[6..]
5454
else
5555
setting
5656
end

spec/spec_utilities.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def derive_artifact_urls_for(full_version, plugins = ['analysis-icu'])
4040
end
4141

4242
def derive_full_package_url(full_version, extensions = %w[deb rpm])
43-
extensions.map do |ext|
43+
extensions.to_h do |ext|
4444
url = if full_version.start_with? '6'
4545
"https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-#{full_version}.#{ext}"
4646
elsif ext == 'deb'
@@ -49,14 +49,14 @@ def derive_full_package_url(full_version, extensions = %w[deb rpm])
4949
"https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-#{full_version}-x86_64.#{ext}"
5050
end
5151
[url, File.basename(url)]
52-
end.to_h
52+
end
5353
end
5454

5555
def derive_plugin_urls_for(full_version, plugins = ['analysis-icu'])
56-
plugins.map do |plugin|
56+
plugins.to_h do |plugin|
5757
url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/#{plugin}/#{plugin}-#{full_version}.zip"
5858
[url, File.join('plugins', File.basename(url))]
59-
end.to_h
59+
end
6060
end
6161

6262
def artifact(file, fixture_path = [])

spec/support/acceptance/elastic.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
v[:elasticsearch_plugins] = Dir[
5656
artifact("*#{v[:elasticsearch_full_version]}.zip", ['plugins'])
57-
].map do |plugin|
57+
].to_h do |plugin|
5858
plugin_filename = File.basename(plugin)
5959
plugin_name = plugin_filename.match(%r{^(?<name>.+)-#{v[:elasticsearch_full_version]}.zip})[:name]
6060
[
@@ -64,7 +64,7 @@
6464
url: derive_plugin_urls_for(v[:elasticsearch_full_version], [plugin_name]).keys.first,
6565
},
6666
]
67-
end.to_h
67+
end
6868

6969
v[:oss] = !ENV['OSS_PACKAGE'].nil? and ENV['OSS_PACKAGE'] == 'true'
7070
v[:cluster_name] = SecureRandom.hex(10)

0 commit comments

Comments
 (0)