<commit_before>require 'erb'

def get_template()
  %{
        <DOCTYPE html  "-//W3C//DTD  1.0 //EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            <title>Git HealthCheck Report</title>
        </head>
        <body>
                 <h1>Git HealthCheck Report</h1>
        </body>
        </html>
  }
end

class Report

  include ERB::Util

  def initialize(template)
    @template = template
  end

  def render()
    ERB.new(@template).result(binding)
  end

  def save(file)
    Dir.mkdir 'report' unless File.directory? 'report'
    File.open("report/#{file}", "w+") do |f|
      f.write(render)
    end
  end

  list = Report.new(get_template)
  list.save('report.html')


end<commit_msg>refactored reporting<commit_after>require 'erb'

class Report

  def initialize(fast_history, fast_working_copy, thorough_history)
    @fast_history = fast_history
    @fast_working_copy = fast_working_copy
    @thorough_history = thorough_history
    @report_directory = "#{File.dirname(__FILE__)}/../report"
  end

  def get_binding
    binding
  end

  def get_template
    File.read("#@report_directory/report.erb")
  end

  def create
    rhtml = ERB.new(get_template)
    output = rhtml.result(get_binding)

    Dir.mkdir @report_directory unless File.directory? @report_directory

    File.open("#@report_directory/report.html", "w+") do |f|
      f.write output
    end
  end

end
{'fraction_non_alphanumeric': 0.13448056086679414, 'fraction_numerical': 0.008922880815806247, 'mean_word_length': 2.8957816377171217, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3338754', 'n_tokens_mistral': 560, 'n_tokens_neox': 529, 'n_words': 106}