Microsoft/fast-dna

View on GitHub

Showing 426 of 3,220 total issues

Function spliceOperationsFromEditDistances has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

function spliceOperationsFromEditDistances(distances: number[][]): number[] {
    let i = distances.length - 1;
    let j = distances[0].length - 1;
    let current = distances[i][j];
    const edits: number[] = [];
Severity: Minor
Found in packages/web-components/fast-element/src/observation/arrays.ts - About 3 hrs 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

File router.ts has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { FASTElement } from "@microsoft/fast-element";
import { composedParent } from "@microsoft/fast-element/utilities.js";
import { RenderCommand } from "./commands.js";
import { RouterConfiguration } from "./configuration.js";
import { NavigationContributor } from "./contributors.js";
Severity: Minor
Found in packages/web-components/fast-router/src/router.ts - About 3 hrs to fix

    Function numberFieldTemplate has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function numberFieldTemplate<T extends FASTNumberField>(
        options: NumberFieldOptions = {}
    ): ElementViewTemplate<T> {
        return html<T>`
            <label

      FASTSlider has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class FASTSlider extends FormAssociatedSlider implements SliderConfiguration {
          /**
           * @internal
           */
          public track: HTMLDivElement;
      Severity: Minor
      Found in packages/web-components/fast-foundation/src/slider/slider.ts - About 3 hrs to fix

        C has 27 functions (exceeds 20 allowed). Consider refactoring.
        Open

            const C = class extends BaseCtor {
                /**
                 * The proxy element - this element serves as the communication layer with the parent form
                 * when form association is not supported by the browser.
                 *

          File view.spec.ts has 298 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { expect } from "chai";
          import { Message } from "../interfaces.js";
          import { ExecutionContext } from "../observation/observable.js";
          import { FAST } from "../platform.js";
          import { AddViewBehaviorFactory, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
          Severity: Minor
          Found in packages/web-components/fast-element/src/templating/view.spec.ts - About 3 hrs to fix

            Function pickerTemplate has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function pickerTemplate<T extends FASTPicker>(
                options: PickerOptions
            ): ElementViewTemplate<T> {
                const anchoredRegionTag = html.partial(tagFor(options.anchoredRegion));
                const pickerMenuTag = tagFor(options.pickerMenu);
            Severity: Major
            Found in packages/web-components/fast-foundation/src/picker/picker.template.ts - About 3 hrs to fix

              Function Updates has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              export const Updates: UpdateQueue = FAST.getById(KernelServiceId.updateQueue, () => {
                  const tasks: Callable[] = [];
                  const pendingErrors: any[] = [];
                  const rAF = globalThis.requestAnimationFrame;
                  let updateAsync = true;
              Severity: Minor
              Found in packages/web-components/fast-element/src/observation/update-queue.ts - About 3 hrs 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 updateViews has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  private updateViews(splices: Splice[]): void {
                      const views = this.views;
                      const bindView = this.bindView;
                      const items = this.items!;
                      const template = this.template;
              Severity: Minor
              Found in packages/web-components/fast-element/src/templating/repeat.ts - About 3 hrs 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

              File horizontal-scroll.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                  attr,
                  booleanConverter,
                  FASTElement,
                  nullableNumberConverter,

                File checkbox.pw.spec.ts has 293 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import type { Locator, Page } from "@playwright/test";
                import { expect, test } from "@playwright/test";
                import { fixtureURL } from "../__test__/helpers.js";
                import type { FASTCheckbox } from "./checkbox.js";
                
                

                  File fast-design-token.ts has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import type {
                      CSSDirective,
                      HostBehavior,
                      HostController,
                      HTMLDirective,

                    File routes.ts has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { Constructable, FASTElement, ViewTemplate } from "@microsoft/fast-element";
                    import {
                        ConfigurableRoute,
                        Endpoint,
                        RecognizedRoute,
                    Severity: Minor
                    Found in packages/web-components/fast-router/src/routes.ts - About 2 hrs to fix

                      Function register has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public register(...params: any[]): Container {
                              if (++this.registerDepth === 100) {
                                  // Most likely cause is trying to register a plain object that does not have a
                                  // register method and is not a class constructor
                                  throw FAST.error(Message.cannotAutoregisterDependency);
                      Severity: Minor
                      Found in packages/web-components/fast-element/src/di/di.ts - About 2 hrs 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

                      File dom-shim.ts has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * This file was heavily inspired by {@link https://github.com/lit/lit/tree/main/packages/labs/ssr} with some adjustments made.
                       * Please see {@link ../ACKNOWLEDGEMENTS.md}
                       */
                      
                      
                      Severity: Minor
                      Found in packages/web-components/fast-ssr/src/dom-shim.ts - About 2 hrs to fix

                        File accordion.pw.spec.ts has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import type { Locator, Page } from "@playwright/test";
                        import { expect, test } from "@playwright/test";
                        import { fixtureURL } from "../__test__/helpers.js";
                        import { AccordionExpandMode } from "./accordion.options.js";
                        
                        

                          Function menuItemTemplate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function menuItemTemplate<T extends FASTMenuItem>(
                              options: MenuItemOptions = {}
                          ): ElementViewTemplate<T> {
                              return html<T>`
                                  <template

                            Function searchTemplate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function searchTemplate<T extends FASTSearch>(
                                options: SearchOptions = {}
                            ): ElementViewTemplate<T> {
                                return html<T>`
                                    <label
                            Severity: Major
                            Found in packages/web-components/fast-foundation/src/search/search.template.ts - About 2 hrs to fix

                              Function calc has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function calc(
                                  current: unknown[],
                                  currentStart: number,
                                  currentEnd: number,
                                  old: unknown[],
                              Severity: Major
                              Found in packages/web-components/fast-element/src/observation/arrays.ts - About 2 hrs to fix

                                File generate-docs.js has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                const path = require("path");
                                const { createInterface } = require("readline");
                                const { exec } = require("child_process");
                                const fs = require("fs-extra");
                                const { getPackageJsonDir } = require("../../../build/get-package-json");
                                Severity: Minor
                                Found in sites/website/src/generate-docs.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language