Home Reference Source Test
public class | source

BaseReporter

Constructor Summary

Public Constructor
public

constructor(inspector: Inspector, opts: object)

A base reporter from which all others inherit.

Method Summary

Private Methods
private

Returns the absolute path for a file.

private

Returns a string containing the path to the file in which the nodes are located, as well as the lines on which the nodes exist.

private

_getLines(instance: Object): string

Returns the lines associated with an instance.

private

Returns the relative path for a file.

private

Registers a listener to the "match" event exposed by the Inspector instance.

private

Registers a listener that prints a final summary outlining the number of matches detected, as well as the number of files analyzed.

Public Constructors

public constructor(inspector: Inspector, opts: object) source

A base reporter from which all others inherit. Registers a listener on the passed inspector instance for tracking the number of matches found.

Params:

NameTypeAttributeDescription
inspector Inspector

Instance on which to register its listeners

opts object

Options to set for the reporter

Private Methods

private _getAbsolutePath(filePath: string): string source

Returns the absolute path for a file.

Params:

NameTypeAttributeDescription
filePath string

Return:

string

private _getFormattedLocation(instance: Object): string source

Returns a string containing the path to the file in which the nodes are located, as well as the lines on which the nodes exist.

Params:

NameTypeAttributeDescription
instance Object

Return:

string

private _getLines(instance: Object): string source

Returns the lines associated with an instance.

Params:

NameTypeAttributeDescription
instance Object

Return:

string

private _getRelativePath(filePath: string): string source

Returns the relative path for a file.

Params:

NameTypeAttributeDescription
filePath string

Return:

string

private _registerListener() source

Registers a listener to the "match" event exposed by the Inspector instance. Increments _found for each match emitted, and invokes the object's _getOutput method, writing it to stdout.

private _registerSummary() source

Registers a listener that prints a final summary outlining the number of matches detected, as well as the number of files analyzed.