<commit_before>// we need this script to gerenate a jobname:package-version matching very fast
// if there is a better way to do this, please implement it! :)

hudsonInstance = hudson.model.Hudson.instance

allItems = hudsonInstance.items
pkgJobs = allItems.findAll{job -> job.name.contains("pkg+")}

for (job in pkgJobs) {
  lastBuild = job.getLastBuild();
  if (lastBuild == null)
    // catch case when job has never been built so far
    println job.name + " 0.0#0"
  else
    println lastBuild
}
<commit_msg>Improve groovy script to never ever fail<commit_after>// we need this script to gerenate a jobname:package-version matching very fast
// (relatively ugly, but fast - better ideas for version-handling are welcome!)

hudsonInstance = hudson.model.Hudson.instance

allItems = hudsonInstance.items
pkgJobs = allItems.findAll{job -> job.name.contains("pkg+")}

for (job in pkgJobs) {
  jobName = job.name;
  jobVersion = "0";
  job.getBuildWrappersList().each() {
    cl -> if (cl.getClass().equals(org.jenkinsci.plugins.buildnamesetter.BuildNameSetter))
      jobVersion = cl.template.replace('#${BUILD_NUMBER}', "");
  }
  println jobName + " " + jobVersion;
}

{'fraction_non_alphanumeric': 0.11955593509820667, 'fraction_numerical': 0.0034158838599487617, 'mean_word_length': 4.095652173913043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '220025', 'n_tokens_mistral': 388, 'n_tokens_neox': 371, 'n_words': 108}