diff options
author | Robert Speicher <robert@gitlab.com> | 2016-07-08 16:34:53 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-07-08 16:34:53 +0000 |
commit | 989a9607e6bf63888b8856eb58a1c8e3e65e3604 (patch) | |
tree | cf77897da1e2283f74e178b373c69e2098c3a0b3 /lib | |
parent | 140a706e96220ef1dab9ba220d86531ca5d46058 (diff) | |
parent | 4c388fb86500a2691c7b584ffafcbac18d643cab (diff) | |
download | gitlab-ce-989a9607e6bf63888b8856eb58a1c8e3e65e3604.tar.gz |
Merge branch 'rubocop/enable-identical-conditional-branches-cop' into 'master'
Enable Style/IdenticalConditionalBranches Rubocop cop
## What does this MR do?
This MR enables Rubocop cop that checks for identical lines at the end of each branch of a conditional statement.
Examples:
```ruby
@bad
if condition
do_x
do_z
else
do_y
do_z
end
@good
if condition
do_x
else
do_y
end
do_z
```
## What are the relevant issue numbers?
#17478
See merge request !5011
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rouge/formatters/html_gitlab.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/rouge/formatters/html_gitlab.rb b/lib/rouge/formatters/html_gitlab.rb index 8c309efc7b8..3358ed6773e 100644 --- a/lib/rouge/formatters/html_gitlab.rb +++ b/lib/rouge/formatters/html_gitlab.rb @@ -143,18 +143,14 @@ module Rouge '</span>' end end - lines.join("\n") - else - if @linenos == 'inline' - lines = lines.each_with_index.map do |line, index| - number = index + @linenostart - "<span class=\"linenos\">#{number}</span>#{line}" - end - lines.join("\n") - else - lines.join("\n") + elsif @linenos == 'inline' + lines = lines.each_with_index.map do |line, index| + number = index + @linenostart + "<span class=\"linenos\">#{number}</span>#{line}" end end + + lines.join("\n") end def span(tok, val) |