You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2016/09/20 16:10:32 UTC

[2/2] incubator-beam git commit: Updates lint configurations to ignore generated files.

Updates lint configurations to ignore generated files.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/49c03593
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/49c03593
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/49c03593

Branch: refs/heads/python-sdk
Commit: 49c0359327ba418cfe62ef2291560d1b1867f4e5
Parents: adda163
Author: Chamikara Jayalath <ch...@google.com>
Authored: Mon Sep 19 22:27:47 2016 -0700
Committer: Robert Bradshaw <ro...@google.com>
Committed: Tue Sep 20 09:10:01 2016 -0700

----------------------------------------------------------------------
 sdks/python/run_pylint.sh | 28 ++++++++++++++++++++++++----
 sdks/python/tox.ini       |  3 ---
 2 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/49c03593/sdks/python/run_pylint.sh
----------------------------------------------------------------------
diff --git a/sdks/python/run_pylint.sh b/sdks/python/run_pylint.sh
index 6114034..b69ea72 100755
--- a/sdks/python/run_pylint.sh
+++ b/sdks/python/run_pylint.sh
@@ -33,6 +33,17 @@ set -o pipefail
 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"
+"apache_beam/internal/windmill_service_pb2.py"
+"apache_beam/internal/clients/bigquery/bigquery_v2_client.py"
+"apache_beam/internal/clients/bigquery/bigquery_v2_messages.py"
+"apache_beam/internal/clients/dataflow/dataflow_v1b3_client.py"
+"apache_beam/internal/clients/dataflow/dataflow_v1b3_messages.py"
+"apache_beam/internal/clients/storage/storage_v1_client.py"
+"apache_beam/internal/clients/storage/storage_v1_messages.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
@@ -41,12 +52,21 @@ CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB origin/$BASE_BRANCH
                 | { grep ".py$" || true; }  \
                 | sed 's/sdks\/python\///g')
 
-if test "$CHANGED_FILES"; then
+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
+done
+
+if test "$FILES_TO_CHECK"; then
   echo "Running pylint on changed files:"
-  echo "$CHANGED_FILES"
-  pylint $CHANGED_FILES
+  pylint $FILES_TO_CHECK
   echo "Running pep8 on changed files:"
-  pep8 $CHANGED_FILES
+  pep8 $FILES_TO_CHECK
 else
   echo "Not running pylint. No eligible files."
 fi

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/49c03593/sdks/python/tox.ini
----------------------------------------------------------------------
diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini
index 5a2572e..20d1961 100644
--- a/sdks/python/tox.ini
+++ b/sdks/python/tox.ini
@@ -23,9 +23,6 @@ envlist = py27
 # pylint does not check the number of blank lines.
 select = E3
 
-# Skip auto generated files (windmill_pb2.py, windmill_service_pb2.py)
-exclude = windmill_pb2.py, windmill_service_pb2.py
-
 [testenv:py27]
 deps=
   pep8