Commit b05981f0 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'rubocop/enable-performance-times-map-cop' into 'master'

Enable Performance/TimesMap Rubocop cop

Use Array.new with a block instead of `.times.collect` / `.times.map`.

See #17478

See merge request !4357
parents e7586cfb 0c6f0442
...@@ -1026,10 +1026,9 @@ Performance/StartWith: ...@@ -1026,10 +1026,9 @@ Performance/StartWith:
Performance/StringReplacement: Performance/StringReplacement:
Enabled: true Enabled: true
# TODO: Enable TimesMap Cop.
# Checks for `.times.map` calls. # Checks for `.times.map` calls.
Performance/TimesMap: Performance/TimesMap:
Enabled: false Enabled: true
##################### Rails ################################## ##################### Rails ##################################
......
...@@ -15,9 +15,7 @@ describe Issues::BulkUpdateService, services: true do ...@@ -15,9 +15,7 @@ describe Issues::BulkUpdateService, services: true do
describe :close_issue do describe :close_issue do
before do before do
@issues = 5.times.collect do @issues = create_list(:issue, 5, project: @project)
create(:issue, project: @project)
end
@params = { @params = {
state_event: 'close', state_event: 'close',
issues_ids: @issues.map(&:id) issues_ids: @issues.map(&:id)
...@@ -36,11 +34,8 @@ describe Issues::BulkUpdateService, services: true do ...@@ -36,11 +34,8 @@ describe Issues::BulkUpdateService, services: true do
end end
describe :reopen_issues do describe :reopen_issues do
before do before do
@issues = 5.times.collect do @issues = create_list(:closed_issue, 5, project: @project)
create(:closed_issue, project: @project)
end
@params = { @params = {
state_event: 'reopen', state_event: 'reopen',
issues_ids: @issues.map(&:id) issues_ids: @issues.map(&:id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment