Liking cljdoc? Tell your friends :D

systems.thoughtfull.assay.dependencies.interface

Brick dependency metrics from namespace requires, after Robert Martin's package metrics, adapted to Polylith: a brick depends on an interface, and so on every component that implements it.

  • Afferent (Ca): bricks that depend on this brick's interface.
  • Efferent (Ce): interfaces this brick depends on.
  • Instability: Ce / (Ca + Ce), undefined for a brick with neither.
  • Abstractness: 1 - interface definitions / all definitions. A small interface over a large implementation is abstract; bases are 0.
  • Cohesion: references to the brick's own namespaces / references to any workspace namespace.
  • Shared keywords: keywords this brick uses that another brick also uses, usually map keys the bricks must agree on (connascence of meaning).
  • Libraries: libraries outside the workspace the brick requires, and shared libraries, those another brick also requires.
  • Error surface: a component's interface definitions that can throw, directly or through what they refer to.
  • Untested interface: a component's interface definitions that no test in the workspace mentions.

Dependency rules map a check to a level (:error or :warning), or to nil to turn it off:

  • :stable-dependencies flags a dependency on a less stable brick (the Stable Dependencies Principle).
  • :new-dependencies flags a dependency that is not in the base, when comparing with one (applied by the baseline component).
  • :mutable-state flags top-level atoms, refs, agents, volatiles, and dynamic vars, and alter-var-root calls, in components.
  • :broad-catch flags catch clauses for Exception, RuntimeException, Throwable, or Object in components.
  • :test-boundary flags a require, in a brick's tests, of another brick's namespace other than its interface.

Five rules take settings as a map with :level:

  • :connascence-of-position {:max n} flags interface functions that other bricks call with more than n positional parameters.
  • :duplicate-code {:min-forms n} flags code of at least n forms that appears in more than one brick (connascence of algorithm).
  • :merge-candidates {:max-size r} flags a component whose only dependent is another component, when its forms are at most r times the dependent's.
  • :co-change {:since s :min-shared n :min-strength r :max-bricks-per-commit m} flags two bricks with no dependency path between them that changed together in at least n commits since s, and in at least r of the less changed brick's commits. Commits that touch more than m bricks don't count. check reads the commits from the analysis's :commits, each a set of changed paths, and skips the rule without them.
  • :library-spread {:max-bricks n} flags each require of a library outside the workspace that more than n bricks require.
Brick dependency metrics from namespace requires, after Robert Martin's
package metrics, adapted to Polylith: a brick depends on an interface, and
so on every component that implements it.

- Afferent (Ca): bricks that depend on this brick's interface.
- Efferent (Ce): interfaces this brick depends on.
- Instability: Ce / (Ca + Ce), undefined for a brick with neither.
- Abstractness: 1 - interface definitions / all definitions. A small
  interface over a large implementation is abstract; bases are 0.
- Cohesion: references to the brick's own namespaces / references to any
  workspace namespace.
- Shared keywords: keywords this brick uses that another brick also
  uses, usually map keys the bricks must agree on (connascence of
  meaning).
- Libraries: libraries outside the workspace the brick requires, and
  shared libraries, those another brick also requires.
- Error surface: a component's interface definitions that can throw,
  directly or through what they refer to.
- Untested interface: a component's interface definitions that no test
  in the workspace mentions.

Dependency rules map a check to a level (:error or :warning), or to nil to
turn it off:

- :stable-dependencies flags a dependency on a less stable brick (the
  Stable Dependencies Principle).
- :new-dependencies flags a dependency that is not in the base, when
  comparing with one (applied by the baseline component).
- :mutable-state flags top-level atoms, refs, agents, volatiles, and
  dynamic vars, and alter-var-root calls, in components.
- :broad-catch flags catch clauses for Exception, RuntimeException,
  Throwable, or Object in components.
- :test-boundary flags a require, in a brick's tests, of another brick's
  namespace other than its interface.

Five rules take settings as a map with :level:

- :connascence-of-position {:max n} flags interface functions that other
  bricks call with more than n positional parameters.
- :duplicate-code {:min-forms n} flags code of at least n forms that
  appears in more than one brick (connascence of algorithm).
- :merge-candidates {:max-size r} flags a component whose only dependent
  is another component, when its forms are at most r times the
  dependent's.
- :co-change {:since s :min-shared n :min-strength r
  :max-bricks-per-commit m} flags two bricks with no dependency path
  between them that changed together in at least n commits since s,
  and in at least r of the less changed brick's commits. Commits that
  touch more than m bricks don't count. check reads the commits from the
  analysis's :commits, each a set of changed paths, and skips the rule
  without them.
- :library-spread {:max-bricks n} flags each require of a library outside
  the workspace that more than n bricks require.
raw docstring

analyzeclj

(analyze workspace measurements)

Add dependency metrics to measurements (from the metrics component), given the workspace's settings, a map of :top-namespace and :interface-ns. Returns a map of :bricks (measurements with :afferent, :efferent, :instability, :abstractness, :cohesion, :shared-keywords, :libraries, :shared-libraries, :error-surface, and :untested-interface added to :metrics), :libraries (each library outside the workspace as {:library :bricks :requires}, most spread first), :edges (a vector of {:from brick-name :to brick-name :interface name :location {:file :line}}), and what check needs: :workspace and :used.

Add dependency metrics to measurements (from the metrics component),
given the workspace's settings, a map of :top-namespace and
:interface-ns. Returns a map of :bricks (measurements with :afferent,
:efferent, :instability, :abstractness, :cohesion, :shared-keywords,
:libraries, :shared-libraries, :error-surface, and :untested-interface
added to :metrics), :libraries (each
library outside the workspace as {:library :bricks :requires}, most
spread first), :edges (a vector of {:from brick-name :to brick-name
:interface name :location {:file :line}}), and what check needs:
:workspace and :used.
raw docstring

checkclj

(check rules analysis)

Violations of dependency rules (merged over default-rules) in an analysis from analyze, with :commits added for the :co-change rule.

Violations of dependency rules (merged over default-rules) in an
analysis from analyze, with :commits added for the :co-change rule.
raw docstring

default-rulesclj

Dependency rules used when no configuration overrides them.

Dependency rules used when no configuration overrides them.
raw docstring

merge-rulesclj

(merge-rules rules)

Merge configured dependency rules over default-rules. A map-valued rule merges key by key.

Merge configured dependency rules over default-rules. A map-valued rule
merges key by key.
raw docstring

mermaidclj

(mermaid bricks edges violations)

A Mermaid flowchart of the brick graph, top-down. Bases have rounded ends. Edges in a stable-dependencies violation are red, co-change violations add dotted amber lines without arrows, and new dependencies (from comparing with a base) are dashed.

A Mermaid flowchart of the brick graph, top-down. Bases have rounded
ends. Edges in a stable-dependencies violation are red, co-change
violations add dotted amber lines without arrows, and new
dependencies (from comparing with a base) are dashed.
raw docstring

neighborsclj

(neighbors bricks edges)

For each brick, in order: a map of :brick, :depends-on, and :depended-on-by, the sorted names of the bricks on each side of its edges.

For each brick, in order: a map of :brick, :depends-on, and
:depended-on-by, the sorted names of the bricks on each side of its
edges.
raw 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