Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ae977e90
Commit
ae977e90
authored
Jul 16, 2020
by
Alina Mihaila
Committed by
Rémy Coutable
Jul 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sanitize MR title for
parent
fb15ee16
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
lib/gitlab/danger/helper.rb
lib/gitlab/danger/helper.rb
+2
-1
spec/lib/gitlab/danger/helper_spec.rb
spec/lib/gitlab/danger/helper_spec.rb
+5
-0
No files found.
lib/gitlab/danger/helper.rb
View file @
ae977e90
...
...
@@ -6,6 +6,7 @@ module Gitlab
module
Danger
module
Helper
RELEASE_TOOLS_BOT
=
'gitlab-release-tools-bot'
DRAFT_REGEX
=
/\A*
#{
Regexp
.
union
(
/(?i)(\[WIP\]\s*|WIP:\s*|WIP$)/
,
/(?i)(\[draft\]|\(draft\)|draft:|draft\s\-\s|draft$)/
)
}
+\s*/i
.
freeze
# Returns a list of all files that have been added, modified or renamed.
# `git.modified_files` might contain paths that already have been renamed,
...
...
@@ -210,7 +211,7 @@ module Gitlab
end
def
sanitize_mr_title
(
title
)
title
.
gsub
(
/^WIP: */
,
''
).
gsub
(
/`/
,
'\\\`'
)
title
.
gsub
(
DRAFT_REGEX
,
''
).
gsub
(
/`/
,
'\\\`'
)
end
def
security_mr?
...
...
spec/lib/gitlab/danger/helper_spec.rb
View file @
ae977e90
...
...
@@ -363,6 +363,11 @@ RSpec.describe Gitlab::Danger::Helper do
where
(
:mr_title
,
:expected_mr_title
)
do
'My MR title'
|
'My MR title'
'WIP: My MR title'
|
'My MR title'
'Draft: My MR title'
|
'My MR title'
'(Draft) My MR title'
|
'My MR title'
'[Draft] My MR title'
|
'My MR title'
'[DRAFT] My MR title'
|
'My MR title'
'DRAFT: My MR title'
|
'My MR title'
end
with_them
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment