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
48eee2ec
Commit
48eee2ec
authored
Apr 02, 2020
by
celdem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused occurrence methods
parent
00286b2f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
42 deletions
+0
-42
ee/lib/gitlab/ci/reports/security/occurrence.rb
ee/lib/gitlab/ci/reports/security/occurrence.rb
+0
-13
ee/spec/lib/gitlab/ci/reports/security/occurrence_spec.rb
ee/spec/lib/gitlab/ci/reports/security/occurrence_spec.rb
+0
-29
No files found.
ee/lib/gitlab/ci/reports/security/occurrence.rb
View file @
48eee2ec
...
...
@@ -65,19 +65,6 @@ module Gitlab
@location
=
new_location
end
def
==
(
other
)
other
.
report_type
==
report_type
&&
other
.
location
==
location
&&
other
.
primary_identifier
==
primary_identifier
end
# Array.difference (-) method uses hash and eq? methods to do comparison
def
hash
compare_key
.
hash
end
alias_method
:eql?
,
:==
# eql? is necessary in some cases like array intersection
private
def
generate_project_fingerprint
...
...
ee/spec/lib/gitlab/ci/reports/security/occurrence_spec.rb
View file @
48eee2ec
...
...
@@ -128,33 +128,4 @@ describe Gitlab::Ci::Reports::Security::Occurrence do
expect
(
occurrence
.
old_location
).
to
eq
(
old_location
)
end
end
describe
'#== and eql?'
do
using
RSpec
::
Parameterized
::
TableSyntax
let
(
:identifier
)
{
create
(
:ci_reports_security_identifier
)
}
let
(
:other_identifier
)
{
create
(
:ci_reports_security_identifier
,
external_type:
'other_identifier'
)
}
let
(
:location
)
{
create
(
:ci_reports_security_locations_sast
)
}
let
(
:other_location
)
{
create
(
:ci_reports_security_locations_sast
,
file_path:
'other/file.rb'
)
}
where
(
:report_type_1
,
:location_1
,
:identifier_1
,
:report_type_2
,
:location_2
,
:identifier_2
,
:equal
,
:case_name
)
do
'sast'
|
->
{
location
}
|
->
{
identifier
}
|
'sast'
|
->
{
location
}
|
->
{
identifier
}
|
true
|
'when report_type, location and primary identifier are equal'
'sast'
|
->
{
location
}
|
->
{
identifier
}
|
'dependency_scanning'
|
->
{
location
}
|
->
{
identifier
}
|
false
|
'when report_type is different'
'sast'
|
->
{
location
}
|
->
{
identifier
}
|
'sast'
|
->
{
other_location
}
|
->
{
identifier
}
|
false
|
'when location is different'
'sast'
|
->
{
location
}
|
->
{
identifier
}
|
'sast'
|
->
{
location
}
|
->
{
other_identifier
}
|
false
|
'when primary identifier is different'
end
with_them
do
let
(
:occurrence_1
)
{
create
(
:ci_reports_security_occurrence
,
report_type:
report_type_1
,
location:
location_1
.
call
,
identifiers:
[
identifier_1
.
call
])
}
let
(
:occurrence_2
)
{
create
(
:ci_reports_security_occurrence
,
report_type:
report_type_2
,
location:
location_2
.
call
,
identifiers:
[
identifier_2
.
call
])
}
it
"returns
#{
params
[
:equal
]
}
for =="
do
expect
(
occurrence_1
==
occurrence_2
).
to
eq
(
equal
)
end
it
"returns
#{
params
[
:equal
]
}
for eq?"
do
expect
(
occurrence_1
.
eql?
(
occurrence_2
)).
to
eq
(
equal
)
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