Microsoft/fast-dna

View on GitHub
packages/web-components/fast-element/src/templating/html-binding-directive.ts

Summary

Maintainability
D
1 day
Test Coverage

Function updateContent has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

function updateContent(
    this: HTMLBindingDirective,
    target: ContentTarget,
    aspect: string,
    value: any,

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

File html-binding-directive.ts has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { isHydratable } from "../components/hydration.js";
import { DOM, DOMAspect, DOMPolicy } from "../dom.js";
import { Message } from "../interfaces.js";
import {
    ExecutionContext,

    Function updateContent has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function updateContent(
        this: HTMLBindingDirective,
        target: ContentTarget,
        aspect: string,
        value: any,

      Function bind has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          bind(controller: ViewController): void {
              const target = controller.targets[this.targetNodeId];
              const isHydrating =
                  isHydratable(controller) &&
                  controller.hydrationStage &&

        Function updateTokenList has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        function updateTokenList(
            this: HTMLBindingDirective,
            target: Element,
            aspect: string,
            value: any

        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 updateTokenList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function updateTokenList(
            this: HTMLBindingDirective,
            target: Element,
            aspect: string,
            value: any

          Function updateContent has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              this: HTMLBindingDirective,
              target: ContentTarget,
              aspect: string,
              value: any,
              controller: ViewController

            Function bind has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                bind(controller: ViewController): void {
                    const target = controller.targets[this.targetNodeId];
                    const isHydrating =
                        isHydratable(controller) &&
                        controller.hydrationStage &&

            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

            There are no issues that match your filters.

            Category
            Status