<commit_before>require 'cgi'
require 'readme-score'
require 'rest'

class StatsGenerator
  include HashInit
  attr_accessor :spec, :api_json_path, :cloc_results, :readme_location, :changelog_location, :doc_percent, :download_location, :docset_location, :testing_estimate, :cloc_top

  def upload
    vputs "Generating the CocoaDocs stats for CP Metrics"

    cloc_sum = get_summary_cloc
    @cloc_top = get_top_cloc

    has_changelog = File.exist? changelog_location
    data = {
      :total_files => cloc_sum[:files],
      :total_comments => cloc_sum[:comments],
      :total_lines_of_code => cloc_sum[:lines_of_code],
      :doc_percent => @doc_percent,
      :total_test_expectations => testing_estimate,
      :readme_complexity => readme_metadata[:complexity],
      :rendered_readme_url => spec.or_cocoadocs_url + "/README.html",
      :changelog_url => has_changelog ? (spec.or_cocoadocs_url + "/CHANGELOG.html") : nil,<commit_msg>Use new changelog db url<commit_after>require 'cgi'
require 'readme-score'
require 'rest'

class StatsGenerator
  include HashInit
  attr_accessor :spec, :api_json_path, :cloc_results, :readme_location, :changelog_location, :doc_percent, :download_location, :docset_location, :testing_estimate, :cloc_top

  def upload
    vputs "Generating the CocoaDocs stats for CP Metrics"

    cloc_sum = get_summary_cloc
    @cloc_top = get_top_cloc

    has_changelog = File.exist? changelog_location
    data = {
      :total_files => cloc_sum[:files],
      :total_comments => cloc_sum[:comments],
      :total_lines_of_code => cloc_sum[:lines_of_code],
      :doc_percent => @doc_percent,
      :total_test_expectations => testing_estimate,
      :readme_complexity => readme_metadata[:complexity],
      :rendered_readme_url => spec.or_cocoadocs_url + "/README.html",
      :rendered_changelog_url => has_changelog ? (spec.or_cocoadocs_url + "/CHANGELOG.html") : nil,
{'fraction_non_alphanumeric': 0.10515247108307045, 'fraction_numerical': 0.0, 'mean_word_length': 4.819571865443425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1521751', 'n_tokens_mistral': 680, 'n_tokens_neox': 660, 'n_words': 121}