<commit_before>class Api::DocsController < ApplicationController
  skip_before_action :check_api_key, raise: false

  def index
    @cache_version = 'v1.1'
    @api_key = logged_in? ? current_user.api_key : 'YOUR_API_KEY'
    @project = Project.platform('npm').includes(:versions, :repository).find_by_name('base62') || Project.platform('rubygems').first

    @version = @project.versions.first

    @dependencies = project_json_response(@project)
    @dependencies[:dependencies] = map_dependencies(@version.dependencies || [])

    @repository = Repository.host('GitHub').find_by_full_name('gruntjs/grunt') || Repository.host('GitHub').first

    @repo_dependencies = @repository.as_json({
      except: [:id, :github_organisation_id, :owner_id], methods: [:github_contributions_count, :github_id]
    })
    @repo_dependencies[:dependencies] = map_dependencies(@repository.repository_dependencies || [])

    @search = Project.search('grunt').records

    @github_user = GithubUser.find_by_login('andrew')
  end
end<commit_msg>Fallback to first GitHub user when generating docs<commit_after>class Api::DocsController < ApplicationController
  skip_before_action :check_api_key, raise: false

  def index
    @cache_version = 'v1.1'
    @api_key = logged_in? ? current_user.api_key : 'YOUR_API_KEY'
    @project = Project.platform('npm').includes(:versions, :repository).find_by_name('base62') || Project.platform('rubygems').first

    @version = @project.versions.first

    @dependencies = project_json_response(@project)
    @dependencies[:dependencies] = map_dependencies(@version.dependencies || [])

    @repository = Repository.host('GitHub').find_by_full_name('gruntjs/grunt') || Repository.host('GitHub').first

    @repo_dependencies = @repository.as_json({
      except: [:id, :github_organisation_id, :owner_id], methods: [:github_contributions_count, :github_id]
    })
    @repo_dependencies[:dependencies] = map_dependencies(@repository.repository_dependencies || [])

    @search = Project.search('grunt').records

    @github_user = GithubUser.find_by_login('andrew') || GithubUser.first
  end
end
{'fraction_non_alphanumeric': 0.1365139348134152, 'fraction_numerical': 0.003778932451582428, 'mean_word_length': 5.723809523809524, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1994890', 'n_tokens_mistral': 683, 'n_tokens_neox': 636, 'n_words': 97}