<commit_before>'use strict'

const semver = require('semver')

const exec = require('./util').exec
const logger = require('./logging').logger

function getSemverTags () {
  const gitTagCmd = 'git tag | sort -r -V'
  const tags = exec(gitTagCmd)
    .toString().split('\n').filter(semver.valid)
  return tags
}

function getMergeCommits (revRange) {
  const gitLogCmd = `git log ${revRange} --format='%s' --grep='^Merge pull request #[0-9]\\+ from '`
  const stdout = exec(gitLogCmd).toString().trimRight()
  const commits = stdout ? stdout.split('\n') : []
  logger.debug('Commits: %s', JSON.stringify(commits))
  return commits
}
<commit_msg>Use semver.rcompare to sort array of versions<commit_after>'use strict'

const semver = require('semver')

const exec = require('./util').exec
const logger = require('./logging').logger

function getSemverTags () {
  const gitTagCmd = 'git tag'
  const tags = exec(gitTagCmd)
    .toString().split('\n').filter(semver.valid).sort(semver.rcompare)
  return tags
}

function getMergeCommits (revRange) {
  const gitLogCmd = `git log ${revRange} --format='%s' --grep='^Merge pull request #[0-9]\\+ from '`
  const stdout = exec(gitLogCmd).toString().trimRight()
  const commits = stdout ? stdout.split('\n') : []
  logger.debug('Commits: %s', JSON.stringify(commits))
  return commits
}

{'fraction_non_alphanumeric': 0.17030896759608138, 'fraction_numerical': 0.003014318010550113, 'mean_word_length': 4.442622950819672, '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': '2294826', 'n_tokens_mistral': 437, 'n_tokens_neox': 436, 'n_words': 107}