Microsoft/fast-dna

View on GitHub

Showing 426 of 3,220 total issues

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

import { Direction } from "@microsoft/fast-web-utilities";
import { expect, test } from "@playwright/test";
import type { Locator, Page } from "@playwright/test";
import { fixtureURL } from "../__test__/helpers.js";
import type { FASTSlider } from "./slider.js";
Severity: Minor
Found in packages/web-components/fast-foundation/src/slider/slider.pw.spec.ts - About 5 hrs to fix

    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

      FASTPicker has 41 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 5 hrs to fix

        Function copyArticleMarkdown has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function copyArticleMarkdown() {
            const mergeDocs = [
                {
                    src: path.resolve(root, "CODE_OF_CONDUCT.md"),
                    dest: path.resolve(outputDir, "community/code-of-conduct.md"),
        Severity: Major
        Found in sites/website/src/generate-docs.js - 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 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

                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

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

                      public handleKeyDown(e: KeyboardEvent): boolean {
                          if (e.defaultPrevented || this.disabled) {
                              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

                  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

                    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 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

                        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

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

                        import { expect } from "chai";
                        import {
                            FASTPicker,
                            FASTPickerList,
                            FASTPickerListItem,
                        Severity: Minor
                        Found in packages/web-components/fast-foundation/src/picker/picker.spec.ts - About 4 hrs to fix

                          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
                              Severity
                              Category
                              Status
                              Source
                              Language