Home Manual Reference Source Test Repository
public class | source

FormatJSONCheckstyle

Provides a format transform for ESComplex ModuleReport / ProjectReport instances converting them to JSON that corresponds to the XML checkstyle format.

The checkstyle XML format outputs error elements for each file / module. This format depends on the output of FormatJSONCheckstyle. The implementation below outputs a file array that contains an error array entries.

There is a corresponding FormatXMLCheckstyle format loaded when escomplex-plugin-formats-xml during plugin loading which converts the JSON output of this format transform to the official XML checkstyle format.

See:

Constructor Summary

Public Constructor
public

constructor(thresholds: *)

Member Summary

Public Members
public get

Gets the file extension.

public get

Gets the format name.

public get

Gets the format type.

Private Members
private

Method Summary

Public Methods
public

Formats a module report as JSON / checkstyle.

public

Returns whether a given ReportType is supported by this format transform.

Private Methods
private

_formatModule(report: ModuleReport, reportsAvailable: boolean, options: object): object

Formats a module report.

private

_parseErrors(sourceObject: *, options: *, errors: *)

Public Constructors

public constructor(thresholds: *) source

Params:

NameTypeAttributeDescription
thresholds *
  • optional
  • default: s_DEFAULT_THRESHOLDS

Public Members

public get extension: string: string source

Gets the file extension.

Return:

string

public get name: string: string source

Gets the format name.

Return:

string

public get type: string: string source

Gets the format type.

Return:

string

Private Members

private _thresholds: * source

Public Methods

public formatReport(report: ModuleReport | ProjectReport, options: object): string source

Formats a module report as JSON / checkstyle.

Params:

NameTypeAttributeDescription
report ModuleReport | ProjectReport

A module or project report to format.

options object

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

Return:

string

Return Properties:

NameTypeAttributeDescription
spacing number

(Optional) An integer defining the JSON output spacing.

public isSupported(reportType: ReportType): boolean source

Returns whether a given ReportType is supported by this format transform.

Params:

NameTypeAttributeDescription
reportType ReportType

A given report type.

Return:

boolean

Private Methods

private _formatModule(report: ModuleReport, reportsAvailable: boolean, options: object): object source

Formats a module report.

Params:

NameTypeAttributeDescription
report ModuleReport

A module report.

reportsAvailable boolean

Indicates that the report metric data is available.

options object

(Optional) One or more optional entries defining threshold parameters.

Return:

object

private _parseErrors(sourceObject: *, options: *, errors: *) source

Params:

NameTypeAttributeDescription
sourceObject *
options *
errors *