mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: Enable unless
cops
We discussed the use of `unless` internally and decided to enforce available rules from rubocop to restrict its most problematic uses.
This commit is contained in:

committed by
Loïc Guitaut

parent
87de3c2319
commit
f7c57fbc19
@ -120,15 +120,15 @@ module Onebox
|
||||
a_lines.each do |l|
|
||||
l = l.chomp("\n") # remove new line
|
||||
m = l.match(/\A[ ]*/) # find leading spaces 0 or more
|
||||
unless m.nil? || l.size == m[0].size || l.size == 0 # no match | only spaces in line | empty line
|
||||
if m.nil? || l.size == m[0].size || l.size == 0
|
||||
next # SKIP no match or line is only spaces
|
||||
else # no match | only spaces in line | empty line
|
||||
m_str_length = m[0].size
|
||||
if m_str_length <= 1 # minimum space is 1 or nothing we can break we found our minimum
|
||||
min_space = m_str_length
|
||||
break #stop iteration
|
||||
end
|
||||
min_space = m_str_length if m_str_length < min_space
|
||||
else
|
||||
next # SKIP no match or line is only spaces
|
||||
end
|
||||
end
|
||||
a_lines.each do |l|
|
||||
|
Reference in New Issue
Block a user