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:
Loïc Guitaut
2023-02-16 10:40:11 +01:00
committed by Loïc Guitaut
parent 87de3c2319
commit f7c57fbc19
56 changed files with 137 additions and 142 deletions

View File

@ -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|