aurelia/aurelia

View on GitHub

Showing 1,020 of 5,369 total issues

Function keyCheck has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function keyCheck(
  val1: {},
  val2: {},
  strict: boolean,
  memos: Memos | undefined,
Severity: Major
Found in packages/testing/src/comparison.ts - About 3 hrs to fix

    Function getHmrCode has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getHmrCode(className: string, moduleNames: string = ''): string {
      const moduleText = 'import.meta';
      const code = `
    import { Metadata as $$M } from '@aurelia/metadata';
    import {
    Severity: Major
    Found in packages-tooling/vite-plugin/src/index.ts - About 3 hrs to fix

      File promise.ts has 296 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Task, TaskAbortError } from '@aurelia/platform';
      import { ILogger, onResolve, onResolveAll, resolve, isPromise, registrableMetadataKey } from '@aurelia/kernel';
      import { Scope } from '../../binding/scope';
      import { INode, IRenderLocation } from '../../dom';
      import { IPlatform } from '../../platform';
      Severity: Minor
      Found in packages/runtime-html/src/resources/template-controllers/promise.ts - About 3 hrs to fix

        Function getHookSpecs has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        function getHookSpecs<T extends HookName>(name: T) {
          return {
            sync: {
              name,
              type: 'sync',
        Severity: Minor
        Found in packages/__tests__/src/router/_shared/hook-spec.ts - About 3 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 test has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        function test() {
          const d = DI.createContainer();
          const I = DI.createInterface<I>();
          interface I {
            c: number;
        Severity: Minor
        Found in packages/kernel/src/api-test.ts - About 3 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 testIt has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async function testIt(components: number, connected = true, defaults = [1, 1], timings: any = {}) {
              const root1 = new Controller('root', [
                new Controller('parent-1', [
                  new Controller('child-1.1', [], connected, ...(timings['child-1.1'] ?? defaults)),
                  new Controller('child-1.2', [], connected, ...(timings['child-1.2'] ?? defaults)),
        Severity: Major
        Found in packages/__tests__/src/router/runner.spec.ts - About 3 hrs to fix

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

          import { EventAggregator, IEventAggregator } from '@aurelia/kernel';
          import { assert } from '@aurelia/testing';
          
          type EA = IEventAggregator & {
            eventLookup: Record<string, ((...args: unknown[]) => void)[]>;
          Severity: Minor
          Found in packages/__tests__/src/1-kernel/eventaggregator.spec.ts - About 3 hrs to fix

            Function connectTo has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function connectTo<T, R = any>(settings?: ((store: Store<T>) => Observable<R>) | ConnectToSettings<T, R>) {
              const _settings = {
                selector: (typeof settings === 'function' ? settings : defaultSelector),
                ...settings
              } as unknown as ConnectToSettings<T>;
            Severity: Major
            Found in packages/store-v1/src/decorator.ts - About 2 hrs to fix

              Function getPendingActivationLog has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function getPendingActivationLog(prefix: string, isDeactivated: boolean) {
                        const logs = [];
                        /* eslint-disable no-fallthrough */
                        switch (hook) {
                          case 'attached': logs.push(

                Function getSingleHooks has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                export function* getSingleHooks(deferUntil, swapStrategy, componentKind, phase, from, to) {
                  if (from) { yield `${phase}.${from}.canUnload`; }
                  if (to) { yield `${phase}.${to}.canLoad`; }
                  if (from) { yield `${phase}.${from}.unloading`; }
                  if (to) { yield `${phase}.${to}.loading`; }
                Severity: Minor
                Found in packages/__tests__/src/router/_shared/hooks.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 getMessageByCode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                const getMessageByCode = (name: ErrorNames, ...details: unknown[]) => {
                  let cooked: string = errorsMap[name];
                  for (let i = 0; i < details.length; ++i) {
                    const regex = new RegExp(`{{${i}(:.*)?}}`, 'g');
                    let matches = regex.exec(cooked);
                Severity: Minor
                Found in packages/validation-html/src/errors.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 getMessageByCode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                const getMessageByCode = (name: ErrorNames, ...details: unknown[]) => {
                  let cooked: string = errorsMap[name];
                  for (let i = 0; i < details.length; ++i) {
                    const regex = new RegExp(`{{${i}(:.*)?}}`, 'g');
                    let matches = regex.exec(cooked);
                Severity: Minor
                Found in packages/runtime/src/errors.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 formatValue has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                export function formatValue(
                  ctx: IInspectContext,
                  value: any,
                  recurseTimes: number,
                  typedArray?: boolean,
                Severity: Minor
                Found in packages/testing/src/inspect.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 createSpy has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                export function createSpy<
                  T extends {} | AnyFunction = VoidFunction,
                  K extends keyof T = never,
                  F extends AnyFunction = never,
                >(instanceOrInnerFn?: T, key?: K, callThroughOrInnerFn?: true | F) {
                Severity: Minor
                Found in packages/testing/src/util.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 getMessageByCode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                const getMessageByCode = (name: ErrorNames, ...details: unknown[]) => {
                  let cooked: string = errorsMap[name];
                  for (let i = 0; i < details.length; ++i) {
                    const regex = new RegExp(`{{${i}(:.*)?}}`, 'g');
                    let matches = regex.exec(cooked);
                Severity: Minor
                Found in packages/template-compiler/src/errors.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 getMessageByCode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                const getMessageByCode = (name: ErrorNames, ...details: unknown[]) => {
                  let cooked: string = errorsMap[name];
                  for (let i = 0; i < details.length; ++i) {
                    const regex = new RegExp(`{{${i}(:.*)?}}`, 'g');
                    let matches = regex.exec(cooked);
                Severity: Minor
                Found in packages/fetch-client/src/errors.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 navigate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                  public navigate(navigation: INavigation | Navigation): Promise<boolean> {
                    if (!(navigation instanceof Navigation)) {
                      navigation = Navigation.create(navigation);
                    }
                    const navigationFlags = new NavigationFlags();
                Severity: Minor
                Found in packages/router/src/navigator.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 finalize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                  public async finalize(navigation: Navigation, isLast: boolean): Promise<void> {
                    // If this navigation shouldn't be added to history...
                    if (navigation.untracked ?? false) {
                      // ...and it's a navigation from the browser (back, forward, url)...
                      if ((navigation.fromBrowser ?? false) && this.options.store != null) {
                Severity: Minor
                Found in packages/router/src/navigator.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 getMessageByCode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                const getMessageByCode = (name: ErrorNames, ...details: unknown[]) => {
                  let cooked: string = errorsMap[name];
                  for (let i = 0; i < details.length; ++i) {
                    const regex = new RegExp(`{{${i}(:.*)?}}`, 'g');
                    let matches = regex.exec(cooked);
                Severity: Minor
                Found in packages/dialog/src/errors.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 getMessageByCode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                const getMessageByCode = (name: ErrorNames, ...details: unknown[]) => {
                  let cooked: string = errorsMap[name];
                  for (let i = 0; i < details.length; ++i) {
                    const regex = new RegExp(`{{${i}(:.*)?}}`, 'g');
                    let matches = regex.exec(cooked);
                Severity: Minor
                Found in packages/i18n/src/errors.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

                Severity
                Category
                Status
                Source
                Language