Skip to content

Commit 1767cbc

Browse files
authored
feat: Java/Kotlin findings entries and docs — completes JVM import graph (issue-2, PR 3/3) (#32)
1 parent a2750e3 commit 1767cbc

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ on the knowledge graph discovers your rules — and vice versa.
120120
| Branch classification | `git for-each-ref` + `--merged` ancestry vs the integration branch (auto-detects `staging`/`develop`), cross-referenced with every PR's head ref via `gh` — distinguishes true merges from squash-merges from abandoned work |
121121
| PR catalog | `gh pr list --state all` — open / merged / closed-unmerged, full appendix table |
122122
| Module inventory | Filesystem walk with LOC per directory, language detection, generated-code flagging |
123-
| Import graph | Go: `import` blocks resolved against `go.mod` module paths · Python: stdlib `ast` incl. relative imports · JS/TS: relative `import`/`require` resolution · Rust: `use` declarations resolved against Cargo crate names (cross-crate) and `src/` module trees (intra-crate). Directory→directory edges with counts |
123+
| Import graph | Go: `import` blocks resolved against `go.mod` module paths · Python: stdlib `ast` incl. relative imports · JS/TS: relative `import`/`require` resolution · Rust: `use` declarations resolved against Cargo crate names (cross-crate) and `src/` module trees (intra-crate) · Java/Kotlin: imports resolved by longest prefix against `package` declarations. Directory→directory edges with counts |
124124
| Ops surface | CI workflow names, Dockerfiles, compose files, Helm charts, Makefile targets, config/docs/test/migration dirs |
125125
| Timeline | Merged PRs grouped by month with conventional-commit scope frequencies (replaced by agent-written eras after enrichment) |
126126

@@ -143,13 +143,16 @@ schema — everything else stays deterministic and reproducible.
143143
- **Rust**: `use` declarations only — macro-generated imports, re-export
144144
chains, and `[dependencies] path = …` (non-workspace) crates are not
145145
resolved; `crate::` paths ground only in module dirs/files that exist.
146+
- **Java/Kotlin**: explicit imports only — same-package references (no import
147+
needed) and fully-qualified inline names produce no edges; when a package is
148+
declared only in test roots, edges resolve there.
146149
- Branch `ahead` counts use one batched git call on git ≥ 2.41, with a
147150
per-branch fallback on older git.
148151

149152
## Roadmap
150153

151154
- [x] Rust import graph
152-
- [ ] Java / Kotlin import graphs
155+
- [x] Java / Kotlin import graphs
153156
- [ ] `--exclude` glob patterns
154157
- [ ] `llms.txt` emission alongside KNOWLEDGE_GRAPH.md
155158
- [ ] tsconfig `paths` alias resolution

src/repokg/findings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
"Rust": ("medium", "regex `use` parsing resolved against Cargo [package] "
2424
"names and src/ module dirs; macros, re-exports and "
2525
"path-dependencies are not resolved"),
26+
"Java": ("high", "imports resolved by longest prefix against package "
27+
"declarations (language ground truth); test source roots "
28+
"excluded as targets when a main root declares the package"),
29+
"Kotlin": ("high", "same package-declaration resolution as Java, incl. "
30+
"Kotlin's collapsed directory convention; `as` aliases "
31+
"handled, extension-function call sites are not imports"),
2632
}
2733

2834

tests/test_validate.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def test_build_and_render(self):
5757
],
5858
"edges": [{"from": "a", "to": "b", "lang": "JS/TS", "count": 1},
5959
{"from": "a", "to": "b", "lang": "Go", "count": 2},
60-
{"from": "a", "to": "c", "lang": "Rust", "count": 1}],
60+
{"from": "a", "to": "c", "lang": "Rust", "count": 1},
61+
{"from": "a", "to": "d", "lang": "Java", "count": 1},
62+
{"from": "a", "to": "d", "lang": "Kotlin", "count": 1}],
6163
"modules": [{"path": "gen/pb", "generated": True}],
6264
"prs": [{"number": 1}],
6365
"github_note": "",
@@ -71,6 +73,8 @@ def test_build_and_render(self):
7173
self.assertEqual(confs["1 Go edges"], "high")
7274
self.assertEqual(confs["1 JS/TS edges"], "medium")
7375
self.assertEqual(confs["1 Rust edges"], "medium")
76+
self.assertEqual(confs["1 Java edges"], "high")
77+
self.assertEqual(confs["1 Kotlin edges"], "high")
7478
self.assertEqual(confs["1 modules flagged generated"], "low")
7579
self.assertTrue(any("Fork PRs" in n for n in notes))
7680
text = render_text(found, notes)

0 commit comments

Comments
 (0)