Liking cljdoc? Tell your friends :D

clj-xref.core

Query API for clj-xref cross-reference databases.

Typical usage: ;; Load a database generated by lein xref or clj -T:xref generate (def db (xref/load-db))

;; Query it (xref/who-calls db 'my.ns/my-fn) (xref/calls-who db 'my.ns/my-fn) (xref/who-references db 'my.ns/config)

Query API for clj-xref cross-reference databases.

Typical usage:
  ;; Load a database generated by `lein xref` or `clj -T:xref generate`
  (def db (xref/load-db))

  ;; Query it
  (xref/who-calls db 'my.ns/my-fn)
  (xref/calls-who db 'my.ns/my-fn)
  (xref/who-references db 'my.ns/*config*)
raw docstring

analyzeclj

(analyze paths & [opts])

Run clj-kondo analysis on paths and return an indexed xref database. Requires clj-kondo on the classpath. Options are passed to clj-xref.analyze/analyze.

Run clj-kondo analysis on `paths` and return an indexed xref database.
Requires clj-kondo on the classpath. Options are passed to
`clj-xref.analyze/analyze`.
sourceraw docstring

aproposclj

(apropos db pattern)

Find vars whose fully-qualified name matches pattern (string or regex).

Find vars whose fully-qualified name matches `pattern` (string or regex).
sourceraw docstring

call-graphclj

(call-graph db
            sym
            &
            [{:keys [depth direction] :or {depth 3 direction :outgoing}}])

Build a transitive call graph starting from sym. Returns a set of [from to] edges. Options: :depth - max traversal depth (default 3) :direction - :outgoing (what does sym call?) or :incoming (who calls sym?)

Build a transitive call graph starting from `sym`.
Returns a set of [from to] edges.
Options:
  :depth     - max traversal depth (default 3)
  :direction - :outgoing (what does sym call?) or :incoming (who calls sym?)
sourceraw docstring

calls-whoclj

(calls-who db sym)

Find all vars called by sym. Returns xref entries with :kind :call.

Find all vars called by `sym`. Returns xref entries with :kind :call.
sourceraw docstring

from-kondo-analysisclj

(from-kondo-analysis kondo-result & [{:keys [paths project]}])

Build an indexed xref database from a pre-computed clj-kondo result (the return value of clj-kondo.core/run!). The result must contain :analysis data (enable with {:config {:analysis true}}).

Build an indexed xref database from a pre-computed clj-kondo result
(the return value of `clj-kondo.core/run!`). The result must contain
:analysis data (enable with {:config {:analysis true}}).
sourceraw docstring

indexclj

(index db)

Add in-memory indexes to a flat xref database map. Call this on raw database maps (e.g., from EDN or from analyze) to enable queries.

Add in-memory indexes to a flat xref database map.
Call this on raw database maps (e.g., from EDN or from `analyze`)
to enable queries.
sourceraw docstring

load-dbclj

(load-db)
(load-db path)

Load an xref database from an EDN file and build in-memory indexes. Defaults to .clj-xref/xref.edn in the current directory.

Load an xref database from an EDN file and build in-memory indexes.
Defaults to `.clj-xref/xref.edn` in the current directory.
sourceraw docstring

ns-dependentsclj

(ns-dependents db ns-sym)

Return the set of namespaces that depend on ns-sym (namespaces containing references to vars in ns-sym).

Return the set of namespaces that depend on `ns-sym`
(namespaces containing references to vars in `ns-sym`).
sourceraw docstring

ns-depsclj

(ns-deps db ns-sym)

Return the set of namespaces that ns-sym depends on (namespaces of vars referenced from ns-sym).

Return the set of namespaces that `ns-sym` depends on
(namespaces of vars referenced from `ns-sym`).
sourceraw docstring

ns-varsclj

(ns-vars db ns-sym)

List all var definitions in namespace ns-sym.

List all var definitions in namespace `ns-sym`.
sourceraw docstring

unused-varsclj

(unused-vars db & [{:keys [include-private?] :or {include-private? false}}])

Find vars that are defined but never referenced. Options: :include-private? - include private vars (default false)

Find vars that are defined but never referenced.
Options:
  :include-private? - include private vars (default false)
sourceraw docstring

who-callsclj

(who-calls db sym)

Find all call sites of sym. Returns xref entries with :kind :call.

Find all call sites of `sym`. Returns xref entries with :kind :call.
sourceraw docstring

who-dispatchesclj

(who-dispatches db sym)

Find all defmethod dispatch values for the multimethod sym.

Find all defmethod dispatch values for the multimethod `sym`.
sourceraw docstring

who-implementsclj

(who-implements db sym)

Find all implementations of the protocol sym.

Find all implementations of the protocol `sym`.
sourceraw docstring

who-macroexpandsclj

(who-macroexpands db sym)

Find all macroexpansion sites of the macro sym.

Find all macroexpansion sites of the macro `sym`.
sourceraw docstring

who-referencesclj

(who-references db sym)

Find all references to sym (any kind: call, reference, macroexpand, etc.).

Find all references to `sym` (any kind: call, reference, macroexpand, etc.).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close