Sha256: 18113750c55e2d23fa5fb67f9b4c02a616b0ed02554a757f6c5cb4ed528758c8
Contents?: true
Size: 767 Bytes
Versions: 2
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true require 'sinatra' require 'json' REPORT_PATH = ARGV[0] unless REPORT_PATH puts "usage: ruby application.rb path/to/report.json" exit(1) end unless File.exist?(REPORT_PATH) puts "Cannot open report file: #{REPORT_PATH}" exit(1) end helpers do def prepare_inputs(warning) warning['inputs'].sort_by { |_, reported_at| -reported_at } end def h(text) Rack::Utils.escape_html(text) end def render_source(file, line) File.read(file).lines.each.with_index.drop(line - 2).take(3).to_a end end get '/' do @report = JSON.parse(File.read(REPORT_PATH)) @warnings = @report['warnings'].sort_by do |_, code_path| -code_path['inputs'].map { |_, reported_at| reported_at }.max end.to_h erb :index end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tainted_love-0.1.5 | tools/web/application.rb |
tainted_love-0.1.4 | tools/web/application.rb |