app/models/miq_provision_request_template.rb
Use Array.new(scaling_min)
with a block instead of .times.collect
only if scaling_min
is always 0 or more. Open
Open
scaling_min.times.collect do |idx|
create_request_task(idx) do |req_task|
req_task.miq_request_id = service_task.miq_request.id
req_task.userid = service_task.userid
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for .times.map calls. In most cases such calls can be replaced with an explicit array creation.
Example:
# bad
9.times.map do |i|
i.to_s
end
# good
Array.new(9) do |i|
i.to_s
end