Skip to content

Parse deps.edn and bb.edn dependencies and alias deps - #183

Open
abhinavgautam01 wants to merge 1 commit into
git-pkgs:mainfrom
abhinavgautam01:clojure-deps-edn
Open

abhinavgautam01 wants to merge 1 commit into
git-pkgs:mainfrom
abhinavgautam01:clojure-deps-edn

Conversation

@abhinavgautam01

Copy link
Copy Markdown
Contributor

Part of #77 (the Clojure item).

Summary

Adds a clojars manifest parser for tools.deps deps.edn and babashka bb.edn, next to the existing project.clj parser, on top of a small EDN reader.

EDN reader

internal/clojure/edn.go reads maps, vectors, lists, sets, strings, keywords, symbols, numbers and characters. It also handles ; comments, commas, #_ discards, tagged literals such as #inst "..." (read as the value they tag) and ^ metadata (dropped). Nesting is capped at 100 levels, including through discards, metadata and tags, so hostile input returns a ParseError instead of exhausting the stack, the same protection the Erlang term reader got in #174.

Coordinates

Coordinate Result
{:mvn/version "1.11.1"} Version: 1.11.1
org.lwjgl/lwjgl$natives-linux Name: org.lwjgl/lwjgl, location keeps the classifier
{:git/url U :git/sha S :git/tag T :deps/root R} git source with Ref: S, Tag: T, Rel: R
{:git/url U :sha S} (older keys) same, from :sha / :tag
io.github.user/repo {:git/sha S} URL inferred as https://github.com/user/repo.git, as tools.deps does (also io.gitlab, io.bitbucket and their com. / org. forms)
{:local/root "../lib"} path source
a map with none of these keys skipped

Git and local dependencies keep their name and PURL with the source recorded, as Cargo.toml and rebar.config git dependencies do.

Scopes and locations

  • Top-level :deps are runtime under deps/<lib>.
  • Each alias's :extra-deps, :replace-deps and :deps are reported under aliases/<alias>/<key>/<lib>. An alias name containing test gives test scope, build (or build/...) gives build and any other alias gives development.
  • :override-deps and :default-deps only adjust versions, so they are not reported.
  • In bb.edn, :pods are babashka pods rather than libraries and are not reported.

:mvn/repos is not read here. It could become Registries in a follow-up.

Tests

  • internal/clojure/edn_test.go covers each EDN form, discards, tags, metadata, syntax errors and the depth limit at exactly 100 levels and beyond.
  • internal/clojure/deps_test.go covers both fixtures exactly (scopes, git and local sources, inferred URLs, classifiers, locations), malformed entries, non-map input, alias scope rules and URL inference.
  • clojure_deps_test.go goes through Parse, checking PURLs on dependencies and declarations.
  • New rows in TestIdentifyFiles and TestParseAllEcosystems.
  • Fixtures: testdata/clojure/deps.edn and testdata/clojure/bb.edn.
  • README: both files in the ecosystem table and a "Clojure deps.edn output" section.

go build ./..., go vet ./..., go test ./... and golangci-lint run ./... all pass.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 908d71b3-114e-44f3-a4be-c7178c173e18
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant