2021-11-11 11:23:49 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
module Reports
|
|
|
|
module Security
|
|
|
|
class Flag
|
|
|
|
attr_reader :type, :origin, :description
|
|
|
|
|
|
|
|
MAP = { 'flagged-as-likely-false-positive' => :false_positive }.freeze
|
|
|
|
DEFAULT_FLAG_TYPE = :false_positive
|
|
|
|
|
|
|
|
def flag_type
|
|
|
|
MAP.fetch(type, DEFAULT_FLAG_TYPE)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(type: nil, origin: nil, description: nil)
|
|
|
|
@type = type
|
|
|
|
@origin = origin
|
|
|
|
@description = description
|
|
|
|
end
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
def to_h
|
2021-11-11 11:23:49 +05:30
|
|
|
{
|
|
|
|
flag_type: flag_type,
|
|
|
|
origin: origin,
|
|
|
|
description: description
|
|
|
|
}.compact
|
|
|
|
end
|
2023-01-13 00:05:48 +05:30
|
|
|
|
|
|
|
def false_positive?
|
|
|
|
flag_type == :false_positive
|
|
|
|
end
|
2021-11-11 11:23:49 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|