#!/bin/sh -e

export PREFIX=""
if [ -d 'venv' ] ; then
    export PREFIX="venv/bin/"
fi
export SOURCE_FILES="httpcore tests"

set -x

${PREFIX}ruff --fix $SOURCE_FILES
${PREFIX}black --exclude '/(_sync|sync_tests)/' $SOURCE_FILES

# Run unasync last because its `--check` mode is not aware of code formatters.
# (This means sync code isn't prettified, and that's mostly okay.)
scripts/unasync
