Microsoft/fast-dna

View on GitHub

Showing 231 of 12,131 total issues

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

function intersect(start1: number, end1: number, start2: number, end2: number): number {
    // Disjoint
    if (end1 < start2 || end2 < start1) {
        return -1;
    }
Severity: Minor
Found in packages/web-components/fast-element/src/observation/arrays.ts - About 35 mins 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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public constructor(public readonly styles: ReadonlyArray<ComposableStyles>) {
        this.behaviors = styles
            .map((x: ComposableStyles) =>
                x instanceof ElementStyles ? x.behaviors : null
            )
Severity: Minor
Found in packages/web-components/fast-element/src/styles/element-styles.ts - About 35 mins 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 renderAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static *renderAttribute(
        code: AttributeBindingOp,
        value: any,
        renderInfo: RenderInfo
    ) {

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 renderBooleanAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static *renderBooleanAttribute(
        code: AttributeBindingOp,
        value: unknown,
        renderInfo: RenderInfo
    ) {

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 removeBehavior has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public removeBehavior(behavior: HostBehavior<TElement>, force: boolean = false) {
        const targetBehaviors = this.behaviors;
        if (targetBehaviors === null) {
            return;
        }

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 uninstallDOMShim has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    uninstallDOMShim(): void {
        for (const key of perRequestGlobals) {
            if (shimIsInstalledFor(key)) {
                if (preShimDescriptors.has(key)) {
                    Object.defineProperty(globalThis, key, preShimDescriptors.get(key)!);
Severity: Minor
Found in packages/web-components/fast-ssr/src/request-storage.ts - About 35 mins 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 from has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    from<TBase extends typeof HTMLElement>(
        BaseType: TBase
    ): { new (): InstanceType<TBase> & RouterElement } {
        class RouterBase extends (BaseType as any) {
            public readonly [routerProperty]!: Router;
Severity: Minor
Found in packages/web-components/fast-router/src/router.ts - About 35 mins 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 bind has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    bind(controller: ViewController): void {
        const context = controller.context as RouterExecutionContext;
        const options = this.directive.options;
        this.contributor = controller.targets[
            this.directive.targetNodeId
Severity: Minor
Found in packages/web-components/fast-router/src/contributors.ts - About 35 mins 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 aggregate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    aggregate(
        parts: (string | ViewBehaviorFactory)[],
        policy: DOMPolicy = DOM.policy
    ): ViewBehaviorFactory {
        if (parts.length === 1) {
Severity: Minor
Found in packages/web-components/fast-element/src/templating/compiler.ts - About 35 mins 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 compileContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function compileContent(
    context: CompilationContext,
    node: Text,
    parentId,
    nodeId,
Severity: Minor
Found in packages/web-components/fast-element/src/templating/compiler.ts - About 35 mins 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

Avoid too many return statements within this function.
Open

        return end2 - start1; // Overlap
Severity: Major
Found in packages/web-components/fast-element/src/observation/arrays.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return end1 - start1; // Contained
    Severity: Major
    Found in packages/web-components/fast-element/src/observation/arrays.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return 1;
      Severity: Major
      Found in packages/web-components/fast-router/src/recognizer.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return -1;
        Severity: Major
        Found in packages/web-components/fast-router/src/recognizer.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return -1;
          Severity: Major
          Found in packages/web-components/fast-router/src/recognizer.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return 1;
            Severity: Major
            Found in packages/web-components/fast-router/src/recognizer.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return 1;
              Severity: Major
              Found in packages/web-components/fast-router/src/recognizer.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return 0;
                Severity: Major
                Found in packages/web-components/fast-router/src/recognizer.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return -1;
                  Severity: Major
                  Found in packages/web-components/fast-router/src/recognizer.ts - About 30 mins to fix

                    Function create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        create<T = unknown>(name: string, initialValue?: T): FASTContext<T> {
                            const Interface = function (
                                target: Constructable<Node>,
                                property: string,
                                index: number
                    Severity: Minor
                    Found in packages/web-components/fast-element/src/context.ts - About 25 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language