Home Manual Reference Source Test Repository
public class | source

MethodReport

Extends:

AbstractReportAggregateMethodReport → MethodReport

Provides the method report object which stores data pertaining to a single method / function.

Static Method Summary

Static Protected Methods
protected static

Deserializes a JSON object representing a ClassMethodReport.

Constructor Summary

Public Constructor
public

constructor(name: string, lineStart: number, lineEnd: number, params: number)

Initializes method report.

Member Summary

Public Members
public

Stores any analysis errors.

public

Stores the end line for the method.

public

Stores the start line for the method.

public

The name of the method.

public

The number of parameters for the method or report.

Method Summary

Public Methods
public

Clears all errors stored in the method report.

public

getErrors(options: object): Array<AnalyzeError | {error: AnalyzeError, source: *}>

Gets all errors stored in the method report.

public

Returns the name / id associated with this report.

Inherited Summary

From class AbstractReport
public get

Returns the associated AggregateMethodReport or this.

public

Stores any associated AggregateMethodReport.

public

Increments the associated aggregate report HalsteadData for distinct identifiers.

public

incrementHalsteadItems(metric: string, identifier: string)

Increments the associated aggregate report Halstead items including distinct and total counts.

public

Increments the associated aggregate report Halstead metric type.

public

Increments the associated aggregate report parameter count.

public

Returns true if a given HalsteadData metric / identifier is not found in the associated aggregate report.

public

toFormat(name: string, options: object): string

Formats this report given the type.

From class AggregateMethodReport
public

The cyclomatic complexity of the method.

public

The cyclomatic density of the method.

public

Stores the Halstead data instance.

public

The number of parameters for the method or aggregate report.

public

sloc: {logical: number, physical: number}

The source lines of code for the method.

Static Protected Methods

protected static _parse(targetObject: ClassMethodReport | ModuleMethodReport, jsonObject: object): ClassMethodReport | ModuleMethodReport source

Deserializes a JSON object representing a ClassMethodReport.

Params:

NameTypeAttributeDescription
targetObject ClassMethodReport | ModuleMethodReport

A target object to hydrate.

jsonObject object

A JSON object of a class or module method report that was previously serialized.

Public Constructors

public constructor(name: string, lineStart: number, lineEnd: number, params: number) source

Initializes method report.

Override:

AggregateMethodReport#constructor

Params:

NameTypeAttributeDescription
name string

Name of the method.

lineStart number

Start line of method.

lineEnd number

End line of method.

params number

Number of parameters for method.

Public Members

public errors: Array source

Stores any analysis errors.

public lineEnd: number source

Stores the end line for the method.

public lineStart: number source

Stores the start line for the method.

public name: string source

The name of the method.

public params: number source

The number of parameters for the method or report.

Override:

AggregateMethodReport#params

Public Methods

public clearErrors() source

Clears all errors stored in the method report.

public getErrors(options: object): Array<AnalyzeError | {error: AnalyzeError, source: *}> source

Gets all errors stored in the method report.

Params:

NameTypeAttributeDescription
options object

Optional parameters.

Return:

Array<AnalyzeError | {error: AnalyzeError, source: *}>

Return Properties:

NameTypeAttributeDescription
includeChildren boolean

If false then module errors are not included; default (true).

includeReports boolean

If true then results will be an array of object hashes containing source (the source report object of the error) and error (an AnalyzeError instance) keys; default (false).

public getName(): string source

Returns the name / id associated with this report.

Return:

string