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
d5dcf9ab
Commit
d5dcf9ab
authored
Jul 16, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve danger/specs/Dangerfile by not requiring new specs if specific labels are applied
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
d4bf33dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
danger/specs/Dangerfile
danger/specs/Dangerfile
+10
-4
No files found.
danger/specs/Dangerfile
View file @
d5dcf9ab
NO_SPECS_LABELS
=
%w[backstage Documentation QA]
.
freeze
NO_NEW_SPEC_MESSAGE
=
<<~
MSG
.
freeze
You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
but please consider adding
the ~backstage label in that case
.
but please consider adding
any of the %<labels>s labels
.
MSG
def
presented_no_changelog_labels
NO_SPECS_LABELS
.
map
{
|
label
|
"~
#{
label
}
"
}.
join
(
', '
)
end
has_app_changes
=
!
git
.
modified_files
.
grep
(
%r{
\A
(ee/)?(app|lib|db/(geo/)?(post_)?migrate)/}
).
empty?
has_spec_changes
=
!
git
.
modified_files
.
grep
(
/spec/
).
empty?
has_spec_changes
=
!
git
.
modified_files
.
grep
(
%r{
\A
(ee/)?spec/}
).
empty?
new_specs_needed
=
(
gitlab
.
mr_labels
&
NO_SPECS_LABELS
).
empty?
if
has_app_changes
&&
!
has_spec_changes
warn
NO_NEW_SPEC_MESSAGE
,
sticky:
false
if
has_app_changes
&&
!
has_spec_changes
&&
new_specs_needed
warn
format
(
NO_NEW_SPEC_MESSAGE
,
labels:
presented_no_changelog_labels
)
,
sticky:
false
end
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