Коммит 164fc34e создал по автору Robert Speicher's avatar Robert Speicher
Просмотр файлов

Merge branch 'rubocop/enable-style-for-cop' into 'master'

Enable Style/For rubocop cop

> Do not use `for`, unless you know exactly why. Most of the time iterators should be used instead. `for` is implemented in terms of `each` (so you're adding a level of indirection), but with a twist - `for` doesn't introduce a new scope (unlike `each`) and variables defined in its block will be visible outside it.

See #17478

See merge request !4397
владельцы 4621531a 0319d5b6
......@@ -247,7 +247,7 @@ Style/FlipFlop:
# Checks use of for or each in multiline loops.
Style/For:
Enabled: false
Enabled: true
# Enforce the use of Kernel#sprintf, Kernel#format or String#%.
Style/FormatString:
......
......@@ -205,7 +205,7 @@ def place_chain(commit, parent_time = nil)
# Visit branching chains
leaves.each do |l|
parents = l.parents(@map).select{|p| p.space.zero?}
for p in parents
parents.each do |p|
place_chain(p, l.time)
end
end
......@@ -223,7 +223,7 @@ def get_space_base(leaves)
end
def mark_reserved(time_range, space)
for day in time_range
time_range.each do |day|
@reserved[day].push(space)
end
end
......@@ -232,7 +232,7 @@ def find_free_space(time_range, space_step, space_base = 1, space_default = nil)
space_default ||= space_base
reserved = []
for day in time_range
time_range.each do |day|
reserved.push(*@reserved[day])
end
reserved.uniq!
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать