Run lint on all files in the module.
Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/e5d88101 Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/e5d88101 Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/e5d88101 Branch: refs/heads/master Commit: e5d88101ae191b5be6b6d0bdfbdd174893937f03 Parents: 52d97e2 Author: Ahmet Altay <al...@google.com> Authored: Fri Jan 20 17:32:29 2017 -0800 Committer: Dan Halperin <dhalp...@google.com> Committed: Fri Jan 27 14:30:17 2017 -0800 ---------------------------------------------------------------------- sdks/python/apache_beam/coders/coders.py | 1 - sdks/python/run_pylint.sh | 44 ++++++++------------------- 2 files changed, 12 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/e5d88101/sdks/python/apache_beam/coders/coders.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/coders/coders.py b/sdks/python/apache_beam/coders/coders.py index 67bbbe6..25af934 100644 --- a/sdks/python/apache_beam/coders/coders.py +++ b/sdks/python/apache_beam/coders/coders.py @@ -705,4 +705,3 @@ class LengthPrefixCoder(FastCoder): def __repr__(self): return 'LengthPrefixCoder[%r]' % self._value_coder - http://git-wip-us.apache.org/repos/asf/beam/blob/e5d88101/sdks/python/run_pylint.sh ---------------------------------------------------------------------- diff --git a/sdks/python/run_pylint.sh b/sdks/python/run_pylint.sh index e865db6..fc7b244 100755 --- a/sdks/python/run_pylint.sh +++ b/sdks/python/run_pylint.sh @@ -16,23 +16,16 @@ # limitations under the License. # -# This script will run pylint and pep8 on files that changed compared to the -# current HEAD of the branch. +# This script will run pylint and pep8 on all module files. # # Use "pylint apache_beam" to run pylint all files. # Use "pep8 apache_beam" to run pep8 all files. # # The exit-code of the script indicates success or a failure. -BASE_BRANCH=python-sdk - set -e set -o pipefail -# Retrieve base branch for comparison. Travis does not fetch it by default. -git remote set-branches --add origin $BASE_BRANCH -git fetch - # Following generated files are excluded from lint checks. EXCLUDED_GENERATED_FILES=( "apache_beam/internal/windmill_pb2.py" @@ -45,29 +38,16 @@ EXCLUDED_GENERATED_FILES=( "apache_beam/internal/clients/storage/storage_v1_messages.py" "apache_beam/coders/proto2_coder_test_messages_pb2.py") -# Get the name of the files that changed compared to the HEAD of the branch. -# Use diff-filter to exclude deleted files. (i.e. Do not try to lint files that -# does not exist any more.) Filter the output to .py files only. Rewrite the -# paths relative to the sdks/python folder. -CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB origin/$BASE_BRANCH . \ - | { grep ".py$" || true; } \ - | sed 's/sdks\/python\///g') - -FILES_TO_CHECK="" -for file in $CHANGED_FILES; -do -if [[ " ${EXCLUDED_GENERATED_FILES[@]} " =~ " ${file} " ]]; then - echo "Excluded file " $file " from lint checks" -else - FILES_TO_CHECK="$FILES_TO_CHECK $file" -fi +FILES_TO_IGNORE="" +for file in "${EXCLUDED_GENERATED_FILES[@]}"; do + if [[ $FILES_TO_IGNORE ]]; then + FILES_TO_IGNORE="$FILES_TO_IGNORE, " + fi + FILES_TO_IGNORE="$FILES_TO_IGNORE$(basename $file)" done +echo "Skipping lint for generated files: $FILES_TO_IGNORE" -if test "$FILES_TO_CHECK"; then - echo "Running pylint on changed files:" - pylint $FILES_TO_CHECK - echo "Running pep8 on changed files:" - pep8 $FILES_TO_CHECK -else - echo "Not running pylint. No eligible files." -fi +echo "Running pylint:" +pylint apache_beam --ignore-patterns="$FILES_TO_IGNORE" +echo "Running pep8:" +pep8 apache_beam --exclude="$FILES_TO_IGNORE"