diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-21 18:16:48 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 09:31:57 -0600 |
commit | ccbebbdfeb9ce78c0a386ae08ae88aeb7dc5ad86 (patch) | |
tree | 5682d86e241733bd1bca2289ec063e4fde5e7414 /lib | |
parent | 215228b477e9dae8cf3ba36af767ae12d4328e28 (diff) | |
download | gitlab-ce-ccbebbdfeb9ce78c0a386ae08ae88aeb7dc5ad86.tar.gz |
Enable Performance/RedundantMatch
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/api/helpers.rb | 2 | ||||
-rw-r--r-- | lib/extracts_path.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/diff/highlight.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/diff/parser.rb | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb index 654bddf7d18..a2e6387dbe5 100644 --- a/lib/ci/api/helpers.rb +++ b/lib/ci/api/helpers.rb @@ -60,7 +60,7 @@ module Ci end def build_not_found! - if headers['User-Agent'].to_s.match(/gitlab-ci-multi-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /) + if headers['User-Agent'].to_s =~ /gitlab-ci-multi-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? / no_content! else not_found! diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index 82551f1f222..1a6ad039bc0 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -42,7 +42,7 @@ module ExtractsPath return pair unless @project - if id.match(/^([[:alnum:]]{40})(.+)/) + if id =~ /^([[:alnum:]]{40})(.+)/ # If the ref appears to be a SHA, we're done, just split the string pair = $~.captures else diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb index 9ea976e18fa..7db896522a9 100644 --- a/lib/gitlab/diff/highlight.rb +++ b/lib/gitlab/diff/highlight.rb @@ -50,7 +50,7 @@ module Gitlab # Only update text if line is found. This will prevent # issues with submodules given the line only exists in diff content. if rich_line - line_prefix = diff_line.text.match(/\A(.)/) ? $1 : ' ' + line_prefix = diff_line.text =~ /\A(.)/ ? $1 : ' ' "#{line_prefix}#{rich_line}".html_safe end end diff --git a/lib/gitlab/diff/parser.rb b/lib/gitlab/diff/parser.rb index 89320f5d9dc..8f844224a7a 100644 --- a/lib/gitlab/diff/parser.rb +++ b/lib/gitlab/diff/parser.rb @@ -20,7 +20,7 @@ module Gitlab full_line = line.delete("\n") - if line.match(/^@@ -/) + if line =~ /^@@ -/ type = "match" line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0 |