Skip to content

Commit

Permalink
fix rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettrowell authored and dylanratcliffe committed Apr 18, 2024
1 parent 722287a commit 8aa8608
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
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

0 comments on commit 8aa8608

Please sign in to comment.