debian-mirror-gitlab/lib/gitlab/ci/parsers/sbom/source/dependency_scanning.rb
2022-11-25 23:54:43 +05:30

44 lines
915 B
Ruby

# frozen_string_literal: true
module Gitlab
module Ci
module Parsers
module Sbom
module Source
class DependencyScanning
REQUIRED_ATTRIBUTES = [
%w[input_file path]
].freeze
def self.source(...)
new(...).source
end
def initialize(data)
@data = data
end
def source
return unless required_attributes_present?
::Gitlab::Ci::Reports::Sbom::Source.new(
type: :dependency_scanning,
data: data
)
end
private
attr_reader :data
def required_attributes_present?
REQUIRED_ATTRIBUTES.all? do |keys|
data.dig(*keys).present?
end
end
end
end
end
end
end
end