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
bd2d5587
Commit
bd2d5587
authored
Mar 12, 2020
by
celdem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix severity level sorting without changing test
parent
2823acc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
ee/app/services/security/dependency_list_service.rb
ee/app/services/security/dependency_list_service.rb
+2
-2
ee/spec/controllers/projects/dependencies_controller_spec.rb
ee/spec/controllers/projects/dependencies_controller_spec.rb
+1
-1
No files found.
ee/app/services/security/dependency_list_service.rb
View file @
bd2d5587
...
@@ -72,8 +72,8 @@ module Security
...
@@ -72,8 +72,8 @@ module Security
# will have highest severity
# will have highest severity
def
sort_by_severity
(
collection
)
def
sort_by_severity
(
collection
)
collection
.
sort
do
|
dep_i
,
dep_j
|
collection
.
sort
do
|
dep_i
,
dep_j
|
level_i
=
dep_i
.
dig
(
:vulnerabilities
,
0
,
:severity
)
||
:
unknown
level_i
=
dep_i
.
dig
(
:vulnerabilities
,
0
,
:severity
)
||
:
info
level_j
=
dep_j
.
dig
(
:vulnerabilities
,
0
,
:severity
)
||
:
unknown
level_j
=
dep_j
.
dig
(
:vulnerabilities
,
0
,
:severity
)
||
:
info
::
Vulnerabilities
::
Occurrence
::
SEVERITY_LEVELS
[
level_j
]
<=>
::
Vulnerabilities
::
Occurrence
::
SEVERITY_LEVELS
[
level_i
]
::
Vulnerabilities
::
Occurrence
::
SEVERITY_LEVELS
[
level_j
]
<=>
::
Vulnerabilities
::
Occurrence
::
SEVERITY_LEVELS
[
level_i
]
end
end
...
...
ee/spec/controllers/projects/dependencies_controller_spec.rb
View file @
bd2d5587
...
@@ -117,7 +117,7 @@ describe Projects::DependenciesController do
...
@@ -117,7 +117,7 @@ describe Projects::DependenciesController do
it
'returns sorted list'
do
it
'returns sorted list'
do
expect
(
json_response
[
'dependencies'
].
first
[
'name'
]).
to
eq
(
'nokogiri'
)
expect
(
json_response
[
'dependencies'
].
first
[
'name'
]).
to
eq
(
'nokogiri'
)
expect
(
json_response
[
'dependencies'
].
second
[
'name'
]).
to
eq
(
'
mini_portile2
'
)
expect
(
json_response
[
'dependencies'
].
second
[
'name'
]).
to
eq
(
'
debug
'
)
end
end
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