mirror of https://github.com/pwndbg/pwndbg
Add support for formatting the code directly from lint.sh (#1140)
This commit is contained in:
parent
ccc56b9a58
commit
6af4753d8e
37
lint.sh
37
lint.sh
|
@ -1,10 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
isort --check-only --diff .
|
||||
black --diff --check .
|
||||
help_and_exit() {
|
||||
echo "Usage: ./lint.sh [-f|--filter]"
|
||||
echo " -f, --filter format code instead of just checking the format"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $# -gt 1 ]]; then
|
||||
help_and_exit
|
||||
fi
|
||||
|
||||
FORMAT=0
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-f | --format)
|
||||
FORMAT=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
help_and_exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -o xtrace
|
||||
|
||||
if [[ $FORMAT == 1 ]]; then
|
||||
isort .
|
||||
black .
|
||||
else
|
||||
isort --check-only --diff .
|
||||
black --check --diff .
|
||||
fi
|
||||
|
||||
flake8 --show-source .
|
||||
|
||||
# Indents are four spaces, binary ops can start a line, and indent switch cases
|
||||
|
|
Loading…
Reference in New Issue