mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 22:43:02 +02:00
- Move fresh-install/ → scripts/single_use/fresh-install/ - Move hosts/ → scripts/periodic_background/hosts/ - Move i3-configuration/ → scripts/periodic_background/i3-configuration/ - Delete linux_configuration/LaTeX/, nix-poc/, report/ (dead dirs) - Move repo-root scripts/ → meta/scripts/ - Update root .pre-commit-config.yaml: scripts/ → meta/scripts/ (9 entries) - Update run.sh ARTIFACT_INIT_SCRIPT to meta/scripts/ - Update fresh-install/main.sh: hosts/install.sh + i3-configuration/install.sh paths - Update check_python_location.sh: add meta/scripts/ to exception list - Fix midnight flakiness in test_recent_workout_returns_true: use timezone-aware local noon instead of now-1h to avoid SQL date() boundary issues
45 lines
1.2 KiB
Bash
Executable File
45 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Check that all Python files are under python_pkg/.
|
|
# Exceptions: linux_configuration/, Bash/,
|
|
# and vendored/generated directories.
|
|
# Used as a pre-commit hook; receives staged file paths as arguments.
|
|
|
|
set -uo pipefail
|
|
|
|
errors=()
|
|
|
|
for file in "$@"; do
|
|
# Only check .py files
|
|
[[ "$file" != *.py ]] && continue
|
|
|
|
# Skip files already under python_pkg/
|
|
[[ "$file" == python_pkg/* ]] && continue
|
|
|
|
# Skip allowed directories (non-Python projects with some Python scripts)
|
|
case "$file" in
|
|
linux_configuration/*|scripts/*|meta/scripts/*) continue ;;
|
|
esac
|
|
|
|
# Skip vendored/generated directories
|
|
skip=0
|
|
for part in /.venv/ /venv/ /__pycache__/ /build/ /dist/ /node_modules/ /.git/; do
|
|
case "/$file" in
|
|
*"$part"*) skip=1; break ;;
|
|
esac
|
|
done
|
|
[[ $skip -eq 1 ]] && continue
|
|
|
|
errors+=("$file")
|
|
done
|
|
|
|
if [[ ${#errors[@]} -gt 0 ]]; then
|
|
echo "ERROR: Python files must be under python_pkg/."
|
|
echo "The following files are in the wrong location:"
|
|
for err in "${errors[@]}"; do
|
|
echo " $err"
|
|
done
|
|
echo ""
|
|
echo "Move them with: git mv <file> python_pkg/<file>"
|
|
exit 1
|
|
fi
|