debian-mirror-gitlab/lib/gitlab/ci/parsers.rb

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

35 lines
1.1 KiB
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
module Gitlab
module Ci
module Parsers
ParserNotFoundError = Class.new(ParserError)
def self.parsers
{
2020-04-08 14:13:33 +05:30
junit: ::Gitlab::Ci::Parsers::Test::Junit,
2020-05-24 23:13:21 +05:30
cobertura: ::Gitlab::Ci::Parsers::Coverage::Cobertura,
terraform: ::Gitlab::Ci::Parsers::Terraform::Tfplan,
2021-02-22 17:27:13 +05:30
accessibility: ::Gitlab::Ci::Parsers::Accessibility::Pa11y,
2021-10-27 15:23:28 +05:30
codequality: ::Gitlab::Ci::Parsers::Codequality::CodeClimate,
sast: ::Gitlab::Ci::Parsers::Security::Sast,
2022-08-27 11:52:29 +05:30
secret_detection: ::Gitlab::Ci::Parsers::Security::SecretDetection,
cyclonedx: ::Gitlab::Ci::Parsers::Sbom::Cyclonedx
2019-02-15 15:39:39 +05:30
}
end
2021-06-08 01:23:25 +05:30
def self.fabricate!(file_type, *args, **kwargs)
parsers.fetch(file_type.to_sym).new(*args, **kwargs)
2019-02-15 15:39:39 +05:30
rescue KeyError
raise ParserNotFoundError, "Cannot find any parser matching file type '#{file_type}'"
end
2021-03-11 19:13:27 +05:30
def self.instrument!
parsers.values.each { |parser_class| parser_class.prepend(Parsers::Instrumentation) }
end
2019-02-15 15:39:39 +05:30
end
end
end
2020-05-24 23:13:21 +05:30
2021-06-08 01:23:25 +05:30
Gitlab::Ci::Parsers.prepend_mod_with('Gitlab::Ci::Parsers')