#!/bin/bash

IGNORE=
function ignore() {
	IGNORE="$IGNORE,$1"
}

ignore W191 "indentation contains tabs"
#ignore W503 "line break occurred before a binary operator"
ignore W504 "line break after binary operator"
#ignore E117 "over-indented"
#ignore E261 "at least two spaces before inline comment"
#ignore E262 "inline comment should start with '# '"
#ignore E265 "block comment should start with '# '"
ignore E402 "module level import not at top of file"
#ignore E702 "multiple statements on one line (semicolon)"

#ignore F403 "'from module import *' used; unable to detect undefined names"

TOOL="pycodestyle --max-line-length=100"
if which flake8; then
	TOOL=flake8
fi

# pycodestyle

#if [ -z $2 ] ; then
$TOOL "--ignore=$IGNORE" "$@" | grep -v wcwidth | sed -E 's/([0-9]+):([0-9]+)/\1  /g' | sed 's|^./||g' | less -N
#else
#	pycodestyle --select "$@" | grep --color=always -P ':\d*:' 2>&1
#fi
