lib/utilities/xccdf/from_inspec.rb in inspec_tools-2.3.5 vs lib/utilities/xccdf/from_inspec.rb in inspec_tools-2.3.6

- old
+ new

@@ -2,11 +2,11 @@ # Data transformation from Inspec result output into usable data for XCCDF conversions. class FromInspec DATA_NOT_FOUND_MESSAGE = 'N/A'.freeze # Convert raw Inspec result json into format acceptable for XCCDF transformation. - def parse_data_for_xccdf(json) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity + def parse_data_for_xccdf(json) data = {} controls = [] if json['profiles'].nil? controls = json['controls'] @@ -27,10 +27,10 @@ c_data[c_id]['desc'] = control['desc'] || DATA_NOT_FOUND_MESSAGE c_data[c_id]['severity'] = control['tags']['severity'] || 'unknown' c_data[c_id]['gid'] = control['tags']['gid'] || control['id'] c_data[c_id]['gtitle'] = control['tags']['gtitle'] if control['tags']['gtitle'] # Optional attribute c_data[c_id]['gdescription'] = control['tags']['gdescription'] if control['tags']['gdescription'] # Optional attribute - c_data[c_id]['rid'] = control['tags']['rid'] || 'r_' + c_data[c_id]['gid'] + c_data[c_id]['rid'] = control['tags']['rid'] || "r_#{c_data[c_id]['gid']}" c_data[c_id]['rversion'] = control['tags']['rversion'] if control['tags']['rversion'] # Optional attribute c_data[c_id]['rweight'] = control['tags']['rweight'] if control['tags']['rweight'] # Optional attribute where N/A is not schema compliant c_data[c_id]['stig_id'] = control['tags']['stig_id'] || DATA_NOT_FOUND_MESSAGE c_data[c_id]['cci'] = control['tags']['cci'] if control['tags']['cci'] # Optional attribute c_data[c_id]['legacy'] = control['tags']['legacy'] if control['tags']['legacy'] # Optional attribute