Skip to main content

ModuleReport

Provides the module report object which stores data pertaining to a single file / module being processed.

All ES Module classes are stored in the classes member variable as ClassReports. Methods that are not part of a class are stored as ModuleMethodReport instances in the methods member variable.

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

Hierarchy

  • default
    • ModuleReport

Index

Constructors

constructor

  • new ModuleReport(lineStart?: number, lineEnd?: number, settings?: any): default
  • Initializes the report.


    Parameters

    • lineStart: number = 0

      Start line of file / module.

    • lineEnd: number = 0

      End line of file / module.

    • optionalsettings: any

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

    Returns default

Properties

optionalaggregate

aggregate?: default

Stores any associated AggregateReport.

aggregateAverage

aggregateAverage: default

Stores the average module / class aggregate & method metric data.

classes

classes: default[]

Stores all ClassReport data for the module.

dependencies

dependencies: never[]

Stores all parsed dependencies.

errors

errors: never[]

Stores any analysis errors.

filePath

filePath: string

Stores the file path of the module / file. The file path is only defined as supplied when processing projects.

lineEnd

lineEnd: number

Stores the end line for the module / file.

lineStart

lineStart: number

Stores the start line for the module / file.

maintainability

maintainability: number

Measures the average maintainability index for the module / file.

methodAverage

methodAverage: default

Stores just the average method metric data.

methods

methods: default[]

Stores all module ModuleMethodReport data found outside of any ES6 classes.

settings

settings: any

Stores the settings used to generate the module report.

srcPath

srcPath: string

Stores the active source path of the module / file. This path is respective of how the file is referenced in the source code itself. srcPath is only defined as supplied when processing projects.

srcPathAlias

srcPathAlias: string

Stores the active source path alias of the module / file. This path is respective of how the file is referenced in the source code itself when aliased including NPM and JSPM modules which provide a main entry. srcPathAlias is only defined as supplied when processing projects.

Accessors

aggregateReport

  • get aggregateReport(): default
  • Returns the associated AggregateReport or this. Both ClassReport and ModuleReport have an aggregate AggregateReport.


    Returns default

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 module report and by default any class reports and module methods.


    Parameters

    • clearChildren: boolean = true

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

    Returns void

finalize

  • Cleans up any house keeping member variables.


    Returns default

getErrors

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


    Parameters

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

      Optional parameters.

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

getName

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


    Returns string

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 report given the type.


    Parameters

    • name: string

      The name of formatter to use.

    • options: 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

  • Deserializes a JSON object representing a ModuleReport.


    Parameters

    • object: any

      A JSON object of a ModuleReport that was previously serialized.

    Returns default