Commit bade5525 authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Douglas Barbosa Alexandre

Rename parser namespace

Use License Compliance feature name
parent 80e49607
......@@ -9,7 +9,7 @@ module EE
class_methods do
def parsers
super.merge({
license_management: ::Gitlab::Ci::Parsers::LicenseManagement::LicenseManagement,
license_management: ::Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning,
dependency_scanning: ::Gitlab::Ci::Parsers::Security::DependencyScanning,
container_scanning: ::Gitlab::Ci::Parsers::Security::ContainerScanning,
dast: ::Gitlab::Ci::Parsers::Security::Dast,
......
......@@ -3,11 +3,11 @@
module Gitlab
module Ci
module Parsers
module LicenseManagement
class LicenseManagement
LicenseManagementParserError = Class.new(Gitlab::Ci::Parsers::ParserError)
module LicenseCompliance
class LicenseScanning
LicenseScanningParserError = Class.new(Gitlab::Ci::Parsers::ParserError)
def parse!(json_data, license_management_report)
def parse!(json_data, license_scanning_report)
root = JSON.parse(json_data)
root['licenses'].each do |license_hash|
......@@ -19,18 +19,18 @@ module Gitlab
uses_license?(dependency['license']['name'], license_name)
end
license_dependencies.each do |dependency|
license_management_report.add_dependency(license_name,
license_hash['count'],
dependency['license']['url'],
dependency['dependency']['name'])
license_scanning_report.add_dependency(license_name,
license_hash['count'],
dependency['license']['url'],
dependency['dependency']['name'])
end
end
end
rescue JSON::ParserError
raise LicenseManagementParserError, 'JSON parsing failed'
raise LicenseScanningParserError, 'JSON parsing failed'
rescue => e
Gitlab::Sentry.track_exception(e)
raise LicenseManagementParserError, 'License management report parsing failed'
raise LicenseScanningParserError, 'License scanning report parsing failed'
end
def remove_suffix(name)
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe Gitlab::Ci::Parsers::LicenseManagement::LicenseManagement do
describe Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning do
describe '#parse!' do
subject { described_class.new.parse!(data, report) }
......
......@@ -202,7 +202,7 @@ describe Ci::Build do
end
it 'raises an error' do
expect { subject }.to raise_error(Gitlab::Ci::Parsers::LicenseManagement::LicenseManagement::LicenseManagementParserError)
expect { subject }.to raise_error(Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning::LicenseScanningParserError)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment