Microsoft/fast-dna

View on GitHub

Showing 231 of 12,131 total issues

Function collect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static collect(
        Owner: Function,
        ...attributeLists: (ReadonlyArray<string | AttributeConfiguration> | undefined)[]
    ): ReadonlyArray<AttributeDefinition> {
        const attributes: AttributeDefinition[] = [];
Severity: Minor
Found in packages/web-components/fast-element/src/components/attributes.ts - About 55 mins 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 addStyles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void {
        if (!styles) {
            return;
        }

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

function compileAttributes(
    context: CompilationContext,
    parentId: string,
    node: HTMLElement,
    nodeId: string,
Severity: Minor
Found in packages/web-components/fast-element/src/templating/compiler.ts - About 55 mins 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 a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 renderProperty has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private static *renderProperty(
        code: AttributeBindingOp,
        value: any,
        renderInfo: RenderInfo
    ) {

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

Avoid deeply nested control flow statements.
Open

                        if (typeof Proto === "function" && Proto !== Function.prototype) {
                            dependencies = cloneArrayWithPossibleProps(
                                DI.getDependencies(Proto)
                            );
                        } else {
Severity: Major
Found in packages/web-components/fast-element/src/di/di.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        for (let i = 0; i < len; ++i) {
                            key = keys[i];
                            if (!isArrayIndex(key)) {
                                dependencies[key] = annotationParamtypes[key];
                            }
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.ts - About 45 mins to fix

      Function calc has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          current: unknown[],
          currentStart: number,
          currentEnd: number,
          old: unknown[],
          oldStart: number,
      Severity: Minor
      Found in packages/web-components/fast-element/src/observation/arrays.ts - About 45 mins to fix

        Function calcEditDistances has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            current: any[],
            currentStart: number,
            currentEnd: number,
            old: any[],
            oldStart: number,
        Severity: Minor
        Found in packages/web-components/fast-element/src/observation/arrays.ts - About 45 mins to fix

          Function removeStyles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public removeStyles(
                  styles: ElementStyles | HTMLStyleElement | null | undefined
              ): void {
                  if (!styles) {
                      return;

          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

          Avoid deeply nested control flow statements.
          Open

                                      if (searchAncestors || !regInChild) {
                                          childExpectation.push(0, 1, 2, 3, 4);
                                      }
          Severity: Major
          Found in packages/web-components/fast-element/src/di/di.getAll.spec.ts - About 45 mins to fix

            Function notify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public notify(args: any): void {
                    const spillover = this.spillover;
                    const subject = this.subject;
            
                    if (spillover === void 0) {
            Severity: Minor
            Found in packages/web-components/fast-element/src/observation/notifier.ts - About 45 mins 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 collectStyles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function collectStyles(style: ComposableStyles): string {
                let content: string = "";
                if (typeof style === "string") {
                    content = style;
                } else if (style instanceof CSSStyleSheet) {
            Severity: Minor
            Found in packages/web-components/fast-ssr/src/styles/style-renderer.ts - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                for (let i = 0; i < len; ++i) {
                                    auAnnotationParamtype = annotationParamtypes[i];
                                    if (auAnnotationParamtype !== void 0) {
                                        dependencies[i] = auAnnotationParamtype;
                                    }
            Severity: Major
            Found in packages/web-components/fast-element/src/di/di.ts - About 45 mins to fix

              Function tryConnect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private tryConnect() {
                      if (this.config === null || !this.isConnected) {
                          return;
                      }
              
              
              Severity: Minor
              Found in packages/web-components/fast-router/src/router.ts - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                                          if (def) {
                                              factory = factoryFromElementName(def.name);
                                          } else {
                                              throw new Error(
                                                  "Invalid value for element in route config."
              Severity: Major
              Found in packages/web-components/fast-router/src/commands.ts - About 45 mins to fix

                Function getEventInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private getEventInfo(event: MouseEvent): AnchorEventInfo {
                        const info: AnchorEventInfo = {
                            shouldHandleEvent: false,
                            href: null,
                            anchor: null,
                Severity: Minor
                Found in packages/web-components/fast-router/src/links.ts - About 45 mins 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 compileAttributes has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    context: CompilationContext,
                    parentId: string,
                    node: HTMLElement,
                    nodeId: string,
                    nodeIndex: number,
                Severity: Minor
                Found in packages/web-components/fast-element/src/templating/compiler.ts - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if (nextState.nextStates !== null) {
                                                  for (const $nextState of nextState.nextStates) {
                                                      collectSkippedStates(skippedStates, $nextState);
                                                  }
                                              }
                  Severity: Major
                  Found in packages/web-components/fast-router/src/recognizer.ts - About 45 mins to fix

                    Function getParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public getParams(): Record<string, string | undefined> {
                            const { states, chars, endpoint } = this;
                    
                            const params: Record<string, string | undefined> = {};
                            // First initialize all properties with undefined so they all exist (even if they're not filled, e.g. non-matched optional params)
                    Severity: Minor
                    Found in packages/web-components/fast-router/src/recognizer.ts - About 45 mins 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