From 87c9d43dfbcdbbba33526b7f6f037198e6665ea1 Mon Sep 17 00:00:00 2001 From: Miguel Savignano Date: Fri, 1 Nov 2019 20:56:20 +0100 Subject: [PATCH] summary with brakeman links --- lib/report_adapter.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/report_adapter.rb b/lib/report_adapter.rb index 16503f6..e61eb89 100644 --- a/lib/report_adapter.rb +++ b/lib/report_adapter.rb @@ -13,7 +13,7 @@ class ReportAdapter end def summary(report) - "**Brakeman Report**: \n - #{security_warnings(report)} security warnings" + "**Brakeman Report**: \n - #{security_warnings(report)} security warnings\n #{check_table(report)}" end def annotations(report) @@ -31,6 +31,14 @@ class ReportAdapter private + def check_table(report) + uniq_checks(report).reduce('') { |memo, check| memo + " - [#{check[:check_name]}](#{check[:link]})" } + end + + def uniq_checks(report) + report['warnings'].map { |w| { check_name: w['check_name'], link: w['link'] } }.uniq { |w| w[:checkname] } + end + def security_warnings(report) report['scan_info']['security_warnings'] end