summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--danger/roulette/Dangerfile3
-rw-r--r--lib/gitlab/danger/helper.rb4
-rw-r--r--spec/lib/gitlab/danger/helper_spec.rb7
3 files changed, 13 insertions, 1 deletions
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile
index 5c3d7a4ca49..6cf54d0f854 100644
--- a/danger/roulette/Dangerfile
+++ b/danger/roulette/Dangerfile
@@ -53,6 +53,9 @@ def build_list(items)
end
changes = helper.changes_by_category
+
+# Ignore any files that are known but uncategoried. Prompt for any unknown files
+changes.delete(:none)
categories = changes.keys - [:unknown]
unless changes.empty?
diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb
index b8428637e19..0f3f5cb3c08 100644
--- a/lib/gitlab/danger/helper.rb
+++ b/lib/gitlab/danger/helper.rb
@@ -95,6 +95,7 @@ module Gitlab
CATEGORY_LABELS = {
docs: "~Documentation",
+ none: "",
qa: "~QA"
}.freeze
@@ -120,6 +121,9 @@ module Gitlab
%r{\A(ee/)?db/} => :database,
%r{\A(ee/)?qa/} => :qa,
+ # Files that don't fit into any category are marked with :none
+ %r{\A(ee/)?changelogs/} => :none,
+
# Fallbacks in case the above patterns miss anything
%r{\.rb\z} => :backend,
%r{\.(md|txt)\z} => :docs,
diff --git a/spec/lib/gitlab/danger/helper_spec.rb b/spec/lib/gitlab/danger/helper_spec.rb
index ac3e4b04230..793cac593a2 100644
--- a/spec/lib/gitlab/danger/helper_spec.rb
+++ b/spec/lib/gitlab/danger/helper_spec.rb
@@ -184,7 +184,7 @@ describe Gitlab::Danger::Helper do
describe '#changes_by_category' do
it 'categorizes changed files' do
- expect(fake_git).to receive(:added_files) { %w[foo foo.md foo.rb foo.js db/foo qa/foo] }
+ expect(fake_git).to receive(:added_files) { %w[foo foo.md foo.rb foo.js db/foo qa/foo ee/changelogs/foo.yml] }
allow(fake_git).to receive(:modified_files) { [] }
allow(fake_git).to receive(:renamed_files) { [] }
@@ -193,6 +193,7 @@ describe Gitlab::Danger::Helper do
database: %w[db/foo],
docs: %w[foo.md],
frontend: %w[foo.js],
+ none: %w[ee/changelogs/foo.yml],
qa: %w[qa/foo],
unknown: %w[foo]
)
@@ -260,6 +261,9 @@ describe Gitlab::Danger::Helper do
'ee/db/foo' | :database
'ee/qa/foo' | :qa
+ 'changelogs/foo' | :none
+ 'ee/changelogs/foo' | :none
+
'FOO' | :unknown
'foo' | :unknown
@@ -283,6 +287,7 @@ describe Gitlab::Danger::Helper do
:docs | '~Documentation'
:foo | '~foo'
:frontend | '~frontend'
+ :none | ''
:qa | '~QA'
end