import PluginMetricsProject from 'escomplex-plugin-metrics-project/src/PluginMetricsProject.js'
PluginMetricsProject
Provides default project metrics gathering and calculation.
Member Summary
Public Members | ||
public |
Stores the settings for all ESComplexProject plugins. |
Method Summary
Public Methods | ||
public |
onConfigure(ev: object) Loads any default settings that are not already provided by any user options. |
|
public |
onProjectEnd(ev: object) Performs final calculations based on collected project report data. |
|
public |
onProjectStart(ev: object) Stores settings. |
Private Methods | ||
private |
Calculates an adjacency matrix for all modules based on ES Module and CommonJS dependencies also storing a compacted while returning the matrix for further calculation. |
|
private |
_calculateAverages(projectReport: object) Calculates average ModuleReport metrics that are applicable to ProjectResult. |
|
private |
_calculateCoreSize(projectReport: object, visibilityMatrix: Array<Array<number>>): * Calculates core size which is the percentage of modules / files that are both widely depended on and themselves depend on other modules. |
|
private |
_calculateVisibilityMatrix(projectReport: object, adjacencyMatrix: Array<Array<number>>): Array<Array<number>> Stores a compacted form of the visibility matrix. |
|
private |
_doesDependencyExist(pathModule: object, fromModuleReport: ModuleReport, toModuleReport: ModuleReport): boolean Determines if there is at least one dependency that matches |
Public Methods
public onConfigure(ev: object) source
Loads any default settings that are not already provided by any user options.
Params:
Name | Type | Attribute | Description |
ev | object | escomplex plugin event data. The following options are:
|
public onProjectEnd(ev: object) source
Performs final calculations based on collected project report data.
Params:
Name | Type | Attribute | Description |
ev | object | escomplex plugin event data. |
public onProjectStart(ev: object) source
Stores settings.
Params:
Name | Type | Attribute | Description |
ev | object | escomplex plugin event data. |
Private Methods
private _calculateAdjacencyMatrix(pathModule: object, projectReport: object): Array<Array<number>> source
Calculates an adjacency matrix for all modules based on ES Module and CommonJS dependencies also storing a compacted while returning the matrix for further calculation. Each row index corresponds to the same module index. Each row entry corresponds to a module index. These relationships dictate the dependencies between all module ModuleReports given the source paths.
private _calculateAverages(projectReport: object) source
Calculates average ModuleReport metrics that are applicable to ProjectResult.
Params:
Name | Type | Attribute | Description |
projectReport | object | The ProjectResult being processed. |
private _calculateCoreSize(projectReport: object, visibilityMatrix: Array<Array<number>>): * source
Calculates core size which is the percentage of modules / files that are both widely depended on and themselves depend on other modules. Lower is better.
Return:
* |
private _calculateVisibilityMatrix(projectReport: object, adjacencyMatrix: Array<Array<number>>): Array<Array<number>> source
Stores a compacted form of the visibility matrix. Each row index corresponds to the same module index. Each row entry corresponds to a module index. These relationships dictate the reverse visibility between all module ModuleReports which may indirectly impact the given module / file. The full matrix is returned for further calculation.
Implementation of Floyd Warshall algorithm for calculating visibility matrix in O(n^3) instead of O(n^4) with successive raising of powers.
private _doesDependencyExist(pathModule: object, fromModuleReport: ModuleReport, toModuleReport: ModuleReport): boolean source
Determines if there is at least one dependency that matches toModuleReport.srcPath
from all the dependencies
stored in fromModuleReport
.
Params:
Name | Type | Attribute | Description |
pathModule | object | A module that conforms to the Node path API. |
|
fromModuleReport | ModuleReport | A ModuleReport to match to the srcPath of |
|
toModuleReport | ModuleReport | A ModuleReport providing the |