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
99ba0bc7
Commit
99ba0bc7
authored
Jun 30, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow files to belong to multiple categories in the roulette
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
91895122
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
129 additions
and
123 deletions
+129
-123
lib/gitlab/danger/helper.rb
lib/gitlab/danger/helper.rb
+11
-8
spec/lib/gitlab/danger/helper_spec.rb
spec/lib/gitlab/danger/helper_spec.rb
+118
-115
No files found.
lib/gitlab/danger/helper.rb
View file @
99ba0bc7
...
@@ -73,16 +73,16 @@ module Gitlab
...
@@ -73,16 +73,16 @@ module Gitlab
# @return [Hash<String,Array<String>>]
# @return [Hash<String,Array<String>>]
def
changes_by_category
def
changes_by_category
all_changed_files
.
each_with_object
(
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
})
do
|
file
,
hash
|
all_changed_files
.
each_with_object
(
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
})
do
|
file
,
hash
|
hash
[
category_for_file
(
file
)]
<<
file
categories_for_file
(
file
).
each
{
|
category
|
hash
[
category
]
<<
file
}
end
end
end
end
# Determines the categor
y a file is in, e.g., `:frontend` or `:backend`
# Determines the categor
ies a file is in, e.g., `[:frontend]`, `[:backend]`, or `%i[frontend engineering_productivity]`.
# @return
[Symbol]
# @return
Array<Symbol>
def
categor
y
_for_file
(
file
)
def
categor
ies
_for_file
(
file
)
_
,
categor
y
=
CATEGORIES
.
find
{
|
regexp
,
_
|
regexp
.
match?
(
file
)
}
_
,
categor
ies
=
CATEGORIES
.
find
{
|
regexp
,
_
|
regexp
.
match?
(
file
)
}
category
||
:unknown
Array
(
categories
||
:unknown
)
end
end
# Returns the GFM for a category label, making its best guess if it's not
# Returns the GFM for a category label, making its best guess if it's not
...
@@ -125,10 +125,13 @@ module Gitlab
...
@@ -125,10 +125,13 @@ module Gitlab
jest
\.
config
\.
js |
jest
\.
config
\.
js |
package
\.
json |
package
\.
json |
yarn
\.
lock |
yarn
\.
lock |
config/.+
\.
js |
config/.+
\.
js
\.
gitlab/ci/frontend
\.
gitlab-ci
\.
yml
)
\z
}x
=>
:frontend
,
)
\z
}x
=>
:frontend
,
%r{(
\A
|/)(
\.
gitlab/ci/frontend
\.
gitlab-ci
\.
yml
)
\z
}x
=>
%i[frontend engineering_productivity]
,
%r{
\A
(ee/)?db/(?!fixtures)[^/]+}
=>
:database
,
%r{
\A
(ee/)?db/(?!fixtures)[^/]+}
=>
:database
,
%r{
\A
(ee/)?lib/gitlab/(database|background_migration|sql|github_import)(/|
\.
rb)}
=>
:database
,
%r{
\A
(ee/)?lib/gitlab/(database|background_migration|sql|github_import)(/|
\.
rb)}
=>
:database
,
%r{
\A
(app/models/project_authorization|app/services/users/refresh_authorized_projects_service)(/|
\.
rb)}
=>
:database
,
%r{
\A
(app/models/project_authorization|app/services/users/refresh_authorized_projects_service)(/|
\.
rb)}
=>
:database
,
...
...
spec/lib/gitlab/danger/helper_spec.rb
View file @
99ba0bc7
This diff is collapsed.
Click to expand it.
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