1#!/bin/bash 2# Copyright (c) 2024-2025 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 17SCRIPT_DIR=$(realpath "$(dirname "${0}")") 18ROOT_DIR=${STATIC_ROOT_DIR:-"${SCRIPT_DIR}/../.."} 19 20 21function save_exit_code() { 22 return $(($1 + $2)) 23} 24 25source "${ROOT_DIR}/scripts/python/venv-utils.sh" 26activate_venv 27 28set +e 29 30EXIT_CODE=0 31RUNNER_DIR=${ROOT_DIR}/tests/tests-u-runner-2 32 33cd "${RUNNER_DIR}" 34 35echo "Pylint /runner, main.py" 36pylint --rcfile .pylintrc runner main.py --ignore=test262,config_test,reports,runner_file_based.py 37pylint --rcfile .pylintrc runner/extensions/generators/test262/ runner/test/config_test runner/reports runner/runner_file_based.py --disable=duplicate-code 38save_exit_code ${EXIT_CODE} $? 39EXIT_CODE=$? 40 41echo "MyPy main.py" 42mypy main.py 43save_exit_code ${EXIT_CODE} $? 44EXIT_CODE=$? 45 46echo "MyPy /runner" 47mypy -p runner 48save_exit_code ${EXIT_CODE} $? 49EXIT_CODE=$? 50 51echo "Ruff check" 52ruff check . 53save_exit_code ${EXIT_CODE} $? 54EXIT_CODE=$? 55 56echo "Check complexity with radon" 57flake8 --radon-max-cc 15 --select=R701 . 58save_exit_code ${EXIT_CODE} $? 59EXIT_CODE=$? 60 61set -e 62 63deactivate_venv 64exit ${EXIT_CODE} 65