blob: 82a818cce5a8ce6d4d54f9f77c68e1e5d47362e2 [file] [log] [blame]
Mehrdad Afshari1a967c32017-02-13 11:38:17 -08001#!/bin/bash
Mehrdad Afshari2b6b6ca2018-06-07 23:41:40 -07002# Copyright 2017 The gRPC Authors
Mehrdad Afshari1a967c32017-02-13 11:38:17 -08003#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02004# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
Mehrdad Afshari1a967c32017-02-13 11:38:17 -08007#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008# http://www.apache.org/licenses/LICENSE-2.0
Mehrdad Afshari1a967c32017-02-13 11:38:17 -08009#
Jan Tattermusch7897ae92017-06-07 22:57:36 +020010# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Mehrdad Afshari1a967c32017-02-13 11:38:17 -080015
16set -ex
17
18# change to root directory
Mehrdad Afshari5bc11d52017-06-01 11:23:21 -070019cd "$(dirname "$0")/../.."
Mehrdad Afshari1a967c32017-02-13 11:38:17 -080020
Mehrdad Afshari5bc11d52017-06-01 11:23:21 -070021DIRS=(
Nathaniel Manistaa7182f72017-06-24 20:57:00 +000022 'src/python/grpcio/grpc'
23 'src/python/grpcio_health_checking/grpc_health'
24 'src/python/grpcio_reflection/grpc_reflection'
Nathaniel Manista69b72312017-07-21 03:18:11 +000025 'src/python/grpcio_testing/grpc_testing'
Mehrdad Afshari5bc11d52017-06-01 11:23:21 -070026)
Mehrdad Afshari1a967c32017-02-13 11:38:17 -080027
Mehrdad Afsharib9424d02018-04-18 12:30:28 -070028TEST_DIRS=(
29 'src/python/grpcio_tests/tests'
30)
31
Mehrdad Afshari1a967c32017-02-13 11:38:17 -080032VIRTUALENV=python_pylint_venv
Mehrdad Afsharid0d8ce82018-04-18 17:51:32 -070033python -m virtualenv $VIRTUALENV
Mehrdad Afshari1a967c32017-02-13 11:38:17 -080034
Mehrdad Afsharid0d8ce82018-04-18 17:51:32 -070035PYTHON=$VIRTUALENV/bin/python
36
37$PYTHON -m pip install --upgrade pip==10.0.1
Mehrdad Afshari2b6b6ca2018-06-07 23:41:40 -070038$PYTHON -m pip install pylint==1.9.2
Mehrdad Afshari1a967c32017-02-13 11:38:17 -080039
Mehrdad Afshari3b248942018-06-07 23:59:05 -070040EXIT=0
Mehrdad Afshari5bc11d52017-06-01 11:23:21 -070041for dir in "${DIRS[@]}"; do
Mehrdad Afshari3b248942018-06-07 23:59:05 -070042 $PYTHON -m pylint --rcfile=.pylintrc -rn "$dir" || EXIT=1
Mehrdad Afshari1a967c32017-02-13 11:38:17 -080043done
44
Mehrdad Afsharib9424d02018-04-18 12:30:28 -070045for dir in "${TEST_DIRS[@]}"; do
Mehrdad Afshari3b248942018-06-07 23:59:05 -070046 $PYTHON -m pylint --rcfile=.pylintrc-tests -rn "$dir" || EXIT=1
Mehrdad Afsharib9424d02018-04-18 12:30:28 -070047done
48
Mehrdad Afshari3b248942018-06-07 23:59:05 -070049exit $EXIT