aurelia/aurelia

View on GitHub

Showing 1,020 of 5,369 total issues

File events.ts has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { ILogger } from '@aurelia/kernel';

/**
 * Ranges
 * - viewport        : 3000 - 3049
Severity: Minor
Found in packages/router-lite/src/events.ts - About 3 hrs to fix

    Unparser has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class Unparser implements IVisitor<void> {
      public text: string = '';
    
      public static unparse(expr: IsExpressionOrStatement): string {
        const visitor = new Unparser();
    Severity: Minor
    Found in packages/expression-parser/src/ast.visitor.ts - About 3 hrs to fix

      Serializer has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class Serializer implements AST.IVisitor<string> {
        public static serialize(expr: AST.IsExpressionOrStatement | AST.CustomExpression): string {
          const visitor = new Serializer();
          if (expr == null) {
            return `${expr}`;
      Severity: Minor
      Found in packages/validation/src/ast-serialization.ts - About 3 hrs to fix

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

        import { TestContext, assert } from '@aurelia/testing';
        import { CustomElement, Aurelia, CustomAttribute, ICustomAttributeViewModel } from '@aurelia/runtime-html';
        
        describe('3-runtime-html/template-compiler.ce_and_surrogate.spec.ts', function () {
          interface ISurrogateIntegrationTestCase {

          File observer-locator.spec.ts has 325 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { CollectionLengthObserver, CollectionSizeObserver, ComputedObserver, DirtyCheckProperty, PrimitiveObserver, PropertyAccessor, SetterObserver } from '@aurelia/runtime';
          import {
            AttributeNSAccessor,
            CheckedObserver,
            ClassAttributeAccessor,
          Severity: Minor
          Found in packages/__tests__/src/3-runtime-html/observer-locator.spec.ts - About 3 hrs to fix

            Function getViewportHooks has 94 lines of code (exceeds 25 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: Major
            Found in packages/__tests__/src/router/_shared/hook-rules.ts - About 3 hrs to fix

              Function createObserver has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

                private createObserver(obj: IObservable, key: PropertyKey): IObserver {
                  if (this._nodeObserverLocator.handles(obj, key, this)) {
                    return this._nodeObserverLocator.getObserver(obj, key, this) as IObserver;
                  }
              
              
              Severity: Minor
              Found in packages/runtime/src/observer-locator.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 createFixture has 92 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async function createFixture(config?, App?, stateSpy?) {
                  const ctx = TestContext.create();
                  const { container, platform } = ctx;
              
                  if (App === void 0) {
              Severity: Major
              Found in packages/__tests__/src/router/router.spec.ts - About 3 hrs to fix

                File ast.ts has 319 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable @typescript-eslint/no-unused-vars */
                import { emptyArray } from '@aurelia/kernel';
                import type { IVisitor } from './ast.visitor';
                
                /** @internal */ export const ekAccessThis = 'AccessThis';
                Severity: Minor
                Found in packages/expression-parser/src/ast.ts - About 3 hrs to fix

                  Function au has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function au(options: {
                    include?: FilterPattern;
                    exclude?: FilterPattern;
                    pre?: boolean;
                    /**
                  Severity: Major
                  Found in packages-tooling/vite-plugin/src/index.ts - About 3 hrs to fix

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

                    import { DI, ILifecycleHooks, ILogger, IRouteViewModel, lifecycleHooks, NavigationInstruction, Params, RouteNode } from 'aurelia';
                    import { Article, ArticleListResponse, ArticleResponse, Comment, ErrorRecordResponse, IApiService, IJwtService, ArticleQueryParams, User, UserLogin, UserRegistration, UserResponse, UserUpdate, ArticleListQueryParams, Profile, ProfileResponse, ErrorList } from './api';
                    
                    /**
                     * Singleton `User` state that represents the currently logged-in user.
                    Severity: Minor
                    Found in examples/realworld-advanced/src/state.ts - About 3 hrs to fix

                      Function parseOne has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                        private static parseOne(seps: Separators, instruction: string): {
                          instruction: RoutingInstruction;
                          remaining: string;
                        } {
                          const tokens = [seps.parameters, seps.viewport, seps.noScope, seps.groupEnd, seps.scope, seps.sibling];
                      Severity: Minor
                      Found in packages/router/src/instructions/instruction-parser.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 findInstructions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                        public findInstructions(instructions: RoutingInstruction[], useDirectRouting: boolean, useConfiguredRoutes: boolean): FoundRoute {
                          const router = this.router;
                          let route = new FoundRoute();
                      
                          if (useConfiguredRoutes && !RoutingInstruction.containsSiblings(router, instructions)) {
                      Severity: Minor
                      Found in packages/router/src/routing-scope.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 for has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                        public static for(
                          origin: Element | ICustomElementViewModel | Viewport | ViewportScope | RoutingScope | ICustomElementController | IContainer | null,
                          instruction?: string
                        ): { scope: RoutingScope | null; instruction: string | undefined } {
                      
                      
                      Severity: Minor
                      Found in packages/router/src/routing-scope.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

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

                      import { test, expect, Page } from '@playwright/test';
                      import de from '../public/locales/de/translation.json';
                      import en from '../public/locales/en/translation.json';
                      
                      interface Spec {
                      Severity: Minor
                      Found in packages/__e2e__/4-i18n/playwright/i18n.spec.ts - About 3 hrs to fix

                        Function findMatchingRouteInRoutes has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private findMatchingRouteInRoutes(path: string, routes: Route[], parameters: Parameters): FoundRoute {
                            const found = new FoundRoute();
                            if (routes.length === 0) {
                              return found;
                            }
                        Severity: Major
                        Found in packages/router/src/routing-scope.ts - About 3 hrs to fix

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

                          import { Constructable } from '@aurelia/kernel';
                          import { PLATFORM, assert, eachCartesianJoin, TestContext, createFixture } from '@aurelia/testing';
                          import { isNode } from '../util.js';
                          
                          describe('3-runtime-html/focus.spec.ts', function () {
                          Severity: Minor
                          Found in packages/__tests__/src/3-runtime-html/focus.spec.ts - About 3 hrs to fix

                            Router has 29 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            export class Router implements IRouter {
                            
                              public static readonly closestEndpointKey = Protocol.annotation.keyFor('closest-endpoint');
                            
                              /**
                            Severity: Minor
                            Found in packages/router/src/router.ts - About 3 hrs to fix

                              File if.integration.spec.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import {
                                CustomAttribute,
                                ICustomElementViewModel,
                                IHydratedController,
                                IPlatform,
                              Severity: Minor
                              Found in packages/__tests__/src/3-runtime-html/if.integration.spec.ts - About 3 hrs to fix

                                File functions.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import { ErrorNames, createMappedError } from './errors';
                                import { Constructable, Overwrite } from './interfaces';
                                import { createLookup, isPromise, objectAssign } from './utilities';
                                
                                /**
                                Severity: Minor
                                Found in packages/kernel/src/functions.ts - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language