Files
tekton/scripts/lint.gd
T
GMaysa e539a862d5
CI / Export Windows (push) Failing after 43s
CI / Export Linux (push) Failing after 1m4s
CI / Export Android (push) Failing after 55s
Test Suite / Unit Tests (GUT) (push) Failing after 39s
Test Suite / Integration Tests (push) Failing after 46s
Test Suite / Code Style Check (push) Failing after 46s
CI / Create Release (push) Has been skipped
Test Suite / Security Scan (push) Failing after 1m1s
Clean the yml script
2026-07-02 16:40:52 +08:00

37 lines
1001 B
GDScript

extends SceneTree
const SKIP_DIRS := [".git", ".godot", "addons"]
func _initialize() -> void:
var errors: Array[String] = []
_scan_dir("res://", errors)
if errors.is_empty():
print("Lint passed: no GDScript syntax errors found")
quit(0)
else:
for e in errors:
printerr(e)
printerr("Lint failed: %d file(s) with syntax errors" % errors.size())
quit(1)
func _scan_dir(path: String, errors: Array[String]) -> void:
var dir := DirAccess.open(path)
if dir == null:
return
dir.list_dir_begin()
var entry := dir.get_next()
while entry != "":
if entry == "." or entry == "..":
entry = dir.get_next()
continue
var full_path := path.path_join(entry)
if dir.current_is_dir():
if not SKIP_DIRS.has(entry):
_scan_dir(full_path, errors)
elif entry.ends_with(".gd"):
var script := GDScript.new()
script.source_code = FileAccess.get_file_as_string(full_path)
if script.reload() != OK:
errors.append("%s: syntax error" % full_path)
entry = dir.get_next()