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
1 change: 1 addition & 0 deletions openviking/parse/parsers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
".py",
".java",
".cpp",
".cc",
".c",
".h",
".hpp",
Expand Down
4 changes: 3 additions & 1 deletion tests/parse/test_directory_parser_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def tmp_all_parsers(tmp_path: Path) -> Path:
bundle.zip -> ZipParser
code/
app.py -> text-fallback (is_text_file)
engine.cc -> text-fallback
main.js -> text-fallback
style.css -> text-fallback
config/
Expand Down Expand Up @@ -112,6 +113,7 @@ def tmp_all_parsers(tmp_path: Path) -> Path:

(tmp_path / "code").mkdir()
(tmp_path / "code" / "app.py").write_text("print(1)", encoding="utf-8")
(tmp_path / "code" / "engine.cc").write_text("int main() { return 0; }", encoding="utf-8")
(tmp_path / "code" / "main.js").write_text("console.log(1)", encoding="utf-8")
(tmp_path / "code" / "style.css").write_text("body{}", encoding="utf-8")

Expand Down Expand Up @@ -166,7 +168,7 @@ class TestParserSelection:
# Extensions that are *processable* (via is_text_file) but have no
# dedicated parser in the registry – they fall back to TextParser at
# parse-time via ``ParserRegistry.parse``.
TEXT_FALLBACK_EXTENSIONS = {".py", ".js", ".css", ".yaml", ".json", ".toml"}
TEXT_FALLBACK_EXTENSIONS = {".py", ".cc", ".js", ".css", ".yaml", ".json", ".toml"}

def test_dedicated_parsers_resolve(self, registry: ParserRegistry) -> None:
"""get_parser_for_file returns the correct class for each extension."""
Expand Down
2 changes: 2 additions & 0 deletions tests/parse/test_directory_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def tmp_tree(tmp_path: Path) -> Path:

# text (code/config, no dedicated parser or text parser only): .py, .yaml
(tmp_path / "main.py").write_text("print(1)", encoding="utf-8")
(tmp_path / "engine.cc").write_text("int main() { return 0; }", encoding="utf-8")
(tmp_path / "config.yaml").write_text("key: value", encoding="utf-8")

# unsupported: unknown extension
Expand Down Expand Up @@ -136,6 +137,7 @@ def test_processable_includes_code_or_config(
result: DirectoryScanResult = scan_directory(tmp_tree, registry=registry, strict=False)
processable_rel = [f.rel_path for f in result.processable]
assert "main.py" in processable_rel
assert "engine.cc" in processable_rel
assert "config.yaml" in processable_rel
assert "src/app.py" in processable_rel

Expand Down
Loading