<commit_before>package lib

import org.kohsuke.github.{GHOrganization, GHUser}

object AccountRequirements {

  val All = Seq(FullNameRequirement, TwoFactorAuthRequirement, SponsorRequirement)

  val RequirementsByLabel = All.map(r => r.issueLabel -> r).toMap

  val AllLabels = All.map(_.issueLabel).toSet

  def failedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot): Set[AccountRequirement] =
    All.filterNot(_.isSatisfiedBy(user)).toSet
}

trait AccountRequirement {
  val issueLabel: String
  def fixSummary(implicit org: GHOrganization): String
  def isSatisfiedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot): Boolean
}


object FullNameRequirement extends AccountRequirement {
  override val issueLabel = "FullName"
  override def fixSummary(implicit org: GHOrganization) =
    "Enter a full name in your [GitHub profile](https://github.com/settings/profile)."

  def isSatisfiedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot) =
    Option(user.getName()).map(_.length > 5).getOrElse(false)

}

object SponsorRequirement extends AccountRequirement {

  override val issueLabel = "Sponsor"

  override def fixSummary(implicit org: GHOrganization) =
    "Get a Pull-Request opened to add your username to our " +
      s"[users.txt](https://github.com/${org.getLogin}/people/blob/master/users.txt) file " +
      s"_- ideally, a Tech Lead or Dev Manager at ${org.getName} should open this request for you_."

  override def isSatisfiedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot) =
    orgSnapshot.sponsoredUserLogins.contains(user.getLogin)

}
<commit_msg>notes<commit_after>package lib

import org.kohsuke.github.{GHOrganization, GHUser}

object AccountRequirements {

  val All = Seq(FullNameRequirement, TwoFactorAuthRequirement, SponsorRequirement)

  val RequirementsByLabel = All.map(r => r.issueLabel -> r).toMap

  val AllLabels = All.map(_.issueLabel).toSet

  def failedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot): Set[AccountRequirement] =
    All.filterNot(_.isSatisfiedBy(user)).toSet
}

trait AccountRequirement {
  val issueLabel: String
  def fixSummary(implicit org: GHOrganization): String
  def isSatisfiedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot): Boolean
}


object FullNameRequirement extends AccountRequirement {
  override val issueLabel = "FullName"
  override def fixSummary(implicit org: GHOrganization) =
    "Enter a full name in your [GitHub profile](https://github.com/settings/profile)."

  def isSatisfiedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot) =
    Option(user.getName()).map(_.length > 5).getOrElse(false)

}

// requires a 'users.txt' file in the people repo
object SponsorRequirement extends AccountRequirement {

  override val issueLabel = "Sponsor"

  override def fixSummary(implicit org: GHOrganization) =
    "Get a Pull-Request opened to add your username to our " +
      s"[users.txt](https://github.com/${org.getLogin}/people/blob/master/users.txt) file " +
      s"_- ideally, a Tech Lead or Dev Manager at ${org.getName} should open this request for you_."

  override def isSatisfiedBy(user: GHUser)(implicit orgSnapshot: OrgSnapshot) =
    orgSnapshot.sponsoredUserLogins.contains(user.getLogin)

}

// requires Owner permissions
{'fraction_non_alphanumeric': 0.1016059295861643, 'fraction_numerical': 0.0006176652254478073, 'mean_word_length': 5.031657355679702, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 4, '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': '7368782', 'n_tokens_mistral': 1029, 'n_tokens_neox': 963, 'n_words': 249}