Microsoft/fast-dna

View on GitHub

Showing 231 of 12,131 total issues

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

    public buildTitle(rootTitle: string, routeTitles: string[][]) {
        let title = rootTitle;

        for (const level of routeTitles) {
            if (title) {
Severity: Minor
Found in packages/web-components/fast-router/src/titles.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 (const [path, match, $params] of tests) {
                        const leading = hasLeadingSlash ? "/" : "";
                        const trailing = hasTrailingSlash ? "/" : "";

                        let title = `should`;
Severity: Major
Found in packages/web-components/fast-router/src/recognizer.spec.ts - About 45 mins to fix

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

        public static fromDefinition(
            owner: RouterConfiguration,
            definition:
                | ElementRouteDefinition
                | TemplateRouteDefinition
    Severity: Minor
    Found in packages/web-components/fast-router/src/commands.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 compile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        compile<TSource = any, TParent = any>(
            html: string | HTMLTemplateElement,
            factories: Record<string, ViewBehaviorFactory>,
            policy: DOMPolicy = DOM.policy
        ): TemplateCompilationResult<TSource, TParent> {
    Severity: Minor
    Found in packages/web-components/fast-element/src/templating/compiler.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 computedState has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function computedState<T>(
        initialize: ComputedInitializer<T>,
        name = "ComputedState"
    ): ComputedState<T> {
        let setupCallback: ComputedSetupCallback | null = null;
    Severity: Minor
    Found in packages/web-components/fast-element/src/state/state.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 (isString(result)) {
                    result = instructionToTemplate(
                        getForInstance(dataBinding.evaluate(s, c), result)
                    );
                } else if (result instanceof Node) {
    Severity: Major
    Found in packages/web-components/fast-element/src/templating/render.ts - About 45 mins to fix

      Function createOutput has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                  size: number,
                  filter: (index: number) => boolean = () => true,
                  prefix = "",
                  wrapper = input => input,
                  fromIndex: number = 0
      Severity: Minor
      Found in packages/web-components/fast-element/src/templating/repeat.spec.ts - About 35 mins to fix

        Function expectAspect has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                template: ViewTemplate,
                type: T,
                sourceAspect: string,
                targetAspect: string,
                aspectType: number
        Severity: Minor
        Found in packages/web-components/fast-element/src/templating/template.spec.ts - About 35 mins to fix

          Function render has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                      *render(behaviorFactory, renderInfo, source, renderer, context) {
          Severity: Minor
          Found in packages/web-components/fast-ssr/src/exports.spec.ts - About 35 mins to fix

            Function render has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        directive: RepeatDirective,
                        renderInfo: RenderInfo,
                        source: any,
                        renderer: DefaultTemplateRenderer,
                        context: ExecutionContext
            Severity: Minor
            Found in packages/web-components/fast-ssr/src/template-renderer/directives.ts - About 35 mins to fix

              Function render has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                          *render(behaviorFactory, renderInfo, source, renderer, context) {
              Severity: Minor
              Found in packages/web-components/fast-ssr/src/exports.spec.ts - About 35 mins to fix

                Function render has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                            directive: RenderDirective,
                            renderInfo: RenderInfo,
                            source: any,
                            renderer: DefaultTemplateRenderer,
                            context: ExecutionContext
                Severity: Minor
                Found in packages/web-components/fast-ssr/src/template-renderer/directives.ts - About 35 mins to fix

                  Function compileContent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

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

                    Function visitObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        object: any,
                        deep: boolean,
                        visitor: ObjectVisitor<TVisitorData>,
                        data: TVisitorData,
                        traversed: WeakSet<any> | Set<any>
                    Severity: Minor
                    Found in packages/web-components/fast-element/src/state/visitor.ts - About 35 mins to fix

                      Function renderTemplate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private renderTemplate(template: ElementViewTemplate | null | undefined): void {
                              // When getting the host to render to, we start by looking
                              // up the shadow root. If there isn't one, then that means
                              // we're doing a Light DOM render to the element's direct children.
                              const element = this.source;

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

                          parse(
                              value: string,
                              factories: Record<string, ViewBehaviorFactory>
                          ): (string | ViewBehaviorFactory)[] | null {
                              const parts = value.split(interpolationStart);
                      Severity: Minor
                      Found in packages/web-components/fast-element/src/templating/markup.ts - About 35 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 unsubscribe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public unsubscribe(subscriber: Subscriber): void {
                              const spillover = this.spillover;
                      
                              if (spillover === void 0) {
                                  if (this.sub1 === subscriber) {
                      Severity: Minor
                      Found in packages/web-components/fast-element/src/observation/notifier.ts - About 35 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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private constructor(
                              type: TType,
                              nameOrConfig: PartialFASTElementDefinition | string = (type as any).definition
                          ) {
                              if (isString(nameOrConfig)) {
                      Severity: Minor
                      Found in packages/web-components/fast-element/src/components/fast-definitions.ts - About 35 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 project has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function project(array: unknown[], changes: Splice[]): Splice[] {
                          let splices: Splice[] = [];
                          const initialSplices: Splice[] = [];
                      
                          for (let i = 0, ii = changes.length; i < ii; i++) {
                      Severity: Minor
                      Found in packages/web-components/fast-element/src/observation/arrays.ts - About 35 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 getElementRenderer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const getElementRenderer = (
                          renderInfo: RenderInfo,
                          tagName: string,
                          ceClass: typeof HTMLElement | undefined = customElements.get(tagName),
                          attributes: AttributesMap = new Map()

                      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