<commit_before>#! /usr/bin/env bash

VERSION_CHANGE_TRIGGERS="setup.py MANIFEST.in openfisca_france"

current_version=`python setup.py --version`

if git diff-index --quiet origin/master $VERSION_CHANGE_TRIGGERS ":(exclude)*.md"
then exit 0  # there are no functional changes at all, the version is correct
fi

if git rev-parse --verify --quiet $current_version
then
    echo "Version $current_version already exists:"
    git log -1 $current_version
    echo
    echo "Update the version number in setup.py before merging this branch into master."
    echo "Look at the CONTRIBUTING.md file to learn how the version number should be updated."
    exit 1
fi

if git diff-index --quiet origin/master CHANGELOG.md
then
    echo "CHANGELOG.md has not been modified, while the code has changed."
    echo "Explain what you changed before merging this branch into master."
    echo "Look at the CONTRIBUTING.md file to learn how to write the changelog."
    exit 2<commit_msg>Improve version check script robustness<commit_after>#! /usr/bin/env bash

VERSION_CHANGE_TRIGGERS="setup.py MANIFEST.in openfisca_france"

current_version=`python setup.py --version`

if git diff-index --quiet origin/master -- $VERSION_CHANGE_TRIGGERS ":(exclude)*.md"
then exit 0  # there are no functional changes at all, the version is correct
fi

if git rev-parse --verify --quiet $current_version
then
    echo "Version $current_version already exists:"
    git --no-pager log -1 $current_version
    echo
    echo "Update the version number in setup.py before merging this branch into master."
    echo "Look at the CONTRIBUTING.md file to learn how the version number should be updated."
    exit 1
fi

if git diff-index --quiet origin/master CHANGELOG.md
then
    echo "CHANGELOG.md has not been modified, while the code has changed."
    echo "Explain what you changed before merging this branch into master."
    echo "Look at the CONTRIBUTING.md file to learn how to write the changelog."
    exit 2
{'fraction_non_alphanumeric': 0.07315842583249244, 'fraction_numerical': 0.004036326942482341, 'mean_word_length': 3.766826923076923, 'pattern_counts': {'":': 2, '<': 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': '1031814', 'n_tokens_mistral': 592, 'n_tokens_neox': 569, 'n_words': 250}