lib/quality
lib/quality.js
Functions(10)
Lazily require code-multivitals. Throws a clear, actionable Error (never
a raw MODULE_NOT_FOUND stack trace) if it isn't installed.
Returns:
object — the code-multivitals module exports.Signature
loadCodeMultivitals(): any
Resolve the effective threshold set for a run: CLI/explicit thresholds >
config file > named profile > code-multivitals's own built-in defaults.
Mirrors code-multivitals's own documented priority order.
| Parameter | Type | Optional | Description |
|---|---|---|---|
cm | object | - loadCodeMultivitals() result. | |
options | {profile?: string, configPath?: string, thresholds?: object} |
Returns:
object|undefined — a thresholds object, or undefined to let code-multivitals use its own default.Signature
resolveThresholds(cm: any, options: any): any
Run code-multivitals's analysis across `files`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
files | string[] | ||
options | {profile?: string, configPath?: string, thresholds?: object, minDuplicateLines?: number} | yes |
Returns:
object — code-multivitals's AnalysisResult.Signature
runQuality(files: any, options: any): any
Render an AnalysisResult using one of code-multivitals's own reporters.
| Parameter | Type | Optional | Description |
|---|---|---|---|
result | object | - runQuality() output. | |
reporterName | string | - one of REPORTER_NAMES. | |
extra | {outputDir?: string} | yes | - reporter-specific extras (badge needs an output dir). |
Returns:
string|void — report output (reporters that print directly, e.g. console, return undefined).Signature
renderQualityReport(result: any, reporterName: any, extra: any): any
Snapshot/trend/hotspot passthroughs -- thin re-exports behind the same
dynamic-require guard as everything else in this module.
| Parameter | Type | Optional | Description |
|---|---|---|---|
dir | any | ||
result | any |
Returns:
any Signature
saveQualitySnapshot(dir: any, result: any): any
Signature
loadQualitySnapshots(dir: any, limit: any): any
Signature
computeQualityTrends(snapshots: any): any
| Parameter | Type | Optional | Description |
|---|---|---|---|
trends | any | ||
churnMap | any | ||
limit | any |
Returns:
any Signature
rankQualityHotspots(trends: any, churnMap: any, limit: any): any
Signature
getQualityChurnMap(files: any): any
Baseline/diff passthrough. code-multivitals has no dedicated "save
baseline" function of its own (per its README, a baseline is just the
raw analyse() result, JSON-serialized) -- applyBaseline is the one real
API entry point, used to diff a fresh result against a previously-saved one.
| Parameter | Type | Optional | Description |
|---|---|---|---|
result | object | - fresh runQuality() output. | |
baseline | object | - a previously-saved runQuality() output. |
Returns:
object — the diffed result (new/worsened findings only).Signature
applyQualityBaseline(result: any, baseline: any): any
Variables & Constants(13)
const fs: any
constlib/quality.js
----------------------------------------
Shared code-multivitals wrapper, used by BOTH:
- bin/gen-dashboard.js (Track B, internal dashboard -- code-multivitals
is a devDependency here, so require() always resolves in this repo)
- bin/gen-docs.js's --quality* flags (Track C, end-user-facing --
code-multivitals is an OPTIONAL peerDependency there, so require()
may legitimately fail in a user's project)
Because of Track C, code-multivitals is NEVER require()'d at module
top-level anywhere in this file (or anywhere else in lib/ or bin/) --
only inside loadCodeMultivitals(), called lazily at the point of use.
See docs/backlog/adr-phase-j-project-dashboard.md Decision 10.
Signature
const fs: any