From 5bc11d55d44a58e0139b62a3110bdf43ef7e4f95 Mon Sep 17 00:00:00 2001
From: Mehrdad Afshari <mmx@google.com>
Date: Thu, 1 Jun 2017 11:23:21 -0700
Subject: [PATCH] Expand pylint to grpc_health and grpc_reflection

---
 .../grpc_reflection/v1alpha/reflection.py          |  5 ++---
 tools/distrib/pylint_code.sh                       | 14 +++++++++-----
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
index 0f399f8f8d..1a7d3259df 100644
--- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
+++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
@@ -28,8 +28,6 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 """Reference implementation for reflection in gRPC Python."""
 
-import threading
-
 import grpc
 from google.protobuf import descriptor_pb2
 from google.protobuf import descriptor_pool
@@ -120,6 +118,7 @@ class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer):
             ]))
 
     def ServerReflectionInfo(self, request_iterator, context):
+        # pylint: disable=unused-argument
         for request in request_iterator:
             if request.HasField('file_by_filename'):
                 yield self._file_by_filename(request.file_by_filename)
@@ -152,4 +151,4 @@ def enable_server_reflection(service_names, server, pool=None):
       pool: DescriptorPool object to use (descriptor_pool.Default() if None).
     """
     reflection_pb2_grpc.add_ServerReflectionServicer_to_server(
-        ReflectionServicer(service_names, pool), server)
+        ReflectionServicer(service_names, pool=pool), server)
diff --git a/tools/distrib/pylint_code.sh b/tools/distrib/pylint_code.sh
index 6369e605d5..b1e305c56d 100755
--- a/tools/distrib/pylint_code.sh
+++ b/tools/distrib/pylint_code.sh
@@ -31,18 +31,22 @@
 set -ex
 
 # change to root directory
-cd $(dirname $0)/../..
+cd "$(dirname "$0")/../.."
 
-DIRS=src/python/grpcio/grpc
+DIRS=(
+  'src/python/grpcio/grpc'
+  'src/python/grpcio_reflection/grpc_reflection'
+  'src/python/grpcio_health_checking/grpc_health'
+)
 
 VIRTUALENV=python_pylint_venv
 
 virtualenv $VIRTUALENV
-PYTHON=`realpath $VIRTUALENV/bin/python`
+PYTHON=$(realpath $VIRTUALENV/bin/python)
 $PYTHON -m pip install pylint==1.6.5
 
-for dir in $DIRS; do
-  $PYTHON -m pylint --rcfile=.pylintrc -rn $dir || exit $?
+for dir in "${DIRS[@]}"; do
+  $PYTHON -m pylint --rcfile=.pylintrc -rn "$dir" || exit $?
 done
 
 exit 0
-- 
GitLab