1. Separate the pep8 check from the pylint check
a. This allows them to be run as different tools (if desired) 2. Adjust the makefile to have a 'make pep8' section which can run this new script
This commit is contained in:
parent
45cc6af3b6
commit
8ce86713f6
5
Makefile
5
Makefile
@ -4,6 +4,9 @@ PY_FILES+="bin/cloud-init"
|
|||||||
|
|
||||||
all: test
|
all: test
|
||||||
|
|
||||||
|
pep8:
|
||||||
|
$(CWD)/tools/run-pep8 $(PY_FILES)
|
||||||
|
|
||||||
pylint:
|
pylint:
|
||||||
$(CWD)/tools/run-pylint $(PY_FILES)
|
$(CWD)/tools/run-pylint $(PY_FILES)
|
||||||
|
|
||||||
@ -20,5 +23,5 @@ clean:
|
|||||||
rm -rf /var/log/cloud-init.log \
|
rm -rf /var/log/cloud-init.log \
|
||||||
/var/lib/cloud/
|
/var/lib/cloud/
|
||||||
|
|
||||||
.PHONY: test pylint pyflakes 2to3 clean
|
.PHONY: test pylint pyflakes 2to3 clean pep8
|
||||||
|
|
||||||
|
28
tools/run-pep8
Executable file
28
tools/run-pep8
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ci_files='cloud*.py cloudinit/*.py cloudinit/config/*.py'
|
||||||
|
test_files=$(find tests -name "*.py")
|
||||||
|
def_files="$ci_files $test_files"
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
files=( )
|
||||||
|
for f in $def_files; do
|
||||||
|
[ -f "$f" ] || { echo "failed, $f not a file" 1>&2; exit 1; }
|
||||||
|
files[${#files[@]}]=${f}
|
||||||
|
done
|
||||||
|
else
|
||||||
|
files=( "$@" );
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmd=(
|
||||||
|
pep8
|
||||||
|
|
||||||
|
--ignore=E501 # Line too long (these are caught by pylint)
|
||||||
|
|
||||||
|
"${files[@]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo -e "\nRunning pep8:"
|
||||||
|
echo "${cmd[@]}"
|
||||||
|
"${cmd[@]}"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user