|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2025 Google LLC |
| 3 | +# |
| 4 | +# 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 |
| 7 | +# |
| 8 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# 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. |
| 15 | + |
| 16 | +# Summary: make it easy to run pylint on directories that contain Python files |
| 17 | +# and avoid tests/googletest/. |
| 18 | + |
| 19 | +set -e |
| 20 | + |
| 21 | +declare -r usage="Usage: ${0} [-h | --help] [args ...] |
| 22 | +
|
| 23 | +If the first argument on the command line is the option --help or -h, this |
| 24 | +program prints usage information and then exits. Otherwise, it runs Pylint on |
| 25 | +the Python files of this project. It passes all command-line arguments (other |
| 26 | +than -h, --help, or help) to Pylint along with the project source directories." |
| 27 | + |
| 28 | +# Exit early if the user requested help. |
| 29 | +if [[ "${1}" == "-h" || "${1}" == "--help" || "${1}" == "help" ]]; then |
| 30 | + echo "$usage" |
| 31 | + exit 0 |
| 32 | +fi |
| 33 | + |
| 34 | +# Go to the project root. |
| 35 | +thisdir=$(dirname "${BASH_SOURCE[0]:?}") |
| 36 | +repo_dir=$(git -C "${thisdir}" rev-parse --show-toplevel) |
| 37 | +cd "${repo_dir}" |
| 38 | + |
| 39 | +pylint --jobs=0 --ignore-paths=tests/googletest "$@" . |
0 commit comments