aurelia/aurelia

View on GitHub

Showing 1,020 of 5,369 total issues

File event-delegator.spec.ts has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { IDisposable } from '@aurelia/kernel';
import {
  EventDelegator,
} from '@aurelia/compat-v1';
import { _, TestContext, assert } from '@aurelia/testing';
Severity: Minor
Found in packages/__tests__/src/compat-v1/event-delegator.spec.ts - About 3 hrs to fix

    Function formatSpecialArray has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    export function formatSpecialArray(
      ctx: IInspectContext,
      value: any[],
      recurseTimes: number,
      maxLength: number,
    Severity: Minor
    Found in packages/testing/src/inspect.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 createTemplate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      public createTemplate(input: string | Node): HTMLTemplateElement {
        if (isString(input)) {
          let result = markupCache[input];
          if (result === void 0) {
            const template = this._template;
    Severity: Minor
    Found in packages/template-compiler/src/template-element-factory.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 stringify has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      public stringify(context: IRouterConfiguration | IRouter | IContainer, excludeEndpoint: boolean = false, endpointContext: boolean = false, shallow = false): string {
        const seps = Separators.for(context);
        let excludeCurrentEndpoint = excludeEndpoint;
        let excludeCurrentComponent = false;
    
    
    Severity: Minor
    Found in packages/router/src/instructions/routing-instruction.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 preprocess has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    export function preprocess(
      unit: IFileUnit,
      options: IOptionalPreprocessOptions,
      _fileExists = fileExists
    ): ModifyCodeResult | undefined {
    Severity: Minor
    Found in packages-tooling/plugin-conventions/src/preprocess.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 expected has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            const expected = [...(function* () {
              yield* $('start', 'root', 0, 'binding', 'bound', 'attaching', 'attached');
    
              const hookName = hookSpec.toString().slice(0, -3) as typeof hookNames[number];
              yield* $(phase1, ['a', 'b'], 0, 'canLoad', 'loading', 'binding', 'bound', 'attaching', 'attached');
    Severity: Major
    Found in packages/__tests__/src/router-lite/hook-tests.spec.ts - About 3 hrs to fix

      File view-models.ts has 308 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Writable } from '@aurelia/kernel';
      import { ICustomElementController, IHydratedController, IHydratedParentController } from '@aurelia/runtime-html';
      import { Parameters, IRouteableComponent, LoadInstruction, Navigation, Viewport, RoutingInstruction } from '@aurelia/router';
      import { IHookInvocationAggregator } from './hook-invocation-tracker.js';
      import { IHookSpec, hookSpecsMap } from './hook-spec.js';
      Severity: Minor
      Found in packages/__tests__/src/router/_shared/view-models.ts - About 3 hrs to fix

        Function constructor has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public constructor(options: IAssertionErrorOpts) {
            const {
              actual,
              expected,
              message,
        Severity: Major
        Found in packages/testing/src/inspect.ts - About 3 hrs to fix

          Function formatProperty has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function formatProperty(
            ctx: IInspectContext,
            value: any,
            recurseTimes: number,
            key: PropertyKey,
          Severity: Major
          Found in packages/testing/src/inspect.ts - About 3 hrs to fix

            Function internalDispatch has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private async internalDispatch(actions: DispatchAction<T>[]) {
                const unregisteredAction = actions.find((a) => !this.actions.has(a.reducer));
                if (unregisteredAction) {
                  throw new UnregisteredActionError(unregisteredAction.reducer);
                }
            Severity: Major
            Found in packages/store-v1/src/store.ts - About 3 hrs to fix

              Function test has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function test() {
                const d = DI.createContainer();
                const I = DI.createInterface<I>();
                interface I {
                  c: number;
              Severity: Major
              Found in packages/kernel/src/api-test.ts - About 3 hrs to fix

                Function constructor has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  public constructor(
                    /**
                     * The global logger configuration.
                     */
                    config = resolve(ILogConfig),
                Severity: Minor
                Found in packages/kernel/src/logger.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 transition has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  public async transition(coordinator: NavigationCoordinator): Promise<void> {
                    const navigatingPrefix = this.router.configuration.options.indicators.viewportNavigating;
                
                    this.coordinators.push(coordinator);
                    // If this isn't the first coordinator, a navigation is already in process...
                Severity: Minor
                Found in packages/router/src/endpoints/viewport.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 createObservers has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                function createObservers(
                  controller: Controller,
                  definition: CustomElementDefinition | CustomAttributeDefinition,
                  instance: IIndexable<ICustomElementViewModel | ICustomAttributeViewModel>,
                ): void {
                Severity: Minor
                Found in packages/runtime-html/src/templating/controller.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 run has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public run(time: number = this.taskQueue.platform.performanceNow()): void {
                    if (__DEV__ && this._tracer.enabled) { this._tracer.enter(this, 'run'); }
                
                    if (this._status !== tsPending) {
                      if (__DEV__ && this._tracer.enabled) { this._tracer.leave(this, 'run error'); }
                Severity: Major
                Found in packages/platform/src/index.ts - About 3 hrs to fix

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

                  import { IRouteContext, IRouteViewModel, Params, route, RouteNode } from '@aurelia/router-lite';
                  import { customElement, IPlatform } from '@aurelia/runtime-html';
                  import { assert } from '@aurelia/testing';
                  import { start } from '../_shared/create-fixture.js';
                  
                  
                  Severity: Minor
                  Found in packages/__tests__/src/router-lite/resources/href.spec.ts - About 3 hrs to fix

                    TestContext has 27 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class TestContext {
                      public static readonly ambient: TestContext;
                    
                      public get wnd(): Window & typeof globalThis { return this.platform.globalThis as Window & typeof globalThis; }
                      public get doc(): Document { return this.platform.document; }
                    Severity: Minor
                    Found in packages/testing/src/test-context.ts - About 3 hrs to fix

                      Endpoint has 27 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export class Endpoint {
                        /**
                         * The contents of the endpoint. New contents are pushed to this, making
                         * the last one the active one.
                         */
                      Severity: Minor
                      Found in packages/router/src/endpoints/endpoint.ts - About 3 hrs to fix

                        Function getTestData has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function* getTestData(): Generator<[hook: HookName, getExpectedErrorLog: (phase: string, current: string) => any[]]> {
                                  yield [
                                    'canLoad',
                                    function getExpectedErrorLog(phase: string, current: string) {
                                      return [
                        Severity: Major
                        Found in packages/__tests__/src/router-lite/hook-tests.spec.ts - About 3 hrs to fix

                          File module-loader.spec.ts has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { AnalyzedModule, DI, IModuleLoader, aliasedResourcesRegistry } from '@aurelia/kernel';
                          
                          import * as ce_a_b_default from './modules/ce-a-b-default.js';
                          import * as ce_a_b_defaultb from './modules/ce-a-b-defaultb.js';
                          import * as ce_a_b from './modules/ce-a-b.js';
                          Severity: Minor
                          Found in packages/__tests__/src/1-kernel/module-loader.spec.ts - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language