Microsoft/fast-dna

View on GitHub

Showing 425 of 3,219 total issues

Function FormAssociated has 226 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function FormAssociated<T extends ConstructableFormAssociated>(BaseCtor: T): T {
    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 template.spec.ts has 538 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { expect } from "chai";
    import { html, ViewTemplate } from "./template.js";
    import { Markup, nextId, Parser } from "./markup.js";
    import { HTMLBindingDirective } from "./html-binding-directive.js";
    import { HTMLDirective, ViewBehaviorFactory, Aspected, htmlDirective, AddViewBehaviorFactory, CompiledViewBehaviorFactory } from "./html-directive.js";
    Severity: Major
    Found in packages/web-components/fast-element/src/templating/template.spec.ts - About 1 day to fix

      File element-controller.spec.ts has 537 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import chai, { expect } from "chai";
      import { ElementStyles } from "../index.debug.js";
      import type { HostBehavior, HostController } from "../styles/host.js";
      import { observable, Observable } from "../observation/observable.js";
      import { css } from "../styles/css.js";

        Function renderOpCodes has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

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

        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 design-token-node.ts has 518 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import type { Disposable, ExpressionNotifier, Subscriber } from "@microsoft/fast-element";
        import { Observable } from "@microsoft/fast-element";
        import type { DesignToken } from "./design-token.js";
        
        /**

          Function Observable has 209 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Observable = FAST.getById(KernelServiceId.observable, () => {
              const queueUpdate = Updates.enqueue;
              const volatileRegex = /(:|&&|\|\||if|\?\.)/;
              const notifierLookup = new WeakMap<any, Notifier>();
              let watcher: ExpressionNotifierImplementation | undefined = void 0;
          Severity: Major
          Found in packages/web-components/fast-element/src/observation/observable.ts - About 1 day to fix

            File number-field.pw.spec.ts has 509 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { spinalCase } 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 { FASTNumberField } from "./number-field.js";

              File calendar.pw.spec.ts has 505 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 { FASTCalendar } from "./calendar.js";
              import { DateFormatter } from "./date-formatter.js";

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

                import { expect } from "chai";
                import { Updates } from "./update-queue.js";
                import { PropertyChangeNotifier, SubscriberSet } from "./notifier.js";
                import { ExecutionContext, Expression, Observable, observable, volatile } from "./observable.js";
                import { Fake } from "../testing/fakes.js";

                  Function parseStringToOpCodes has 182 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function parseStringToOpCodes(
                      /**
                       * The string to parse
                       */
                      templateString: string,

                    Function Observable has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const Observable = FAST.getById(KernelServiceId.observable, () => {
                        const queueUpdate = Updates.enqueue;
                        const volatileRegex = /(:|&&|\|\||if|\?\.)/;
                        const notifierLookup = new WeakMap<any, Notifier>();
                        let watcher: ExpressionNotifierImplementation | undefined = void 0;
                    Severity: Minor
                    Found in packages/web-components/fast-element/src/observation/observable.ts - About 7 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 styles.spec.ts has 467 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { expect } from "chai";
                    import {
                        AdoptedStyleSheetsStrategy, StyleElementStrategy
                    } from "../components/element-controller.js";
                    import type { StyleTarget } from "./style-strategy.js";
                    Severity: Minor
                    Found in packages/web-components/fast-element/src/styles/styles.spec.ts - About 7 hrs to fix

                      FASTAnchoredRegion has 49 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export class FASTAnchoredRegion extends FASTElement {
                          /**
                           * The HTML ID of the anchor element this region is positioned relative to
                           *
                           * @public

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

                        async function copyArticleMarkdown() {
                            await moveMarkdownFiles(path.resolve(fastElement, "docs/guide"), "fast-element");
                        
                            const mergeDocs = [
                                {
                        Severity: Major
                        Found in sites/website/src/generate-docs.js - About 6 hrs to fix

                          File update-queue.spec.ts has 425 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { expect } from "chai";
                          import { Updates } from "./update-queue.js";
                          
                          const waitMilliseconds = 100;
                          const maxRecursion = 10;

                            File element-controller.ts has 422 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { Message, Mutable } from "../interfaces.js";
                            import { PropertyChangeNotifier } from "../observation/notifier.js";
                            import {
                                ExecutionContext,
                                ExpressionController,

                              File slider.pw.spec.ts has 419 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 6 hrs to fix

                                Function getDependencies has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    getDependencies(Type: Constructable | Injectable): Key[] {
                                        // Note: Every detail of this getDependencies method is pretty deliberate at the moment, and probably not yet 100% tested from every possible angle,
                                        // so be careful with making changes here as it can have a huge impact on complex end user apps.
                                        // Preferably, only make changes to the dependency resolution process via a RFC.
                                
                                
                                Severity: Minor
                                Found in packages/web-components/fast-element/src/di/di.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

                                File toolbar.pw.spec.ts has 413 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 { ToolbarOrientation } from "./toolbar.options.js";
                                
                                

                                  File render.ts has 409 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { FASTElementDefinition } from "../components/fast-definitions.js";
                                  import type { FASTElement } from "../components/fast-element.js";
                                  import type { DOMPolicy } from "../dom.js";
                                  import { Constructable, isFunction, isString } from "../interfaces.js";
                                  import { Binding, BindingDirective } from "../binding/binding.js";
                                  Severity: Minor
                                  Found in packages/web-components/fast-element/src/templating/render.ts - About 5 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language