Initial Robot U site prototype
This commit is contained in:
commit
fe19f200d7
27 changed files with 3677 additions and 0 deletions
19
scripts/check_frontend_quality.sh
Executable file
19
scripts/check_frontend_quality.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
frontend_dir="${root_dir}/frontend"
|
||||
|
||||
if command -v bun >/dev/null 2>&1; then
|
||||
bun_cmd=(bun)
|
||||
elif [[ -x "${HOME}/.bun/bin/bun" ]]; then
|
||||
bun_cmd=("${HOME}/.bun/bin/bun")
|
||||
else
|
||||
echo "bun is required to run frontend checks" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${frontend_dir}"
|
||||
"${bun_cmd[@]}" run check
|
||||
"${bun_cmd[@]}" run build
|
||||
|
||||
59
scripts/check_python_quality.sh
Executable file
59
scripts/check_python_quality.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
|
||||
status=0
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
python_files=(
|
||||
"app.py"
|
||||
"forgejo_client.py"
|
||||
"live_prototype.py"
|
||||
"settings.py"
|
||||
"tests"
|
||||
)
|
||||
|
||||
if [[ -x "${root_dir}/.venv/bin/python" ]]; then
|
||||
python_cmd=("${root_dir}/.venv/bin/python")
|
||||
else
|
||||
python_cmd=(python3)
|
||||
fi
|
||||
|
||||
run_check() {
|
||||
local label="$1"
|
||||
shift
|
||||
|
||||
echo "==> ${label}"
|
||||
if ! "$@"; then
|
||||
status=1
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
cd "${root_dir}"
|
||||
|
||||
run_check \
|
||||
"Ruff format" \
|
||||
uv run --with "ruff>=0.15.0,<1.0.0" \
|
||||
ruff format --check "${python_files[@]}"
|
||||
run_check \
|
||||
"Ruff lint" \
|
||||
uv run --with "ruff>=0.15.0,<1.0.0" \
|
||||
ruff check "${python_files[@]}"
|
||||
run_check \
|
||||
"Deptry" \
|
||||
uv run --with "deptry>=0.24.0,<1.0.0" \
|
||||
deptry . \
|
||||
--requirements-files requirements.txt \
|
||||
--known-first-party app,forgejo_client,live_prototype,settings \
|
||||
--per-rule-ignores DEP002=uvicorn \
|
||||
--extend-exclude ".*/frontend/.*" \
|
||||
--extend-exclude ".*/\\.venv/.*" \
|
||||
--extend-exclude ".*/__pycache__/.*"
|
||||
run_check \
|
||||
"Vulture" \
|
||||
uv run --with "vulture>=2.15,<3.0.0" \
|
||||
vulture app.py forgejo_client.py live_prototype.py settings.py tests --min-confidence 80
|
||||
run_check \
|
||||
"Backend Tests" \
|
||||
"${python_cmd[@]}" -m unittest discover -s tests -p "test_*.py"
|
||||
|
||||
exit "${status}"
|
||||
12
scripts/install_git_hooks.sh
Executable file
12
scripts/install_git_hooks.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
if ! git -C "${root_dir}" rev-parse --git-dir >/dev/null 2>&1; then
|
||||
echo "Skipping git hook install because ${root_dir} is not a git repository."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git -C "${root_dir}" config core.hooksPath .githooks
|
||||
echo "Installed git hooks from ${root_dir}/.githooks"
|
||||
Loading…
Add table
Add a link
Reference in a new issue