Commit 13566fd6 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

python: add a flake8 checker

The tool does not perform formatting.
parent bb3caf5b
# This script is only suitable for checking, not reformatting.
kind: "flake8"
script: "/PATH/TO/format.flake8"
- "tox.ini"
- "setup.cfg"
# This formatter uses the `flake8` tool to perform format checks of files
# written in the Python language.
# The `flake8` tool does *not* perform the formatting, but only checks the
# formatting.
# It uses the `flake8` executable in `$PATH`. The configuration files `tox.ini`
# and `setup.cfg` are used if available, but are not required.
set -e
readonly path="$1"
if ! [ -f "$path" ]; then
echo >&2 'error: could not find file to format: '"$path"
exit 4
if ! which "flake8" > /dev/null; then
echo >&2 'error: could not find the `flake8` binary'
exit 3
# Since this is just a checker, append the output to the file we are checking
# to cause it to have a diff and trip the check logic.
exec flake8 --exit-zero "$path" >> "$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