aurelia/aurelia

View on GitHub

Showing 1,020 of 5,354 total issues

File logger.ts has 387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { createInterface, IContainer, IRegistry } from './di';
import { instanceRegistration, singletonRegistration } from './di.registration';
import { bound, toLookup } from './functions';
import { Class, Constructable } from './interfaces';
import { IPlatform } from './platform';
Severity: Minor
Found in packages/kernel/src/logger.ts - About 5 hrs to fix

    Function objEquiv has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    export function objEquiv(
      a: Object,
      b: Object,
      strict: boolean,
      keys: PropertyKey[],
    Severity: Minor
    Found in packages/testing/src/comparison.ts - About 5 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

    File validation-result-presenter-service.spec.ts has 384 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Registration, toArray, newInstanceForScope, DI, resolve, IContainer } from '@aurelia/kernel';
    import { IPlatform, CustomElement, customElement, Aurelia } from '@aurelia/runtime-html';
    import { PLATFORM, assert, ISpy, TestContext, createSpy, getVisibleText } from '@aurelia/testing';
    import {
      IValidationRules,

      Function hydrate has 125 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public hydrate(raw: any): any {
          switch (raw.$TYPE) {
            case ASTExpressionTypes.AccessMemberExpression: {
              const expr: Pick<AST.AccessMemberExpression, 'object' | 'name'> = raw;
              return new AST.AccessMemberExpression(this.hydrate(expr.object), expr.name);
      Severity: Major
      Found in packages/validation/src/ast-serialization.ts - About 5 hrs to fix

        File template-compiler.hooks.spec.ts has 374 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {
          Registration
        } from '@aurelia/kernel';
        import {
          CustomElement,
        Severity: Minor
        Found in packages/__tests__/src/3-runtime-html/template-compiler.hooks.spec.ts - About 5 hrs to fix

          File router.lifecycle-hooks.spec.ts has 374 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { IContainer } from '@aurelia/kernel';
          import { IRoute, IRouter, IRouterOptions, RouterConfiguration } from '@aurelia/router';
          import { Aurelia, CustomElement, IPlatform, lifecycleHooks } from '@aurelia/runtime-html';
          import { MockBrowserHistoryLocation, TestContext, assert } from '@aurelia/testing';
          
          
          Severity: Minor
          Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 5 hrs to fix

            Function getViewportHooks has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            function getViewportHooks(swapStrategy: SwapStrategy, phase: string, viewport: Viewport, type: '' | 'activate' | 'deactivate' = ''): string[] {
              const hooks = [];
              switch (type) {
                case 'activate':
                  if (!viewport.to.isEmpty) {
            Severity: Minor
            Found in packages/__tests__/src/router/_shared/hook-rules.ts - About 4 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 33 (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/router/src/errors.ts - About 4 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

            File routing-hook.spec.ts has 369 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { RoutingHook, RoutingInstruction, RouterConfiguration, IRouter, Navigation } from '@aurelia/router';
            import { assert, TestContext } from '@aurelia/testing';
            import { CustomElement, IPlatform, Aurelia } from '@aurelia/runtime-html';
            import { isNode } from '../util.js';
            
            
            Severity: Minor
            Found in packages/__tests__/src/router/routing-hook.spec.ts - About 4 hrs to fix

              File runner.ts has 368 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { OpenPromise } from './open-promise';
              
              /**
               * Class for running a sequence of steps with values,
               * functions and promises. Stays sync if possible.
              Severity: Minor
              Found in packages/router/src/utilities/runner.ts - About 4 hrs to fix

                File validation-errors-custom-attribute.spec.ts has 367 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { newInstanceForScope, newInstanceOf, resolve, toArray } from '@aurelia/kernel';
                import { assert, createSpy, getVisibleText, ISpy, TestContext } from '@aurelia/testing';
                import { IValidationRules } from '@aurelia/validation';
                import { CustomAttribute, CustomElement, customElement, IPlatform, Aurelia } from '@aurelia/runtime-html';
                import {

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

                  // This is to test for some intrinsic properties of enhance which is otherwise difficult to test in Data-driven tests parallel to `.app`
                  import { BrowserPlatform } from '@aurelia/platform-browser';
                  import { Constructable, DI, IContainer, Registration, onResolve, resolve } from '@aurelia/kernel';
                  import {
                    CustomElement,
                  Severity: Minor
                  Found in packages/__tests__/src/3-runtime-html/enhance.spec.ts - About 4 hrs to fix

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

                    import { I18N, I18nInitOptions, Signals } from '@aurelia/i18n';
                    import { EventAggregator } from '@aurelia/kernel';
                    import { nowrap } from '@aurelia/runtime';
                    import { assert, MockSignaler, createFixture } from '@aurelia/testing';
                    import { ISignaler } from '@aurelia/runtime-html';
                    Severity: Minor
                    Found in packages/__tests__/src/i18n/i18n.spec.ts - About 4 hrs to fix

                      File routing-instruction.ts has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { InstructionParser } from './instruction-parser';
                      import { InstructionParameters, Parameters } from './instruction-parameters';
                      import { InstructionComponent } from './instruction-component';
                      import { ComponentAppellation, ComponentParameters, LoadInstruction } from '../interfaces';
                      import { RoutingScope } from '../routing-scope';
                      Severity: Minor
                      Found in packages/router/src/instructions/routing-instruction.ts - About 4 hrs to fix

                        File repeat.vc.bb.spec.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { IContainer } from '@aurelia/kernel';
                        import { valueConverter, bindingBehavior, Aurelia, CustomElement, ICustomElementController, IPlatform } from '@aurelia/runtime-html';
                        import { assert, TestContext } from '@aurelia/testing';
                        import { createSpecFunction, TestExecutionContext, TestFunction } from '../util.js';
                        
                        
                        Severity: Minor
                        Found in packages/__tests__/src/3-runtime-html/repeat.vc.bb.spec.ts - About 4 hrs to fix

                          File has-multi-bindings.unit.spec.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { Char } from '../util.js';
                          import { assert } from '@aurelia/testing';
                          
                          describe('3-runtime-html/has-multi-bindings.unit.spec.ts', function () {
                            interface IBindingSpec {
                          Severity: Minor
                          Found in packages/__tests__/src/3-runtime-html/has-multi-bindings.unit.spec.ts - About 4 hrs to fix

                            Function _leaveDetaching has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                            Open

                              private _leaveDetaching(): void {
                                if (--this._detachingStack === 0) {
                                  // Note: this controller is the initiator (detach is only ever called on the initiator)
                                  /* istanbul ignore next */
                                  if (__DEV__ && this.debug) { this.logger!.trace(`detach()`); }
                            Severity: Minor
                            Found in packages/runtime-html/src/templating/controller.ts - About 4 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

                            Viewport has 35 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            export class Viewport extends Endpoint {
                              /**
                               * The contents of the viewport. New contents are pushed to this, making
                               * the last one the active one. It always holds at least one content, so
                               * that there's always a current content.
                            Severity: Minor
                            Found in packages/router/src/endpoints/viewport.ts - About 4 hrs to fix

                              File decorator-observable.spec.ts has 354 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { observable, SetterObserver, IObservable, IObserverLocator, IObserver } from '@aurelia/runtime';
                              import { assert, createFixture } from '@aurelia/testing';
                              import { noop } from '@aurelia/kernel';
                              import { ValueConverter, customElement } from '@aurelia/runtime-html';
                              
                              
                              Severity: Minor
                              Found in packages/__tests__/src/3-runtime-html/decorator-observable.spec.ts - About 4 hrs to fix

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

                                import { ValueConverter, customAttribute, customElement, ICustomAttributeController, IWindow } from '@aurelia/runtime-html';
                                import { StateDefaultConfiguration, fromState } from '@aurelia/state';
                                import { assert, createFixture, onFixtureCreated } from '@aurelia/testing';
                                
                                describe('state/state.spec.ts', function () {
                                Severity: Minor
                                Found in packages/__tests__/src/state/state.spec.ts - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language