diff options
Diffstat (limited to 'lib/gitlab/ci/reports/security/flag.rb')
-rw-r--r-- | lib/gitlab/ci/reports/security/flag.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/gitlab/ci/reports/security/flag.rb b/lib/gitlab/ci/reports/security/flag.rb new file mode 100644 index 00000000000..7e6cc758864 --- /dev/null +++ b/lib/gitlab/ci/reports/security/flag.rb @@ -0,0 +1,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 |