ESComplex
Next generation code complexity reporting for Javascript abstract syntax trees (AST). ESComplex exposes all methods
available via ESComplexModule & ESComplexProject modules which process AST. Several methods available below accept
source code which is translated via Babylon w/ all plugins enabled allowing any ES6/ES7/edge JS to be parsed.
Asynchronous versions with the Async
suffix of all methods are available as well.
Constructor Summary
Public Constructor | ||
public |
constructor(options: object) Initializes ESComplex. |
Member Summary
Private Members | ||
private |
_escomplexModule: ESComplexModule An instance of ESComplexModule. |
|
private |
_escomplexProject: ESComplexProject An instance of ESComplexProject. |
Method Summary
Public Methods | ||
public |
analyzeModule(source: string, options: object, parserOptions: object): object Parses the given source code then processes the generated AST and calculates metrics via plugins. |
|
public |
analyzeModuleAST(ast: object | Array, options: object): object Processes the given ast and calculates metrics via plugins. |
|
public |
Wraps in a Promise processing the given ast and calculates metrics via plugins. |
|
public |
analyzeModuleAsync(source: string, options: object, parserOptions: object): object Wraps in a Promise parsing of the given source code then processes the generated AST and calculates metrics via plugins. |
|
public |
analyzeProject(sources: Array<object>, options: object, parserOptions: object): {reports: Array<{}>}{}> Processes the given sources and calculates project metrics via plugins. |
|
public |
analyzeProjectAST(modules: Array<object>, options: object): {reports: Array<{}>}{}> Processes the given modules and calculates project metrics via plugins. |
|
public |
analyzeProjectASTAsync(modules: Array, options: object): Promise<{reports: Array<{}>}>{}>{reports:> Wraps in a Promise processing the given modules and calculates project metrics via plugins. |
|
public |
analyzeProjectAsync(sources: Array<object>, options: object, parserOptions: object): Promise<{reports: Array<{}>}>{}>{reports:> Wraps in a Promise processing the given sources and calculates project metrics via plugins. |
|
public |
Provides a convenience method to parse the given source code and return the babylon AST. |
|
public |
parseAsync(source: string, parserOptions: object): Promise<object> Wraps in a Promise a convenience method to parse the given source code and return the babylon AST. |
|
public |
processProject(results: object, options: object): {reports: Array<{}>}{}> Processes existing project results and calculates metrics via plugins. |
|
public |
processProjectAsync(results: object, options: object): Promise<{reports: Array<{}>}>{}>{reports:> Wraps in a Promise processing existing project results and calculates metrics via plugins. |
Public Constructors
public constructor(options: object) source
Initializes ESComplex.
Params:
Name | Type | Attribute | Description |
options | object | module and project options including user plugins to load including:
|
Private Members
Public Methods
public analyzeModule(source: string, options: object, parserOptions: object): object source
Parses the given source code then processes the generated AST and calculates metrics via plugins.
public analyzeModuleAST(ast: object | Array, options: object): object source
Processes the given ast and calculates metrics via plugins.
public analyzeModuleASTAsync(ast: object | Array, options: object): Promise<object> source
Wraps in a Promise processing the given ast and calculates metrics via plugins.
public analyzeModuleAsync(source: string, options: object, parserOptions: object): object source
Wraps in a Promise parsing of the given source code then processes the generated AST and calculates metrics via plugins.
public analyzeProject(sources: Array<object>, options: object, parserOptions: object): {reports: Array<{}>}{}> source
Processes the given sources and calculates project metrics via plugins.
Params:
Name | Type | Attribute | Description |
sources | Array<object> | Array of object hashes containing |
|
options | object | (Optional) project processing options. |
|
parserOptions | object | (Optional) overrides default babylon parser options. |
Return:
{reports: Array<{}>}{}> | An object hash with a |
public analyzeProjectAST(modules: Array<object>, options: object): {reports: Array<{}>}{}> source
Processes the given modules and calculates project metrics via plugins.
Return:
{reports: Array<{}>}{}> | An object hash with a |
public analyzeProjectASTAsync(modules: Array, options: object): Promise<{reports: Array<{}>}>{}>{reports:> source
Wraps in a Promise processing the given modules and calculates project metrics via plugins.
public analyzeProjectAsync(sources: Array<object>, options: object, parserOptions: object): Promise<{reports: Array<{}>}>{}>{reports:> source
Wraps in a Promise processing the given sources and calculates project metrics via plugins.
public parse(source: string, parserOptions: object): object source
Provides a convenience method to parse the given source code and return the babylon AST.
public parseAsync(source: string, parserOptions: object): Promise<object> source
Wraps in a Promise a convenience method to parse the given source code and return the babylon AST.
public processProject(results: object, options: object): {reports: Array<{}>}{}> source
Processes existing project results and calculates metrics via plugins.
Return:
{reports: Array<{}>}{}> | An object hash with a |