<commit_before>#!/bin/sh

VENV_DIR="./env"
PEP8='pep8'

if [ $($PEP8 --version) != '0.6.1' ]; then
    echo "WARNING: pep8 version not '0.6.1.'"
fi

TEST_RESULT=0
PEP8_RESULT=0
TMP_FILE=$(tempfile)
find . -iname "*.py" | \
grep -v $VENV_DIR | \
while read ln; do
    pep8 --filename="*.py" --show-pep8  --show-source "$ln" | \
        grep . >> $TMP_FILE
done
grep . $TMP_FILE
RESULT=$?
if [ $RESULT -eq 0 ]; then
    PEP8_RESULT=1
fi
rm $TMP_FILE

#cd .
#python manage.py test
#TEST_RESULT=$?

exit $(( $TEST_RESULT + $PEP8_RESULT ))<commit_msg>pepcheck looks for right python and directory<commit_after>#!/bin/sh

cd "$(git rev-parse --show-toplevel)"
CWD=$(pwd)
PYTHON=$(which python)
if [ $PYTHON != "$CWD/env/bin/python" ]; then
    echo "Wrong Working Directory"
    exit 1
fi

VENV_DIR="./env"
PEP8='pep8'

if [ $($PEP8 --version) != '0.6.1' ]; then
    echo "WARNING: pep8 version not '0.6.1.'"
fi

TEST_RESULT=0
PEP8_RESULT=0
TMP_FILE=$(tempfile)
find . -iname "*.py" | \
grep -v $VENV_DIR | \
while read ln; do
    pep8 --filename="*.py" --show-pep8  --show-source "$ln" | \
        grep . >> $TMP_FILE
done
grep . $TMP_FILE
RESULT=$?
if [ $RESULT -eq 0 ]; then
    PEP8_RESULT=1
fi
rm $TMP_FILE

python contacts/manage.py test
TEST_RESULT=$?

exit $(( $TEST_RESULT + $PEP8_RESULT ))
{'fraction_non_alphanumeric': 0.1871616395978345, 'fraction_numerical': 0.030162412993039442, 'mean_word_length': 3.2287581699346406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1814496', 'n_tokens_mistral': 562, 'n_tokens_neox': 559, 'n_words': 135}