Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(maint) - fix rubocop #334

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lib/onceover/beaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ def self.facts_to_vagrant_box(facts)
# se or an array

if facts.is_a?(Array)
returnval = []
facts.each do |fact|
returnval << self.facts_to_vagrant_box(fact)
returnval = facts.map do |fact|
self.facts_to_vagrant_box(fact)
end
return returnval
end
Expand Down Expand Up @@ -64,9 +63,8 @@ def self.facts_to_platform(facts)
warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"

if facts.is_a?(Array)
returnval = []
facts.each do |fact|
returnval << self.facts_to_platform(fact)
returnval = facts.map do |fact|
self.facts_to_platform(fact)
end
return returnval
end
Expand Down
20 changes: 8 additions & 12 deletions lib/onceover/controlrepo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ def classes
end

# Get all the classes from all of the manifests
classes = []
code_dirs.each do |dir|
classes << get_classes(dir)
classes = code_dirs.map do |dir|
get_classes(dir)
end
classes.flatten
end
Expand All @@ -208,9 +207,8 @@ def facts(filter = nil, key = 'values')
raise "Filter param must be a hash" unless filter.is_a?(Hash)

all_facts.keep_if do |hash|
matches = []
filter.each do |filter_fact,value|
matches << keypair_is_in_hash(hash,filter_fact,value)
matches = filter.map do |filter_fact,value|
keypair_is_in_hash(hash,filter_fact,value)
end
!matches.include? false
end
Expand All @@ -231,10 +229,9 @@ def print_puppetfile_table
puppetfile.load!

output_array = []
threads = []
error_array = []
puppetfile.modules.each do |mod|
threads << Thread.new do
threads = puppetfile.modules.map do |mod|
Thread.new do
begin
row = []
logger.debug "Loading data for #{mod.full_name}"
Expand Down Expand Up @@ -313,13 +310,12 @@ def update_puppetfile
# TODO: Make sure we can deal with :latest

# Create threading resources
threads = []
queue = Queue.new
queue.push(puppetfile_string)

puppetfile.modules.keep_if {|m| m.is_a?(R10K::Module::Forge)}
puppetfile.modules.each do |mod|
threads << Thread.new do
threads = puppetfile.modules.map do |mod|
Thread.new do
logger.debug "Getting latest version of #{mod.full_name}"
latest_version = mod.v3_module.current_release.version

Expand Down
4 changes: 1 addition & 3 deletions lib/onceover/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ def initialize(name = nil, members = [])
@members = []
else
# Turn it into a full list
member_objects = []

# This should also handle lists that include groups
members.each { |member| member_objects << Onceover::TestConfig.find_list(member) }
member_objects = members.map { |member| Onceover::TestConfig.find_list(member) }
member_objects.flatten!

# Check that they are all the same type
Expand Down
Loading