lib/pronto/brakeman.rb in pronto-brakeman-0.1.0 vs lib/pronto/brakeman.rb in pronto-brakeman-0.1.1
- old
+ new
@@ -25,14 +25,18 @@
result = []
output.checks.all_warnings.each do |warning|
patch = patch_for_warning(ruby_patches, warning)
- line = patch.added_lines.select do |added_line|
- added_line.new_lineno == warning.line
- end.first
+ if patch
+ line = patch.added_lines.select do |added_line|
+ added_line.new_lineno == warning.line
+ end.first
- result << new_warning_message(line, warning) if line
+ result << new_warning_message(line, warning) if line
+ else
+ puts "Could not detect patch for #{warning.file}:#{warning.message}"
+ end
end
result
end