job_specs: add wireguard perf tests to regression
[csit.git] / resources / libraries / bash / entry / tox / pylint.sh
1 # Copyright (c) 2022 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 set -exuo pipefail
15
16 # This file should be executed from tox, as the assumend working directory
17 # is different from where this file is located.
18 # This file does not have executable flag nor shebang,
19 # to dissuade non-tox callers.
20
21 # This script runs pylint and propagates its exit code.
22 # Config is taken from pylint.cfg,
23 # and proper virtualenv is assumed to be active.
24 # The pylint output stored to pylint.log (overwriting).
25
26 # "set -eu" handles failures from the following two lines.
27 BASH_CHECKS_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
28 BASH_FUNCTION_DIR="$(readlink -e "${BASH_CHECKS_DIR}/../../function")"
29 source "${BASH_FUNCTION_DIR}/common.sh" || {
30     echo "Source failed." >&2
31     exit 1
32 }
33 pylint_args=("--rcfile=pylint.cfg" "resources/" "GPL/traffic_scripts")
34 if pylint "${pylint_args[@]}" > "pylint.log"; then
35     warn
36     warn "Pylint checker: PASS"
37 else
38     # TODO: Decide which text goes to stdout and which to stderr.
39     warn "Pylint exited with nonzero status."
40     ## TODO: Enable when output size does more good than harm.
41     # cat "pylint.log" >&2
42     warn
43     warn "Pylint checker: FAIL"
44     exit 1
45 fi