From 12334a17c4e67ab230be449bc52d59d0b2adcd42 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 20 Jan 2016 02:17:33 +0100 Subject: [PATCH] Import newer version of the script upstream --- tests/pylint.sh | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/tests/pylint.sh b/tests/pylint.sh index ccabb1f..d66eb2d 100755 --- a/tests/pylint.sh +++ b/tests/pylint.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2014-2015 Pierre Pronchery +#Copyright (c) 2014-2016 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -26,23 +26,46 @@ #variables PROGNAME="pylint.sh" +PROJECTCONF="../project.conf" #executables +DATE="date" DEBUG="_debug" FIND="find" PYLINT="pep8" SORT="sort" +TR="tr" #functions #pylint _pylint() { - filename="$1" + subdirs="data doc src tests tools" - #XXX ignores errors - $DEBUG $PYLINT -- "$filename" 2>&1 | while read line; do - echo "$line" 1>&2 - echo "$line" + $DATE + echo + while read line; do + case "$line" in + "["*) + break + ;; + "subdirs="*) + subdirs=${line#subdirs=} + subdirs=$(echo "$subdirs" | $TR ',' ' ') + ;; + esac + done < "$PROJECTCONF" + for subdir in $subdirs; do + [ -d "../$subdir" ] || continue + for filename in $($FIND "../$subdir" -name '*.py'); do + $DEBUG $PYLINT -- "$filename" 2>&1 + if [ $? -eq 0 ]; then + echo "$filename:" + else + #XXX ignore errors + echo "$PROGNAME: $filename: FAIL" 1>&2 + fi + done done } @@ -93,11 +116,5 @@ target="$1" #clean [ $clean -ne 0 ] && exit 0 -ret=0 exec 3>&1 -(date -echo -$FIND "../doc" "../src" "../tests" "../tools" -name '*.py' | $SORT | while read filename; do - _pylint "$filename" -done) > "$target" -exit $ret +_pylint > "$target"