Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graphify/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FileType(str, Enum):

_MANIFEST_PATH = "graphify-out/manifest.json"

CODE_EXTENSIONS = {'.py', '.ts', '.js', '.jsx', '.tsx', '.go', '.rs', '.java', '.cpp', '.cc', '.cxx', '.c', '.h', '.hpp', '.rb', '.swift', '.kt', '.kts', '.cs', '.scala', '.php', '.lua', '.toc', '.zig', '.ps1', '.ex', '.exs', '.m', '.mm', '.jl'}
CODE_EXTENSIONS = {'.py', '.ts', '.js', '.jsx', '.tsx', '.go', '.rs', '.java', '.cpp', '.cc', '.cxx', '.c', '.h', '.hpp', '.rb', '.swift', '.kt', '.kts', '.cs', '.scala', '.php', '.lua', '.toc', '.zig', '.ps1', '.ex', '.exs', '.m', '.mm', '.jl', '.gd'}
DOC_EXTENSIONS = {'.md', '.txt', '.rst'}
PAPER_EXTENSIONS = {'.pdf'}
IMAGE_EXTENSIONS = {'.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg'}
Expand Down
1 change: 1 addition & 0 deletions graphify/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2677,6 +2677,7 @@ def collect_files(target: Path, *, follow_symlinks: bool = False) -> list[Path]:
".rb", ".cs", ".kt", ".kts", ".scala", ".php", ".swift",
".lua", ".toc", ".zig", ".ps1",
".m", ".mm",
".gd",
}
if not follow_symlinks:
results: list[Path] = []
Expand Down
5 changes: 5 additions & 0 deletions tests/test_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ def test_classify_python():
def test_classify_typescript():
assert classify_file(Path("bar.ts")) == FileType.CODE

def test_classify_godot_gd():
# GDScript files (.gd) are Godot engine scripts and should be treated as code
assert classify_file(Path("Player.gd")) == FileType.CODE
assert classify_file(Path("scenes/Enemy.gd")) == FileType.CODE

def test_classify_markdown():
assert classify_file(Path("README.md")) == FileType.DOCUMENT

Expand Down
11 changes: 10 additions & 1 deletion tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_collect_files_from_dir():
".java", ".c", ".cpp", ".cc", ".cxx", ".rb",
".cs", ".kt", ".kts", ".scala", ".php", ".h", ".hpp",
".swift", ".lua", ".toc", ".zig", ".ps1", ".ex", ".exs",
".m", ".mm"}
".m", ".mm", ".gd"}
assert all(f.suffix in supported for f in files)
assert len(files) > 0

Expand All @@ -73,6 +73,15 @@ def test_collect_files_skips_hidden():
assert not any(part.startswith(".") for part in f.parts)


def test_collect_files_picks_up_godot_gd(tmp_path):
# Regression test for #535 - Godot .gd script files were not being
# picked up by collect_files() after v0.50.0 upgrade.
gd_file = tmp_path / "Player.gd"
gd_file.write_text("extends Node\n\nfunc _ready():\n pass\n")
files = collect_files(tmp_path)
assert gd_file in files


def test_collect_files_follows_symlinked_directory(tmp_path):
real_dir = tmp_path / "real_src"
real_dir.mkdir()
Expand Down
Loading