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 ...@@ -9,7 +9,7 @@ module EE
class_methods do class_methods do
def parsers def parsers
super.merge({ super.merge({
license_management: ::Gitlab::Ci::Parsers::LicenseManagement::LicenseManagement, license_management: ::Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning,
dependency_scanning: ::Gitlab::Ci::Parsers::Security::DependencyScanning, dependency_scanning: ::Gitlab::Ci::Parsers::Security::DependencyScanning,
container_scanning: ::Gitlab::Ci::Parsers::Security::ContainerScanning, container_scanning: ::Gitlab::Ci::Parsers::Security::ContainerScanning,
dast: ::Gitlab::Ci::Parsers::Security::Dast, dast: ::Gitlab::Ci::Parsers::Security::Dast,
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
module Gitlab module Gitlab
module Ci module Ci
module Parsers module Parsers
module LicenseManagement module LicenseCompliance
class LicenseManagement class LicenseScanning
LicenseManagementParserError = Class.new(Gitlab::Ci::Parsers::ParserError) 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 = JSON.parse(json_data)
root['licenses'].each do |license_hash| root['licenses'].each do |license_hash|
...@@ -19,18 +19,18 @@ module Gitlab ...@@ -19,18 +19,18 @@ module Gitlab
uses_license?(dependency['license']['name'], license_name) uses_license?(dependency['license']['name'], license_name)
end end
license_dependencies.each do |dependency| license_dependencies.each do |dependency|
license_management_report.add_dependency(license_name, license_scanning_report.add_dependency(license_name,
license_hash['count'], license_hash['count'],
dependency['license']['url'], dependency['license']['url'],
dependency['dependency']['name']) dependency['dependency']['name'])
end end
end end
end end
rescue JSON::ParserError rescue JSON::ParserError
raise LicenseManagementParserError, 'JSON parsing failed' raise LicenseScanningParserError, 'JSON parsing failed'
rescue => e rescue => e
Gitlab::Sentry.track_exception(e) Gitlab::Sentry.track_exception(e)
raise LicenseManagementParserError, 'License management report parsing failed' raise LicenseScanningParserError, 'License scanning report parsing failed'
end end
def remove_suffix(name) def remove_suffix(name)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Parsers::LicenseManagement::LicenseManagement do describe Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning do
describe '#parse!' do describe '#parse!' do
subject { described_class.new.parse!(data, report) } subject { described_class.new.parse!(data, report) }
......
...@@ -202,7 +202,7 @@ describe Ci::Build do ...@@ -202,7 +202,7 @@ describe Ci::Build do
end end
it 'raises an error' do 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
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