<commit_before>package models.domain.disposal_of_vehicle

import models.domain.common.{AddressLinesModel, AddressAndPostcodeModel}

case class EnterAddressManuallyModel(addressAndPostcodeModel: AddressAndPostcodeModel) {

  val regex = """^[A-Za-z0-9\s\-]*$""".r

  def stripEndOfLineRequired(inputline:String): String = {
    inputline.takeRight(1) match {
      case a if !regex.pattern.matcher(a).matches => stripEndOfLineRequired(inputline.dropRight(1))
      case _ => inputline
    }
  }

  def stripEndOfLineOptionalField(inputline:Option[String]): Option[String] = {
    inputline match {
      case Some(line) => Some(stripEndOfLineRequired(line))
      case _ => None
    }
  }

  def stripCharsNotAccepted = {

    val line1 = stripEndOfLineRequired(addressAndPostcodeModel.addressLinesModel.line1)
    val line2 = stripEndOfLineOptionalField(addressAndPostcodeModel.addressLinesModel.line2)
    val line3 = stripEndOfLineOptionalField(addressAndPostcodeModel.addressLinesModel.line3)
    val line4 = stripEndOfLineOptionalField(addressAndPostcodeModel.addressLinesModel.line4)

    copy(addressAndPostcodeModel = addressAndPostcodeModel.copy(addressLinesModel = AddressLinesModel(line1, line2, line3, line4)))
 }
}
<commit_msg>refactored value names in stripEndOfLineRequiredMethod<commit_after>package models.domain.disposal_of_vehicle

import models.domain.common.{AddressLinesModel, AddressAndPostcodeModel}

case class EnterAddressManuallyModel(addressAndPostcodeModel: AddressAndPostcodeModel) {

  def stripEndOfLineRequired(inputline:String): String = {
    val submitRegex = """^[A-Za-z0-9\s\-]*$""".r
    inputline.takeRight(1) match {
      case a if !submitRegex.pattern.matcher(a).matches => stripEndOfLineRequired(inputline.dropRight(1))
      case _ => inputline
    }
  }

  def stripEndOfLineOptionalField(inputline:Option[String]): Option[String] = {
    inputline match {
      case Some(line) => Some(stripEndOfLineRequired(line))
      case _ => None
    }
  }

  def stripCharsNotAccepted = {
    val line1 = stripEndOfLineRequired(addressAndPostcodeModel.addressLinesModel.line1)
    val line2 = stripEndOfLineOptionalField(addressAndPostcodeModel.addressLinesModel.line2)
    val line3 = stripEndOfLineOptionalField(addressAndPostcodeModel.addressLinesModel.line3)
    val line4 = stripEndOfLineOptionalField(addressAndPostcodeModel.addressLinesModel.line4)

    copy(addressAndPostcodeModel = addressAndPostcodeModel.copy(addressLinesModel = AddressLinesModel(line1, line2, line3, line4)))
 }
}

{'fraction_non_alphanumeric': 0.09482418016594231, 'fraction_numerical': 0.012643224022125641, 'mean_word_length': 5.610966057441253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '533867', 'n_tokens_mistral': 780, 'n_tokens_neox': 759, 'n_words': 112}