Skip to main content

ProjectReport

Provides the default project report object which stores data pertaining to all modules / files contained.

All modules are stored in the modules member variable as ModuleReports.

Various helper methods found in ModuleReport and AbstractReport help increment associated data during collection.

Index

Constructors

constructor

  • new ProjectReport(moduleReports?: default[], settings?: { serializeModules: boolean } & {}): default
  • Initializes ProjectReport with default values.


    Parameters

    • optionalmoduleReports: default[]

      An array of ModuleReports for each module / file processed.

    • settings: { serializeModules: boolean } & {} = ...

      An object hash of the settings used in generating this report via ESComplexProject.

    Returns default

Properties

adjacencyList

adjacencyList: number[][]

Stores a compacted form of the adjacency matrix. Each row index corresponds to the same report index. Each row entry corresponds to a report index. These relationships dictate the dependencies between all report ModuleReports given the source paths.

changeCost

changeCost: number

Measures the average percentage of modules affected when one module / file in the project is changed. Lower is better.

coreSize

coreSize: number

Measures the percentage of modules that are widely depended on which also depend on other modules. Lower is better.

errors

errors: any[]

Stores any analysis errors.

firstOrderDensity

firstOrderDensity: number

Measures the percentage of all possible internal dependencies that are actually realized in the project. Lower is better.

moduleAverage

moduleAverage: default

Stores the average module metric data.

modules

modules: any[] | default[]

Stores all ModuleReport data for the project sorted by the module / files srcPath.

settings

settings: { serializeModules: boolean } & {}

Stores the settings used to generate the project report.

visibilityList

visibilityList: number[][]

Stores a compacted form of the visibility matrix. Each row index corresponds to the same report index. Each row entry corresponds to a report index. These relationships dictate the reverse visibility between all report ModuleReports which may indirectly impact the given module / file.

Accessors

type

  • get type(): default
  • Returns the enum for the report type.


    Returns default

Methods

clearErrors

  • clearErrors(clearChildren?: boolean): void
  • Clears all errors stored in the project report and by default any module reports.


    Parameters

    • clearChildren: boolean = true

      (Optional) If false then class and module method errors are not cleared; default (true).

    Returns void

finalize

  • finalize(options?: { serializeModules: boolean }): default
  • Finalizes the ProjectReport. If settings.serializeModules is false output just filePath, srcPath & srcPathAlias entries of modules.


    Parameters

    • options: { serializeModules: boolean } = ...

      (Optional) Allows overriding of ModuleReport serialization.

    Returns default

getErrors

  • getErrors(options?: { includeChildren: boolean; includeReports: boolean; query?: any }): (default | { error: default; source: string })[]
  • Gets all errors stored in the project report and by default any module reports.


    Parameters

    • options: { includeChildren: boolean; includeReports: boolean; query?: any } = ...

      Optional parameters.

    Returns (default | { error: default; source: string })[]

getName

  • getName(): any
  • Returns the name / id associated with this report.


    Returns any

getSetting

  • getSetting(key: string, defaultValue?: any): any
  • Returns the setting indexed by the given key.


    Parameters

    • key: string

      A key used to store the setting parameter.

    • defaultValue: any = undefined

      A default value to return if no setting for the given key is currently stored.

    Returns any

setSetting

  • setSetting(key: string, value: any): boolean
  • Sets the setting indexed by the given key and returns true if successful.


    Parameters

    • key: string

      A key used to store the setting parameter.

    • value: any

      A value to set to this.settings[key].

    Returns boolean

toFormat

  • toFormat(name: string, options?: any): string
  • Formats this ProjectReport given the type.


    Parameters

    • name: string

      The name of formatter to use.

    • optionaloptions: any

      (Optional) One or more optional parameters to pass to the formatter.

    Returns string

staticgetFormats

  • getFormats(): string[]
  • Returns the supported transform formats.


    Returns string[]

staticparse

  • parse(object: any, options?: { skipFinalize: boolean }): default
  • Deserializes a JSON object representing a ProjectReport.


    Parameters

    • object: any

      A JSON object of a ProjectReport that was previously serialized.

    • options: { skipFinalize: boolean } = ...

      Optional parameters.

    Returns default