Microsoft/fast-dna

View on GitHub

Showing 425 of 3,219 total issues

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

import { expect } from "chai";
import { Observable } from "./observable.js";
import { ArrayObserver, lengthOf, Splice } from "./arrays.js";
import { SubscriberSet } from "./notifier.js";
import { Updates } from "./update-queue.js";
Severity: Minor
Found in packages/web-components/fast-element/src/observation/arrays.spec.ts - About 5 hrs to fix

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

    import { expect, test } from "@playwright/test";
    import type { Locator, Page } from "@playwright/test";
    import type { FASTListboxOption } from "../listbox-option/index.js";
    import { fixtureURL } from "../__test__/helpers.js";
    import type { FASTSelect } from "./select.js";
    Severity: Minor
    Found in packages/web-components/fast-foundation/src/select/select.pw.spec.ts - About 5 hrs to fix

      File combobox.ts has 387 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { autoUpdate, computePosition, flip, hide, size } from "@floating-ui/dom";
      import { attr, Observable, observable, Updates } from "@microsoft/fast-element";
      import { limit, uniqueId } from "@microsoft/fast-web-utilities";
      import type { StaticallyComposableHTML } from "../utilities/template-helpers.js";
      import type { FASTListboxOption } from "../listbox-option/listbox-option.js";
      Severity: Minor
      Found in packages/web-components/fast-foundation/src/combobox/combobox.ts - About 5 hrs to fix

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

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

          File form-associated.ts has 386 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
              attr,
              booleanConverter,
              emptyArray,
              observable,

            Function advance has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                public advance(ch: string): void {
                    const { chars, states, skippedStates, result } = this;
                    let stateToAdd: AnyState<T> | null = null;
            
                    let matchCount = 0;
            Severity: Minor
            Found in packages/web-components/fast-router/src/recognizer.ts - About 5 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 renderOpCodes has 124 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public *renderOpCodes(
                    codes: Op[],
                    renderInfo: RenderInfo,
                    source: unknown,
                    context: ExecutionContext

              FASTPicker has 37 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class FASTPicker extends FormAssociatedPicker {
                  /**
                   * Currently selected items. Comma delineated string ie. "apples,oranges".
                   *
                   * @remarks
              Severity: Minor
              Found in packages/web-components/fast-foundation/src/picker/picker.ts - About 4 hrs to fix

                File form-associated.pw.spec.ts has 368 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";
                
                // eslint-disable-next-line no-restricted-imports

                  FASTDataGrid has 35 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class FASTDataGrid extends FASTElement {
                      /**
                       *  generates a basic column definition by examining sample row data
                       */
                      public static generateColumns(row: object): ColumnDefinition[] {
                  Severity: Minor
                  Found in packages/web-components/fast-foundation/src/data-grid/data-grid.ts - About 4 hrs to fix

                    Function handleKeyDown has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public handleKeyDown(e: KeyboardEvent): boolean {
                            if (e.defaultPrevented) {
                                return false;
                            }
                            const activeElement = getRootActiveElement(this);
                    Severity: Minor
                    Found in packages/web-components/fast-foundation/src/picker/picker.ts - About 4 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 radio-group.pw.spec.ts has 350 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { expect, test } from "@playwright/test";
                    import type { Locator, Page } from "@playwright/test";
                    import type { FASTRadio } from "../radio/index.js";
                    import { fixtureURL } from "../__test__/helpers.js";
                    import { RadioGroupOrientation } from "./radio-group.options.js";

                      Consider simplifying this complex logical expression.
                      Open

                              if (isNative === void 0) {
                                  sourceText = fn.toString();
                                  i = sourceText.length;
                      
                                  // http://www.ecma-international.org/ecma-262/#prod-NativeFunction
                      Severity: Critical
                      Found in packages/web-components/fast-element/src/di/di.ts - About 4 hrs to fix

                        Function dispatch has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private dispatch<T>(record: DesignTokenChangeRecordImpl<T>) {
                                if (this !== record.target) {
                                    const { token } = record;
                                    // If the node is assigned the token being dispatched and the assigned value does not depend on the token
                                    // (circular token reference) then terminate the dispatch.

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

                            public map(...routes: MappableRouteDefinition<TSettings>[]) {
                                for (const route of routes) {
                                    if ("children" in route) {
                                        const titleBuilder = this.owner.createTitleBuilder();
                                        const childRoutes = route.children.map(x => {
                        Severity: Minor
                        Found in packages/web-components/fast-router/src/routes.ts - About 4 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 finalize has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public finalize(): void {
                                function collectSkippedStates(
                                    skippedStates: DynamicState<T>[],
                                    state: AnyState<T>
                                ): void {
                        Severity: Minor
                        Found in packages/web-components/fast-router/src/recognizer.ts - About 4 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 elemenent-renderer.spec.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import "../install-dom-shim.js";
                        import { FASTElement, customElement, css, html, attr, observable, when } from "@microsoft/fast-element";
                        import { expect, test } from '@playwright/test';
                        import { SyncFASTElementRenderer } from "./fast-element-renderer.js";
                        import fastSSR from "../exports.js";

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

                              public compareTo(b: Candidate<T>): -1 | 1 | 0 {
                                  const statesA = this.states;
                                  const statesB = b.states;
                          
                                  for (
                          Severity: Minor
                          Found in packages/web-components/fast-router/src/recognizer.ts - About 4 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 compiler.ts has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { isFunction, isString, Message } from "../interfaces.js";
                          import type { ExecutionContext } from "../observation/observable.js";
                          import { FAST } from "../platform.js";
                          import { DOM, DOMPolicy } from "../dom.js";
                          import type { Binding } from "../binding/binding.js";
                          Severity: Minor
                          Found in packages/web-components/fast-element/src/templating/compiler.ts - About 4 hrs to fix

                            File menu.register.ts has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { html } from "@microsoft/fast-element";
                            import { attr } from "@microsoft/fast-element";
                            import { css } from "@microsoft/fast-element";
                            import { FASTMenuItem, MenuItemRole, menuItemTemplate } from "../../menu-item/index.js";
                            import { FASTMenu } from "../menu.js";
                              Severity
                              Category
                              Status
                              Source
                              Language