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