<commit_before>package com.softwaremill.codebrag.service.commits.jgit

import org.eclipse.jgit.revwalk.RevCommit
import com.softwaremill.codebrag.domain.CommitInfo
import org.eclipse.jgit.lib.Repository
import org.joda.time.DateTime
import com.typesafe.scalalogging.slf4j.Logging

class JgitLogConverter extends Logging {

  def toCommitInfos(jGitCommits: List[RevCommit], repository: Repository): List[CommitInfo] = {
    val commitsOptions = jGitCommits.map(buildCommitInfoSafely(_, repository))
    commitsOptions.filter(_.isDefined).map(_.get)
  }

  def buildCommitInfoSafely(commit: RevCommit, repository: Repository): Option[CommitInfo] = {
    try {
      Some(buildCommitInfo(commit))
    } catch {<commit_msg>Converter can convert raw commit to PartialCommitInfo<commit_after>package com.softwaremill.codebrag.service.commits.jgit

import org.eclipse.jgit.revwalk.RevCommit
import com.softwaremill.codebrag.domain.{PartialCommitInfo, CommitInfo}
import org.eclipse.jgit.lib.Repository
import org.joda.time.DateTime
import com.typesafe.scalalogging.slf4j.Logging

class JgitLogConverter extends Logging {

  def toCommitInfos(jGitCommits: List[RevCommit], repository: Repository): List[CommitInfo] = {
    val commitsOptions = jGitCommits.map(buildCommitInfoSafely(_, repository))
    commitsOptions.filter(_.isDefined).map(_.get)
  }

  def toPartialCommitInfos(jGitCommits: List[RevCommit], repository: Repository): List[PartialCommitInfo] = {
    jGitCommits.flatMap(buildCommitInfoSafely(_, repository)).map(PartialCommitInfo(_))
  }

  def buildCommitInfoSafely(commit: RevCommit, repository: Repository): Option[CommitInfo] = {
    try {
      Some(buildCommitInfo(commit))
    } catch {
{'fraction_non_alphanumeric': 0.10164512338425381, 'fraction_numerical': 0.0011750881316098707, 'mean_word_length': 6.037190082644628, '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': '4050213', 'n_tokens_mistral': 550, 'n_tokens_neox': 556, 'n_words': 87}