Liking cljdoc? Tell your friends :D

systems.thoughtfull.assay.baseline.interface

Compare a workspace with a baseline, such as the branch a pull request will merge into, so that CI can fail on what a change introduces rather than on problems that were already there.

Change thresholds map a metric key to a vector of rules applied to the change in a brick's metric since the baseline:

  • {:rule :max-increase :value n} flags an increase of more than n. A brick that is new since the baseline counts its whole value as the increase.
  • {:rule :max-increase-percent :value p} flags an increase of more than p percent. It is skipped for bricks that are new or were zero.

Rules take an optional :level, :error (the default) or :warning.

Compare a workspace with a baseline, such as the branch a pull request
will merge into, so that CI can fail on what a change introduces rather
than on problems that were already there.

Change thresholds map a metric key to a vector of rules applied to the
change in a brick's metric since the baseline:

- {:rule :max-increase :value n} flags an increase of more than n. A brick
  that is new since the baseline counts its whole value as the increase.
- {:rule :max-increase-percent :value p} flags an increase of more than p
  percent. It is skipped for bricks that are new or were zero.

Rules take an optional :level, :error (the default) or :warning.
raw docstring

systems.thoughtfull.assay.cli.main

Command line entry point. Measures every brick of a Polylith workspace, checks the measurements against thresholds, optionally compares them with a base revision, and writes an HTML report or a GitHub Actions report.

Command line entry point. Measures every brick of a Polylith workspace,
checks the measurements against thresholds, optionally compares them with
a base revision, and writes an HTML report or a GitHub Actions report.
raw docstring

systems.thoughtfull.assay.dependencies.cohesion

Cohesion within bricks, from the symbols each definition references.

  • Cohesion: references to the brick's own namespaces / references to any workspace namespace. References to other libraries don't count.
  • Clusters: groups of the brick's implementation definitions (outside its interface) that don't reference each other (LCOM4). More than one suggests unrelated responsibilities.
  • Unused interface: interface definitions no other brick references.
Cohesion within bricks, from the symbols each definition references.

- Cohesion: references to the brick's own namespaces / references to any
  workspace namespace. References to other libraries don't count.
- Clusters: groups of the brick's implementation definitions (outside its
  interface) that don't reference each other (LCOM4). More than one
  suggests unrelated responsibilities.
- Unused interface: interface definitions no other brick references.
raw docstring

systems.thoughtfull.assay.dependencies.connascence

Connascence between bricks: the static kinds that can be read from source. Connascence within a brick is expected; between bricks it is coupling.

  • Position: interface functions that other bricks call with many positional parameters, so callers depend on their order.
  • Meaning: keywords used in more than one brick, which are usually map keys that the bricks must agree on.
  • Algorithm: the same code, of at least some size, in more than one brick.
Connascence between bricks: the static kinds that can be read from
source. Connascence within a brick is expected; between bricks it is
coupling.

- Position: interface functions that other bricks call with many
  positional parameters, so callers depend on their order.
- Meaning: keywords used in more than one brick, which are usually map
  keys that the bricks must agree on.
- Algorithm: the same code, of at least some size, in more than one
  brick.
raw docstring

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 forms / all forms. 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.
  • Clusters: groups of implementation definitions that don't reference each other (LCOM4).
  • Unused interface: interface definitions no other brick references.
  • Shared keywords: keywords this brick uses that another brick also uses, usually map keys the bricks must agree on (connascence of meaning).

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).
  • :cycles flags bricks that depend on each other, directly or not.
  • :new-dependencies flags a dependency that is not in the base, when comparing with one (applied by the baseline component).
  • :unused-interface flags interface definitions that no other brick references.

Two 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).
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 forms / all forms. 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.
- Clusters: groups of implementation definitions that don't reference
  each other (LCOM4).
- Unused interface: interface definitions no other brick references.
- Shared keywords: keywords this brick uses that another brick also
  uses, usually map keys the bricks must agree on (connascence of
  meaning).

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).
- :cycles flags bricks that depend on each other, directly or not.
- :new-dependencies flags a dependency that is not in the base, when
  comparing with one (applied by the baseline component).
