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
634e65e9
Commit
634e65e9
authored
Sep 10, 2019
by
Elan Ruusamäe
Committed by
Nick Thomas
Sep 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Danger: Allow fixup commits if squash enabled or MR is WIP
parent
6a0d160f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
danger/commit_messages/Dangerfile
danger/commit_messages/Dangerfile
+28
-1
No files found.
danger/commit_messages/Dangerfile
View file @
634e65e9
...
@@ -88,9 +88,36 @@ def lint_commit(commit) # rubocop:disable Metrics/AbcSize
...
@@ -88,9 +88,36 @@ def lint_commit(commit) # rubocop:disable Metrics/AbcSize
# We ignore revert commits as they are well structured by Git already
# We ignore revert commits as they are well structured by Git already
return
false
if
commit
.
message
.
start_with?
(
'Revert "'
)
return
false
if
commit
.
message
.
start_with?
(
'Revert "'
)
is_squash
=
gitlab
.
mr_json
[
'squash'
]
is_wip
=
gitlab
.
mr_json
[
'work_in_progress'
]
is_fixup
=
commit
.
message
.
start_with?
(
'fixup!'
,
'squash!'
)
if
is_fixup
# The MR is set to squash - Danger adds an informative notice
# The MR is not set to squash - Danger fails. if also WIP warn only, not error
if
is_squash
return
false
end
if
is_wip
warn_commit
(
commit
,
'Squash or Fixup commits must be squashed before merge, or enable squash merge option'
)
else
fail_commit
(
commit
,
'Squash or Fixup commits must be squashed before merge, or enable squash merge option'
)
end
# Makes no sense to process other rules for fixup commits, they trigger just more noise
return
false
end
# Fail if a suggestion commit is used and squash is not enabled
# Fail if a suggestion commit is used and squash is not enabled
if
commit
.
message
.
start_with?
(
'Apply suggestion to'
)
if
commit
.
message
.
start_with?
(
'Apply suggestion to'
)
if
gitlab
.
mr_json
[
'squash'
]
if
is_squash
return
false
return
false
else
else
fail_commit
(
fail_commit
(
...
...
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