debian-mirror-gitlab/lib/gitlab/ci/reports/security/finding_key.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1,015 B
Ruby
Raw Normal View History

2021-10-27 15:23:28 +05:30
# frozen_string_literal: true
module Gitlab
module Ci
module Reports
module Security
class FindingKey
def initialize(location_fingerprint:, identifier_fingerprint:)
@location_fingerprint = location_fingerprint
@identifier_fingerprint = identifier_fingerprint
end
def ==(other)
2022-04-04 11:22:00 +05:30
return false unless other.is_a?(self.class)
2021-10-27 15:23:28 +05:30
has_fingerprints? && other.has_fingerprints? &&
location_fingerprint == other.location_fingerprint &&
identifier_fingerprint == other.identifier_fingerprint
end
def hash
location_fingerprint.hash ^ identifier_fingerprint.hash
end
alias_method :eql?, :==
protected
attr_reader :location_fingerprint, :identifier_fingerprint
def has_fingerprints?
location_fingerprint.present? && identifier_fingerprint.present?
end
end
end
end
end
end