2022-08-27 11:52:29 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
module Reports
|
|
|
|
module Sbom
|
|
|
|
class Report
|
|
|
|
attr_reader :components, :source, :errors
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
@components = []
|
|
|
|
@errors = []
|
|
|
|
end
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
def valid?
|
|
|
|
errors.empty?
|
|
|
|
end
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
def add_error(error)
|
|
|
|
errors << error
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_source(source)
|
2022-10-11 01:57:18 +05:30
|
|
|
self.source = source
|
2022-08-27 11:52:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def add_component(component)
|
2022-10-11 01:57:18 +05:30
|
|
|
components << component
|
2022-08-27 11:52:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
attr_writer :source
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|