<commit_before>// slack plugin color codes
// https://github.com/jenkinsci/slack-plugin/blob/e568a98e4fbe93937f12d9ff22dad282c7e3d374/src/main/resources/jenkins/plugins/slack/workflow/SlackSendStep/help-color.html

String cause() {
  currentBuild.build().getAction(CauseAction.class).getShortDescription()
}

String duration() {
  def dur = currentBuild.build().getDurationString()

  // the build hasn't technically ended while the pipeline script is still
  // executing, so jenkins is appending "and counting" to the duration string
  def m = dur =~ /(.*) and counting/
  def durClean =  m[0][1]

  "after ${durClean}"
}

String slackMessage(String detail) {
  "${env.JOB_NAME} - #${env.BUILD_NUMBER} ${detail} (<${env.RUN_DISPLAY_URL}|Open>)"
}

String slackStartMessage() {
  slackMessage(cause())
}

String slackSuccessMessage() {
  slackMessage("Success ${duration()}")
}

String slackFailureMessage() {
  slackMessage("Failure ${duration()}")
}

String slackAbortedMessage() {
  slackMessage("Aborted ${duration()}")
}

def started() {
  slackSend color: 'good', message: slackStartMessage()
}

def success() {
  slackSend color: 'good', message: slackSuccessMessage()
}

def aborted() {
  slackSend color: 'warning', message: slackAbortedMessage()
}

def failure() {
  slackSend color: 'danger', message: slackFailureMessage()
}

def wrap(Closure run) {
  try {
    notify.started()

    run()
  } catch (e) {
    // If there was an exception thrown, the build failed
    currentBuild.result = "FAILED"
    throw e
  } finally {
    echo "result: ${currentBuild.result}"
    switch(currentBuild.result) {
      case null:
      case 'SUCCESS':
        notify.success()
        break
      case 'ABORTED':
        notify.aborted()
        break
      case 'FAILURE':
        notify.failure()
        break
      default:
        notify.failure()
    }
  }
}

return this;<commit_msg>fix notify.wrap() method<commit_after>// slack plugin color codes
// https://github.com/jenkinsci/slack-plugin/blob/e568a98e4fbe93937f12d9ff22dad282c7e3d374/src/main/resources/jenkins/plugins/slack/workflow/SlackSendStep/help-color.html

String cause() {
  currentBuild.build().getAction(CauseAction.class).getShortDescription()
}

String duration() {
  def dur = currentBuild.build().getDurationString()

  // the build hasn't technically ended while the pipeline script is still
  // executing, so jenkins is appending "and counting" to the duration string
  def m = dur =~ /(.*) and counting/
  def durClean =  m[0][1]

  "after ${durClean}"
}

String slackMessage(String detail) {
  "${env.JOB_NAME} - #${env.BUILD_NUMBER} ${detail} (<${env.RUN_DISPLAY_URL}|Open>)"
}

String slackStartMessage() {
  slackMessage(cause())
}

String slackSuccessMessage() {
  slackMessage("Success ${duration()}")
}

String slackFailureMessage() {
  slackMessage("Failure ${duration()}")
}

String slackAbortedMessage() {
  slackMessage("Aborted ${duration()}")
}

def started() {
  slackSend color: 'good', message: slackStartMessage()
}

def success() {
  slackSend color: 'good', message: slackSuccessMessage()
}

def aborted() {
  slackSend color: 'warning', message: slackAbortedMessage()
}

def failure() {
  slackSend color: 'danger', message: slackFailureMessage()
}

def wrap(Closure run) {
  try {
    started()

    run()
  } catch (e) {
    // If there was an exception thrown, the build failed
    currentBuild.result = "FAILED"
    throw e
  } finally {
    echo "result: ${currentBuild.result}"
    switch(currentBuild.result) {
      case null:
      case 'SUCCESS':
        success()
        break
      case 'ABORTED':
        aborted()
        break
      case 'FAILURE':
        failure()
        break
      default:
        failure()
    }
  }
}

return this;
{'fraction_non_alphanumeric': 0.13677488025545503, 'fraction_numerical': 0.013837147418839808, 'mean_word_length': 3.623616236162362, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '2732278', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1198, 'n_words': 281}