Microsoft/fast-dna

View on GitHub

Showing 258 of 12,136 total issues

Function run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public async run(router: Router, message: NavigationMessage) {
        const events = router.config!.createEventSink();
        const match = await router.config!.recognizeRoute(message.path);

        if (match === null) {
Severity: Minor
Found in packages/web-components/fast-router/src/process.ts - About 1 hr 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 recognize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public async recognize(
        path: string,
        converters: Readonly<Record<string, RouteParameterConverter>> = {}
    ): Promise<RecognizedRoute<TSettings> | null> {
        const separated = QueryString.separate(path);
Severity: Minor
Found in packages/web-components/fast-router/src/recognizer.ts - About 1 hr to fix

    Function render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            *render(
                directive: HTMLBindingDirective,
                renderInfo: RenderInfo,
                source: any,
                renderer: DefaultTemplateRenderer,

      Function buildAPIMarkdown has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function buildAPIMarkdown() {
          await copyAPI();
      
          await new Promise((resolve, reject) =>
              exec(
      Severity: Minor
      Found in sites/website/src/generate-docs.js - About 1 hr to fix

        Function calcEditDistances has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function calcEditDistances(
            current: any[],
            currentStart: number,
            currentEnd: number,
            old: any[],
        Severity: Minor
        Found in packages/web-components/fast-element/src/observation/arrays.ts - About 1 hr 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 constructor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public constructor(element: TElement, definition: FASTElementDefinition) {
                super(element);
        
                this.source = element;
                this.definition = definition;

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

        function collectStyles<TSource = any, TParent = any>(
            strings: TemplateStringsArray,
            values: CSSValue<TSource, TParent>[]
        ): { styles: ComposableStyles[]; behaviors: HostBehavior<HTMLElement>[] } {
            const styles: ComposableStyles[] = [];
        Severity: Minor
        Found in packages/web-components/fast-element/src/styles/css.ts - About 1 hr 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 parseComplexParam has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function parseComplexParam(
            queryParams: Record<string, any>,
            keys: string[],
            value: any
        ): void {
        Severity: Minor
        Found in packages/web-components/fast-router/src/query-string.ts - About 1 hr 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 $add has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private $add(route: Route, settings?: TSettings): void {
                const path = route.path;
                const $route = new ConfigurableRoute(
                    route.path,
                    route.name || "",
        Severity: Minor
        Found in packages/web-components/fast-router/src/recognizer.ts - About 1 hr 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 create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            create<TSource = any, TParent = any>(
                source: TSource
            ): ViewBehaviorOrchestrator<TSource, TParent> {
                const behaviors: ViewBehavior[] = [];
                const targets: ViewBehaviorTargets = {};
        Severity: Minor
        Found in packages/web-components/fast-element/src/utilities.ts - About 1 hr 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 constructor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private constructor(
                type: TType,
                nameOrConfig: PartialFASTElementDefinition | string = (type as any).definition
            ) {
                if (isString(nameOrConfig)) {

          Function bind has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              bind(controller: ViewController): void {
                  const target = controller.targets[this.targetNodeId];
                  const isHydrating =
                      isHydratable(controller) &&
                      controller.hydrationStage &&

            Function collectStyles has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function collectStyles<TSource = any, TParent = any>(
                strings: TemplateStringsArray,
                values: CSSValue<TSource, TParent>[]
            ): { styles: ComposableStyles[]; behaviors: HostBehavior<HTMLElement>[] } {
                const styles: ComposableStyles[] = [];
            Severity: Minor
            Found in packages/web-components/fast-element/src/styles/css.ts - About 1 hr to fix

              Function register has 36 lines of code (exceeds 25 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 1 hr to fix

                Function compileContent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function compileContent(
                    context: CompilationContext,
                    node: Text,
                    parentId,
                    nodeId,
                Severity: Minor
                Found in packages/web-components/fast-element/src/templating/compiler.ts - About 1 hr to fix

                  Function parse has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      parse(queryString: string): Readonly<Record<string, string>> {
                          const queryParams = {} as Record<string, any>;
                          if (!queryString || typeof queryString !== "string") {
                              return queryParams;
                          }
                  Severity: Minor
                  Found in packages/web-components/fast-router/src/query-string.ts - About 1 hr to fix

                    Function isArrayIndex has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function isArrayIndex(value: unknown): value is number | string {
                        switch (typeof value) {
                            case "number":
                                return value >= 0 && (value | 0) === value;
                            case "string": {
                    Severity: Minor
                    Found in packages/web-components/fast-element/src/di/di.ts - About 1 hr 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 get has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public get<K extends Key>(key: K): Resolved<K> {
                            validateKey(key);
                    
                            if ((key as Resolver).$isResolver) {
                                return (key as Resolver).resolve(this, this);
                    Severity: Minor
                    Found in packages/web-components/fast-element/src/di/di.ts - About 1 hr 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 updateTokenList has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function updateTokenList(
                        this: HTMLBindingDirective,
                        target: Element,
                        aspect: string,
                        value: any

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

                    export function visitObject<TVisitorData>(
                        object: any,
                        deep: boolean,
                        visitor: ObjectVisitor<TVisitorData>,
                        data: TVisitorData,
                    Severity: Minor
                    Found in packages/web-components/fast-element/src/state/visitor.ts - About 1 hr 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

                    Severity
                    Category
                    Status
                    Source
                    Language