utils/godot_dev_tools/lint.sh
Krzysztof kuhy Rudnicki 1869fdee02
Some checks failed
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
godot_dev_tools tests / test (push) Has been cancelled
Fix godot_dev_tools lint race, release 0.1.1
lint.sh ran gdlint/gdformat via xargs -P; on a cold cache the
processes race in os.makedirs and report a file as unopenable.
Run one process per tool. Pin CI Python 3.15.2, chmod Godot.
Bump version and README tags to 0.1.1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWXs4gEhEUMr9rgYG9V
2026-11-16 14:48:32 +01:00

35 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# Lint of the dev_tools addon and its tests: gdlint (.gdlintrc, every check on)
# and gdformat --check. gdtoolkit is pinned in requirements-dev.txt
# (pip install -r godot_dev_tools/requirements-dev.txt, or uv tool install).
# ============================================================================
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly HERE
main() {
local tool files=()
for tool in gdlint gdformat; do
command -v "$tool" >/dev/null || {
echo "Error: $tool not found (pip install -r $HERE/requirements-dev.txt)" >&2
exit 1
}
done
mapfile -t files < <(find "$HERE/addons/dev_tools" "$HERE/tests" -name '*.gd' -type f | sort)
# One process per tool, not xargs -P: parallel gdtoolkit processes race to
# create their grammar cache dir (os.makedirs EEXIST) on a cold cache and
# report a file as unopenable.
(cd "$HERE" && gdlint "${files[@]}" >/dev/null)
gdformat --check "${files[@]}" >/dev/null 2>&1 || {
gdformat --check "${files[@]}" 2>&1 | grep -v 'left unchanged' >&2 || true
exit 1
}
echo "godot_dev_tools lint: ${#files[@]} files ok"
}
main "$@"