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

CLANG_FORMAT_VERSION=6.0.0

if ! clang-format --version | grep --quiet $CLANG_FORMAT_VERSION; then
    echo "Wrong clang-format version, expected $CLANG_FORMAT_VERSION."
    exit 1
fi

ROOTDIR=$(cd "$(dirname "$0")/.."; pwd)
FILES=$(echo $ROOTDIR/src/**/*.{h,cpp})

if [ "$1" = "--check" ]; then
    if grep -En "(while|for|if) *\(.*\) *$" $FILES || grep -En "[^#]else *$" $FILES; then
        echo "Add braces to multiline while/for/if/else statements."
        exit 1
    fi

    clang-format -output-replacements-xml $FILES | grep "<replacement " >/dev/null

    if [ $? -ne 1 ]; then
        echo "Run $0 to format the code."
        exit 1
    else<commit_msg>Reduce clang-format version check to a warning<commit_after>#!/usr/bin/env bash

CLANG_FORMAT_VERSION=6.0.0

if ! clang-format --version | grep --quiet $CLANG_FORMAT_VERSION; then
    echo "WARNING: Wrong clang-format version, expected $CLANG_FORMAT_VERSION."
fi

ROOTDIR=$(cd "$(dirname "$0")/.."; pwd)
FILES=$(echo $ROOTDIR/src/**/*.{h,cpp})

if [ "$1" = "--check" ]; then
    if grep -En "(while|for|if) *\(.*\) *$" $FILES || grep -En "[^#]else *$" $FILES; then
        echo "Add braces to multiline while/for/if/else statements."
        exit 1
    fi

    clang-format -output-replacements-xml $FILES | grep "<replacement " >/dev/null

    if [ $? -ne 1 ]; then
        echo "Run $0 to format the code."
        exit 1
    else
{'fraction_non_alphanumeric': 0.17725052337752967, 'fraction_numerical': 0.013258897418004187, 'mean_word_length': 2.824, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '870581', 'n_tokens_mistral': 546, 'n_tokens_neox': 503, 'n_words': 142}