Microsoft/fast-dna

View on GitHub

Showing 426 of 3,050 total issues

Function compareTo has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public compareTo(b: Candidate<T>): -1 | 1 | 0 {
        const statesA = this.states;
        const statesB = b.states;

        for (
Severity: Major
Found in packages/web-components/fast-router/src/recognizer.ts - About 2 hrs to fix

    Function fromDefinition has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static fromDefinition(
            owner: RouterConfiguration,
            definition:
                | ElementRouteDefinition
                | TemplateRouteDefinition
    Severity: Major
    Found in packages/web-components/fast-router/src/commands.ts - About 2 hrs to fix

      Function getDays has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public getDays(
              info: CalendarInfo = this.getMonthInfo(),
              minWeeks: number = this.minWeeks
          ): CalendarDateInfo[][] {
              minWeeks = minWeeks > 10 ? 10 : minWeeks;
      Severity: Minor
      Found in packages/web-components/fast-foundation/src/calendar/calendar.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

      Function createContext has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function createContext<K extends Key>(
          nameConfigOrCallback?:
              | string
              | ((builder: ResolverBuilder<K>) => Resolver<K>)
              | InterfaceConfiguration,
      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

      Function CheckableFormAssociated has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function CheckableFormAssociated<T extends ConstructableFormAssociated>(
          BaseCtor: T
      ): T {
          interface C extends FormAssociatedElement {}
          class C extends FormAssociated(BaseCtor) {}

        Function selectTemplate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function comboboxTemplate has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function comboboxTemplate<T extends FASTCombobox>(
              options: ComboboxOptions = {}
          ): ElementViewTemplate<T> {
              return html<T>`
                  <template

            Function handleKeydown has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public handleKeydown(e: KeyboardEvent): void {
                    // if the cell does not have an internal focus queue we can ignore keystrokes
                    if (
                        e.defaultPrevented ||
                        this.columnDefinition === null ||

              FASTTooltip has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class FASTTooltip extends FASTElement {
                  /**
                   * The visibility of the tooltip.
                   *
                   * @internal
              Severity: Minor
              Found in packages/web-components/fast-foundation/src/tooltip/tooltip.ts - About 2 hrs to fix

                Function computedState has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function computedState<T>(
                    initialize: ComputedInitializer<T>,
                    name = "ComputedState"
                ): ComputedState<T> {
                    let setupCallback: ComputedSetupCallback | null = null;
                Severity: Major
                Found in packages/web-components/fast-element/src/state/state.ts - About 2 hrs to fix

                  File tabs.ts has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { attr, FASTElement, observable } from "@microsoft/fast-element";
                  import {
                      keyArrowDown,
                      keyArrowLeft,
                      keyArrowRight,
                  Severity: Minor
                  Found in packages/web-components/fast-foundation/src/tabs/tabs.ts - About 2 hrs to fix

                    Function noninteractiveCalendarTemplate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function noninteractiveCalendarTemplate<T extends FASTCalendar>(
                        options: CalendarOptions,
                        todayString: string
                    ): ViewTemplate<T> {
                        return html<T>`

                      Function textAreaTemplate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function textAreaTemplate<T extends FASTTextArea>(
                          options: TextAreaOptions = {}
                      ): ElementViewTemplate<T> {
                          return html<T>`
                              <label

                        Function keydownHandler has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public keydownHandler(e: Event & KeyboardEvent): boolean | void {
                                const key = e.key;
                        
                                if (e.ctrlKey || e.shiftKey) {
                                    return true;
                        Severity: Minor
                        Found in packages/web-components/fast-foundation/src/combobox/combobox.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

                        Function getAll has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public getAll<K extends Key>(
                                key: K,
                                searchAncestors: boolean = false
                            ): readonly Resolved<K>[] {
                                validateKey(key);
                        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

                        Function defineProperty has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            defineProperty(
                                target: {},
                                propertyName: string,
                                key: Key,
                                respectConnection = false
                        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

                        Function createElementTemplate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function createElementTemplate<TSource = any, TParent = any>(
                            tagName: string,
                            options?: ElementCreateOptions
                        ): ViewTemplate<TSource, TParent> {
                            const markup: Array<string> = [];
                        Severity: Minor
                        Found in packages/web-components/fast-element/src/templating/render.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

                        Function keydownHandler has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public keydownHandler(e: Event & KeyboardEvent): boolean | void {
                                const key = e.key;
                        
                                if (e.ctrlKey || e.shiftKey) {
                                    return true;
                        Severity: Major
                        Found in packages/web-components/fast-foundation/src/combobox/combobox.ts - About 2 hrs to fix

                          Function merge has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function merge(splice: Splice, splices: Splice[]): void {
                              let inserted = false;
                              let insertionOffset = 0;
                          
                              for (let i = 0; i < splices.length; i++) {
                          Severity: Major
                          Found in packages/web-components/fast-element/src/observation/arrays.ts - About 2 hrs to fix

                            ElementController has 21 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            export class ElementController<TElement extends HTMLElement = HTMLElement>
                                extends PropertyChangeNotifier
                                implements HostController<TElement>
                            {
                                private boundObservables: Record<string, any> | null = null;
                              Severity
                              Category
                              Status
                              Source
                              Language