<commit_before>module RepositoryCheck
  class SingleRepositoryWorker
    include ApplicationWorker
    include RepositoryCheckQueue

    def perform(project_id)
      project = Project.find(project_id)

      save_result(project, !check)
    end

    private

    def save_result(project, failure)
      project.update_columns(
        last_repository_check_failed: failure,
        last_repository_check_at: Time.now
      )
    end

    def check(project)
      check_repo(project) && check_wiki_repo(project)
    end

    def check_repo(project)
      return true if project.empty_repo?

      git_fsck(project.repository)
    end<commit_msg>Pass the result as a positive bool<commit_after>module RepositoryCheck
  class SingleRepositoryWorker
    include ApplicationWorker
    include RepositoryCheckQueue

    def perform(project_id)
      project = Project.find(project_id)
      result = check(project)

      save_result(project, result)
    end

    private

    def save_result(project, result)
      project.update_columns(
        last_repository_check_failed: !result,
        last_repository_check_at: Time.now
      )
    end

    def check(project)
      check_repo(project) && check_wiki_repo(project)
    end

    def check_repo(project)
      return true if project.empty_repo?

      git_fsck(project.repository)
    end
{'fraction_non_alphanumeric': 0.05895522388059701, 'fraction_numerical': 0.0, 'mean_word_length': 3.0884146341463414, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6268501', 'n_tokens_mistral': 387, 'n_tokens_neox': 372, 'n_words': 83}