Skip to content
Merged
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 backend/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def iter_files(root: Path):
try: size = p.stat().st_size
except OSError: continue
if size > 300_000: continue
if p.suffix.lower() in TEXT_EXTENSIONS or p.name.lower().endswith(".env.example") or p.name.lower() in {"dockerfile","makefile",".gitignore"}:
if p.suffix.lower() in TEXT_EXTENSIONS or p.name.lower().endswith(".env.example") or p.name.lower() in {"dockerfile","makefile",".gitignore","go.mod","gemfile"}:
yield p

def read_text(path: Path): return path.read_text(encoding="utf-8", errors="replace")
Expand Down
23 changes: 23 additions & 0 deletions backend/tests/test_manifest_retrieval.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import tempfile
import unittest
from pathlib import Path

from services.analyzer import analyze, build_context, search_code


class ManifestRetrievalTests(unittest.TestCase):
def test_go_and_ruby_manifests_are_available_to_repository_tools(self):
for name, declaration in [
("go.mod", "module example.test/sprocket"),
("Gemfile", 'gem "sprocket"'),
]:
with self.subTest(name=name), tempfile.TemporaryDirectory() as directory:
root = Path(directory)
(root / name).write_text(declaration, encoding="utf-8")
(root / "unrelated.mod").write_bytes(b"unrelated")

analysis = analyze(root)
self.assertTrue(analysis["signals"]["manifest"])
self.assertEqual([row["path"] for row in analysis["files"]], [name])
self.assertEqual(search_code(root, "sprocket")[0]["text"], declaration)
self.assertIn(declaration, build_context(root, "sprocket"))
Loading