Welcome to mirror list, hosted at ThFree Co, Russian Federation.

flag.rb « security « reports « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e6cc758864beca733328dcfdb1348c9625cf409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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

          def to_hash
            {
              flag_type: flag_type,
              origin: origin,
              description: description
            }.compact
          end
        end
      end
    end
  end
end