- :unused-interface flags interface definitions that no other brick
  references.

Two 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).
raw docstring

systems.thoughtfull.assay.dependencies.names

Map namespaces to Polylith interfaces.

Map namespaces to Polylith interfaces.
raw docstring

systems.thoughtfull.assay.git.interface

Read revisions and changes from the Git repository containing a workspace.

Read revisions and changes from the Git repository containing a
workspace.
raw docstring

systems.thoughtfull.assay.github-report.interface

Render a report for GitHub Actions: workflow command annotations and a Markdown job summary.

A report is a map of :workspace (a name), :bricks (measurements from the metrics component), and :violations (from the thresholds component).

Render a report for GitHub Actions: workflow command annotations and a
Markdown job summary.

A report is a map of :workspace (a name), :bricks (measurements from the
metrics component), and :violations (from the thresholds component).
raw docstring

systems.thoughtfull.assay.html-report.interface

Render a report as a standalone HTML page.

A report is a map of :workspace (a name), :generated-at (a string), :bricks (measurements from the metrics component), :violations (from the thresholds component), and :thresholds (the rules that were applied).

Render a report as a standalone HTML page.

A report is a map of :workspace (a name), :generated-at (a string),
:bricks (measurements from the metrics component), :violations (from the
thresholds component), and :thresholds (the rules that were applied).
raw docstring

systems.thoughtfull.assay.parse.interface

Read Clojure source into rewrite-clj nodes, preserving everything the reader would discard (comments, whitespace, reader macros) so metrics can see the code as written.

Read Clojure source into rewrite-clj nodes, preserving everything the
reader would discard (comments, whitespace, reader macros) so metrics
can see the code as written.
raw docstring

systems.thoughtfull.assay.text-report.interface

Render a report as plain text for a terminal, such as a Git hook.

A report is a map of :bricks (measurements from the metrics component), :violations (from the thresholds component), and, when compared with a base, :comparison (from the baseline component).

Render a report as plain text for a terminal, such as a Git hook.

A report is a map of :bricks (measurements from the metrics component),
:violations (from the thresholds component), and, when compared with a
base, :comparison (from the baseline component).
raw docstring

systems.thoughtfull.assay.thresholds.interface

Compare brick and function measurements to threshold rules.

Configuration has two maps from metric key to a vector of rules: :brick-thresholds for brick metrics and :function-thresholds for each function's metrics. Each rule is a map with a :rule type, a :value, and an optional :level (:error, the default, or :warning):

  • {:rule :max :value n} flags a value above n.
  • {:rule :min :value n} flags a value below n.
  • {:rule :std-devs :value k} flags a brick whose metric is more than k standard deviations above the mean of the other bricks of the same type (components are compared with components, bases with bases). It needs at least :min-peers other bricks (default 3) and is skipped otherwise. Brick thresholds only.

Brick rules take an optional :types, a set of brick types (:component, :base) the rule applies to. Rules skip metrics with no value.

Compare brick and function measurements to threshold rules.

Configuration has two maps from metric key to a vector of rules:
:brick-thresholds for brick metrics and :function-thresholds for each
function's metrics. Each rule is a map with a :rule type, a :value, and an
optional :level (:error, the default, or :warning):

- {:rule :max :value n} flags a value above n.
- {:rule :min :value n} flags a value below n.
- {:rule :std-devs :value k} flags a brick whose metric is more than k
  standard deviations above the mean of the other bricks of the same type
  (components are compared with components, bases with bases). It needs
  at least :min-peers other bricks (default 3) and is skipped otherwise.
  Brick thresholds only.

Brick rules take an optional :types, a set of brick types (:component,
:base) the rule applies to. Rules skip metrics with no value.
raw docstring

systems.thoughtfull.assay.workspace.interface

Discover the bricks of a Polylith workspace.

Discover the bricks of a Polylith workspace.
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