Files
oidc2fer/bin/pylint
Jonathan Perret 3e71b2166c 🏗️(common) replace Django app with SATOSA
We mostly import SATOSA and launch its WSGI app.
2024-04-17 14:46:15 +02:00

39 lines
927 B
Bash
Executable File

#!/usr/bin/env bash
# shellcheck source=bin/_config.sh
source "$(dirname "${BASH_SOURCE[0]}")/_config.sh"
declare diff_from
declare -a paths
declare -a args
# Parse options
for arg in "$@"
do
case $arg in
--diff-only=*)
diff_from="${arg#*=}"
shift
;;
-*)
args+=("$arg")
shift
;;
*)
paths+=("$arg")
shift
;;
esac
done
if [[ -n "${diff_from}" ]]; then
# Run pylint only on modified files located in src/satosa
# (excluding deleted files)
# shellcheck disable=SC2207
paths=($(git diff "${diff_from}" --name-only --diff-filter=d -- src/satosa | grep -E '^src/satosa/.*\.py$'))
fi
# Fix docker vs local path when project sources are mounted as a volume
read -ra paths <<< "$(echo "${paths[@]}" | sed "s|src/satosa/||g")"
_dc_run app-dev pylint "${paths[@]}" "${args[@]}"