Commit ac5d4a91 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

python: add an autopep8 formatter

parent fe43871a
formatter_autopep8:
kind: "autopep8"
script: "/PATH/TO/format.autopep8"
required_files:
- "tox.ini"
- "setup.cfg"
#!/bin/sh
# This formatter uses the `autopep8` tool to perform formatting checks of files
# written in Python.
#
# It uses the `autopep8` executable in `$PATH`. The configuration file may be
# named `tox.ini` or `setup.cfg` for `autopep8`, but are optional, but are used
# if they exist.
set -e
readonly path="$1"
shift
if ! [ -f "$path" ]; then
echo >&2 'error: could not find file to format: '"$path"
exit 4
fi
if ! which "autopep8" > /dev/null; then
echo >&2 'error: could not find the `autopep8` binary'
exit 3
fi
exec autopep8 --in-place "$path"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment