Commit 89fbeb81 authored by Kerri Miller's avatar Kerri Miller

Extract #skip? to DRY things up

parent 8df499ce
...@@ -49,8 +49,8 @@ module Gitlab ...@@ -49,8 +49,8 @@ module Gitlab
data.lines.each do |line| data.lines.each do |line|
line = line.strip line = line.strip
next unless line.present?
next if line.starts_with?('#') next if skip?(line)
pattern, _separator, owners = line.partition(/(?<!\\)\s+/) pattern, _separator, owners = line.partition(/(?<!\\)\s+/)
...@@ -70,8 +70,8 @@ module Gitlab ...@@ -70,8 +70,8 @@ module Gitlab
data.lines.each do |line| data.lines.each do |line|
line = line.strip line = line.strip
next unless line.present?
next if line.starts_with?('#') next if skip?(line)
if line.starts_with?('[') && line.end_with?(']') if line.starts_with?('[') && line.end_with?(']')
section = line[1...-1].downcase section = line[1...-1].downcase
...@@ -93,6 +93,13 @@ module Gitlab ...@@ -93,6 +93,13 @@ module Gitlab
parsed parsed
end end
def skip?(line)
return true unless line.present?
return true if line.starts_with?('#')
false
end
def normalize_pattern(pattern) def normalize_pattern(pattern)
# Remove `\` when escaping `\#` # Remove `\` when escaping `\#`
pattern = pattern.sub(/\A\\#/, '#') pattern = pattern.sub(/\A\\#/, '#')
......
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