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
8f944bb9
Commit
8f944bb9
authored
Sep 18, 2019
by
Tetiana Chupryna
Committed by
James Lopez
Sep 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Remove duplication of Licenses in Dependency List page"
parent
147ad7a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
ee/changelogs/unreleased/32035-bug-dedup-licenses-dl.yml
ee/changelogs/unreleased/32035-bug-dedup-licenses-dl.yml
+5
-0
ee/lib/gitlab/ci/reports/dependency_list/report.rb
ee/lib/gitlab/ci/reports/dependency_list/report.rb
+1
-0
ee/spec/lib/gitlab/ci/reports/dependency_list/report_spec.rb
ee/spec/lib/gitlab/ci/reports/dependency_list/report_spec.rb
+47
-0
No files found.
ee/changelogs/unreleased/32035-bug-dedup-licenses-dl.yml
0 → 100644
View file @
8f944bb9
---
title
:
Remove duplication of Licenses in Dependency List page
merge_request
:
16946
author
:
type
:
fixed
ee/lib/gitlab/ci/reports/dependency_list/report.rb
View file @
8f944bb9
...
...
@@ -18,6 +18,7 @@ module Gitlab
def
apply_license
(
license
)
dependencies
.
each
do
|
dependency
|
next
unless
dependency
[
:name
]
==
license
[
:dependency
][
:name
]
next
if
dependency
[
:licenses
].
include?
(
license
[
:license
])
dependency
[
:licenses
]
<<
license
[
:license
]
end
...
...
ee/spec/lib/gitlab/ci/reports/dependency_list/report_spec.rb
View file @
8f944bb9
...
...
@@ -16,4 +16,51 @@ describe Gitlab::Ci::Reports::DependencyList::Report do
expect
(
report
.
dependencies
).
to
eq
([
dependency
])
end
end
describe
'#apply_license'
do
subject
{
report
.
dependencies
.
last
[
:licenses
].
size
}
let
(
:license
)
do
{
dependency:
{
name:
'nokogiri'
},
license:
{
name:
'MIT'
,
url:
'http://opensource.org/licenses/mit-license'
}
}
end
before
do
report
.
add_dependency
(
dependency
)
report
.
apply_license
(
license
)
end
context
'with matching dependency'
do
context
'with empty license list'
do
let
(
:dependency
)
{
build
:dependency
}
it
'applies license'
do
is_expected
.
to
eq
(
1
)
end
end
context
'with full license list'
do
let
(
:dependency
)
{
build
:dependency
,
:with_licenses
}
it
'does not apply the license a second time'
do
is_expected
.
to
eq
(
1
)
end
end
end
context
'without matching dependency'
do
let
(
:dependency
)
{
build
:dependency
,
name:
'irigokon'
}
it
'does not apply the license at all'
do
is_expected
.
to
eq
(
0
)
end
end
end
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