lib/utilities/inspec_util.rb in inspec_tools-2.0.2.pre5 vs lib/utilities/inspec_util.rb in inspec_tools-2.0.2.pre6

- old
+ new

@@ -22,15 +22,15 @@ module Utils class InspecUtil DATA_NOT_FOUND_MESSAGE = 'N/A'.freeze WIDTH = 80 IMPACT_SCORES = { - "none" => 0.0, - "low" => 0.1, - "medium" => 0.4, - "high" => 0.7, - "critical" => 0.9, + 'none' => 0.0, + 'low' => 0.1, + 'medium' => 0.4, + 'high' => 0.7, + 'critical' => 0.9 }.freeze def self.parse_data_for_xccdf(json) data = {} @@ -195,11 +195,11 @@ '1.0 or one of the approved keywords.' end private_class_method def self.float_to_impact(severity) raise SeverityInputError, "'#{severity}' is not a valid severity value. It should be a Float between 0.0 and " \ - '1.0 or one of the approved keywords.' unless severity.between?(0,1) + '1.0 or one of the approved keywords.' unless severity.between?(0, 1) if severity <= 0.01 0.0 # Informative elsif severity < 0.4 0.3 # Low Impact @@ -231,11 +231,11 @@ def self.get_impact_string(impact) return if impact.nil? value = impact.to_f - unless value.between?(0,1) + unless value.between?(0, 1) raise ImpactInputError, "'#{value}' is not a valid impact score. Valid impact scores: [0.0 - 1.0]." end IMPACT_SCORES.reverse_each do |name, impact| return name if value >= impact @@ -275,12 +275,12 @@ end control.id = json_control['id'] control.title = json_control['title'] control.impact = get_impact(json_control['impact']) - #json_control['tags'].each do |tag| + # json_control['tags'].each do |tag| # control.add_tag(Inspec::Object::Tag.new(tag.key, tag.value) - #end + # end control.add_tag(::Inspec::Object::Tag.new('severity', json_control['tags']['severity'])) control.add_tag(::Inspec::Object::Tag.new('gtitle', json_control['tags']['gtitle'])) control.add_tag(::Inspec::Object::Tag.new('satisfies', json_control['tags']['satisfies'])) if json_control['tags']['satisfies'] control.add_tag(::Inspec::Object::Tag.new('gid', json_control['tags']['gid']))