• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15set -e
16
17if [[ -z $1 ]]; then
18    echo "Usage: linter.sh <panda source>"
19    echo "    <panda source> path where the panda source are located"
20    exit 1
21fi
22
23ROOT_DIR=$(realpath $1)
24
25
26function save_exit_code() {
27    EXIT_CODE=$(($1 + $2))
28}
29
30source ${ROOT_DIR}/scripts/python/venv-utils.sh
31activate_venv
32
33set +e
34
35EXIT_CODE=0
36RUNNER_DIR=${ROOT_DIR}/tests/tests-u-runner
37
38cd ${RUNNER_DIR}
39
40pylint --rcfile .pylintrc runner main.py runner_test.py
41save_exit_code ${EXIT_CODE} $?
42
43mypy main.py
44save_exit_code ${EXIT_CODE} $?
45
46mypy -p runner
47save_exit_code ${EXIT_CODE} $?
48
49set -e
50
51deactivate_venv
52exit ${EXIT_CODE}
53