Commit 3153edd5 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'pl-fix-overcommit-false-positives' into 'master'

Prefer squiggly heredoc in specs for conflicts

See merge request gitlab-org/gitlab!24260
parents 2e6667dd 9d1871b8
#!/bin/sh
output=`git grep -En '^<<<<<<< ' -- . ':(exclude)spec/lib/gitlab/conflict/file_spec.rb' ':(exclude)spec/lib/gitlab/git/conflict/parser_spec.rb'`
output=`git grep -En '^<<<<<<< '`
echo $output
test -z "$output"
......@@ -153,47 +153,47 @@ describe Gitlab::Conflict::File do
context 'with an example file' do
let(:raw_conflict_content) do
<<FILE
<<~FILE
# Ensure there is no match line header here
def username_regexp
default_regexp
end
<<<<<<< files/ruby/regex.rb
def project_name_regexp
<<<<<<< files/ruby/regex.rb
def project_name_regexp
/\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
end
end
def name_regexp
def name_regexp
/\A[a-zA-Z0-9_\-\. ]*\z/
=======
def project_name_regex
=======
def project_name_regex
%r{\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z}
end
end
def name_regex
def name_regex
%r{\A[a-zA-Z0-9_\-\. ]*\z}
>>>>>>> files/ruby/regex.rb
end
>>>>>>> files/ruby/regex.rb
end
# Some extra lines
# To force a match line
# To be created
# Some extra lines
# To force a match line
# To be created
def path_regexp
def path_regexp
default_regexp
end
end
<<<<<<< files/ruby/regex.rb
def archive_formats_regexp
<<<<<<< files/ruby/regex.rb
def archive_formats_regexp
/(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
=======
def archive_formats_regex
=======
def archive_formats_regex
%r{(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)}
>>>>>>> files/ruby/regex.rb
end
>>>>>>> files/ruby/regex.rb
end
def git_reference_regexp
def git_reference_regexp
# Valid git ref regexp, see:
# https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
%r{
......@@ -213,19 +213,19 @@ def git_reference_regexp
(?<!\.lock) (?# rule #1)
(?<![\/.]) (?# rule #6-7)
}x
end
end
protected
protected
<<<<<<< files/ruby/regex.rb
def default_regexp
<<<<<<< files/ruby/regex.rb
def default_regexp
/\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
=======
def default_regex
=======
def default_regex
%r{\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z}
>>>>>>> files/ruby/regex.rb
end
FILE
>>>>>>> files/ruby/regex.rb
end
FILE
end
let(:sections) { conflict_file.sections }
......
......@@ -10,8 +10,8 @@ describe Gitlab::Git::Conflict::Parser do
context 'when the file has valid conflicts' do
let(:text) do
<<CONFLICT
module Gitlab
<<~CONFLICT
module Gitlab
module Regexp
extend self
......@@ -19,34 +19,34 @@ module Gitlab
default_regexp
end
<<<<<<< files/ruby/regex.rb
<<<<<<< files/ruby/regex.rb
def project_name_regexp
/\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
end
def name_regexp
/\A[a-zA-Z0-9_\-\. ]*\z/
=======
=======
def project_name_regex
%r{\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z}
end
def name_regex
%r{\A[a-zA-Z0-9_\-\. ]*\z}
>>>>>>> files/ruby/regex.rb
>>>>>>> files/ruby/regex.rb
end
def path_regexp
default_regexp
end
<<<<<<< files/ruby/regex.rb
<<<<<<< files/ruby/regex.rb
def archive_formats_regexp
/(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
=======
=======
def archive_formats_regex
%r{(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)}
>>>>>>> files/ruby/regex.rb
>>>>>>> files/ruby/regex.rb
end
def git_reference_regexp
......@@ -73,17 +73,17 @@ module Gitlab
protected
<<<<<<< files/ruby/regex.rb
<<<<<<< files/ruby/regex.rb
def default_regexp
/\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
=======
=======
def default_regex
%r{\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z}
>>>>>>> files/ruby/regex.rb
>>>>>>> files/ruby/regex.rb
end
end
end
CONFLICT
end
CONFLICT
end
let(:lines) do
......
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