KnodesCommunity/typedoc-plugins

View on GitHub
packages/plugin-pages/src/converter/page-tree/page-tree-builder.ts

Summary

Maintainability
B
4 hrs
Test Coverage
A
94%

Function _mapNodeToReflection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private _mapNodeToReflection( node: PageNode, parent: ANodeReflection.Parent, io: IIOPath ): NodeReflection[] {
        const childrenIO: IIOPath = isModuleRoot( node ) ? { ...io } : {
            ...io,
            input: join( io.input, getDir( node, 'source' ) ),
            output: join( io.output, getDir( node, 'output' ) ),
Severity: Minor
Found in packages/plugin-pages/src/converter/page-tree/page-tree-builder.ts - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function buildPagesTree has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public buildPagesTree( project: ProjectReflection, options: IPluginOptions ): MenuReflection {
        const rootMenu = new MenuReflection( 'ROOT', project, undefined, '' );
        if( !options.pages || options.pages.length === 0 ){
            return rootMenu;
        } else {
Severity: Minor
Found in packages/plugin-pages/src/converter/page-tree/page-tree-builder.ts - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _mapNodeToReflection has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private _mapNodeToReflection( node: PageNode, parent: ANodeReflection.Parent, io: IIOPath ): NodeReflection[] {
        const childrenIO: IIOPath = isModuleRoot( node ) ? { ...io } : {
            ...io,
            input: join( io.input, getDir( node, 'source' ) ),
            output: join( io.output, getDir( node, 'output' ) ),
Severity: Minor
Found in packages/plugin-pages/src/converter/page-tree/page-tree-builder.ts - About 1 hr to fix

    Function _getNodeReflection has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private _getNodeReflection( node: PageNode, parent: ANodeReflection.Parent, io: IIOPath ){
            const { module, parent: actualParent } = this._getNodeParent( node, parent );
            if( node.source ){
                const nodePath = join( io.input, node.source );
                const sourceFilePath = miscUtils.catchWrap(
    Severity: Minor
    Found in packages/plugin-pages/src/converter/page-tree/page-tree-builder.ts - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status