summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/parsers/security/concerns/deprecated_syntax.rb
blob: 24613a441be2d849132ae2c384619fb5e598ff57 (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
35
36
# frozen_string_literal: true

module Gitlab
  module Ci
    module Parsers
      module Security
        module Concerns
          module DeprecatedSyntax
            extend ActiveSupport::Concern

            included do
              extend ::Gitlab::Utils::Override

              override :parse_report
            end

            def report_data
              @report_data ||= begin
                data = super

                if data.is_a?(Array)
                  data = {
                    "version" => self.class::DEPRECATED_REPORT_VERSION,
                    "vulnerabilities" => data
                  }
                end

                data
              end
            end
          end
        end
      end
    end
  end
end