debian-mirror-gitlab/lib/gitlab/ci/parsers/sbom/source/dependency_scanning.rb

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

45 lines
915 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# 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?
2022-10-11 01:57:18 +05:30
::Gitlab::Ci::Reports::Sbom::Source.new(
type: :dependency_scanning,
2022-11-25 23:54:43 +05:30
data: data
2022-10-11 01:57:18 +05:30
)
2022-08-27 11:52:29 +05:30
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