lib/pronto/brakeman.rb in pronto-brakeman-0.6.0 vs lib/pronto/brakeman.rb in pronto-brakeman-0.7.0
- old
+ new
@@ -30,12 +30,24 @@
new_message(line, warning) if line
end
end
def new_message(line, warning)
- Message.new(line.patch.delta.new_file[:path], line, :warning,
+ Message.new(line.patch.delta.new_file[:path], line,
+ severity_for_confidence(warning.confidence),
"Possible security vulnerability: #{warning.message}",
nil, self.class)
+ end
+
+ def severity_for_confidence(confidence_level)
+ case confidence_level
+ when 0 # Brakeman High confidence
+ :fatal
+ when 1 # Brakeman Medium confidence
+ :warning
+ else # Brakeman Low confidence (and other possibilities)
+ :info
+ end
end
def patch_for_warning(ruby_patches, warning)
ruby_patches.find do |patch|
patch.new_file_full_path.to_s == warning.file