<commit_before>#!/bin/sh

# Copyright 2014 <NAME> <<EMAIL>>
# Copyright 2014 <NAME> <<EMAIL>>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.

# customizable
CHECKROOT=$(dirname "${0}")

# prepare
ROOT=$(git rev-parse --show-toplevel)
EXIT_CODE=0
BRANCH="${1}"
DIFFFILTER="${2}"

# set default diff-filter
if [ -z "${DIFFFILTER}" ]; then
    DIFFFILTER="ACMR"
fi

# select files to check
if [ -z "${BRANCH}" ]; then
    FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E '\.h$')"
else
    FILES="$(git diff --diff-filter=${DIFFFILTER} --name-only ${BRANCH} | grep -E '\.h$')"
fi

FILES=$(echo "${FILES}" | grep -v -E '^(dist/tools|boards/msba2-common/tools/|cpu/saml21/include/atmel/|cpu/sam0_common/include/cmsis/)')

# check files
for FILE in ${FILES}; do
    if cat "${ROOT}/${FILE}" \
        | sed -e 's/$/ /' \
        | tr -d '\r\n' \
        | sed -e 's/  */ /g' \
        | grep -v -q '#ifdef __cplusplus extern "C" { #endif'; \
    then
        EXIT_CODE=1
        echo "file does not have a C++ compatible header: '${FILE}'"
    fi
done

exit ${EXIT_CODE}<commit_msg>dist/externc: exclude all (CPU) vendor headers<commit_after>#!/bin/sh

# Copyright 2014 <NAME> <<EMAIL>>
# Copyright 2014 <NAME> <<EMAIL>>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.

# customizable
CHECKROOT=$(dirname "${0}")

# prepare
ROOT=$(git rev-parse --show-toplevel)
EXIT_CODE=0
BRANCH="${1}"
DIFFFILTER="${2}"

# set default diff-filter
if [ -z "${DIFFFILTER}" ]; then
    DIFFFILTER="ACMR"
fi

# select files to check
if [ -z "${BRANCH}" ]; then
    FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E '\.h$')"
else
    FILES="$(git diff --diff-filter=${DIFFFILTER} --name-only ${BRANCH} | grep -E '\.h$')"
fi

FILES=$(echo "${FILES}" | grep -v -E '^(dist/tools|boards/msba2-common/tools/|.+/include/vendor/)')

# check files
for FILE in ${FILES}; do
    if cat "${ROOT}/${FILE}" \
        | sed -e 's/$/ /' \
        | tr -d '\r\n' \
        | sed -e 's/  */ /g' \
        | grep -v -q '#ifdef __cplusplus extern "C" { #endif'; \
    then
        EXIT_CODE=1
        echo "file does not have a C++ compatible header: '${FILE}'"
    fi
done

exit ${EXIT_CODE}
{'fraction_non_alphanumeric': 0.19016122364613477, 'fraction_numerical': 0.014468788755684168, 'mean_word_length': 2.884430176565008, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1433321', 'n_tokens_mistral': 908, 'n_tokens_neox': 862, 'n_words': 272}