# Copyright 2020 The Quark Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash
################################################################################
# Runs multiple checks
#
# Usage:
#     check [pytest] [coverage] [pylint] [tutorials]
################################################################################

# Get the working directory to the repo root.
REPO=$(git rev-parse --show-superproject-working-tree --show-toplevel | head -1)
echo "run checks in $REPO"

# go into development_tools module 
cd $REPO/modules/development_tools

# check if development_tools are initialized
if [ "$(ls -A)" ]; then
    # calling the actual script passing all arguments
    checks/check.sh "$REPO" "$@"
else
    printf "\nERROR: Cannot run checks as directory 'modules/development_tools' is empty,\n       please use 'git submodule update --init' to get submodule(s)\n\n"
fi
