aurelia/aurelia

View on GitHub

Showing 5,280 of 5,280 total issues

File controller.deactivation.partially-activated.spec.ts has 2271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  DI,
  onResolve,
  resolve,
} from '@aurelia/kernel';

    File au-slot.spec.tsx has 2097 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { delegateSyntax } from '@aurelia/compat-v1';
    import { IContainer, inject, newInstanceForScope, resolve } from '@aurelia/kernel';
    import { BindingMode, Aurelia, AuSlotsInfo, bindable, customElement, CustomElement, IAuSlotsInfo, IPlatform, ValueConverter } from '@aurelia/runtime-html';
    import { assert, createFixture, hJsx, TestContext } from '@aurelia/testing';
    import { createSpecFunction, TestExecutionContext, TestFunction } from '../util.js';
    Severity: Major
    Found in packages/__tests__/src/3-runtime-html/au-slot.spec.tsx - About 5 days to fix

      File template-compiler.static.if-else.spec.ts has 2051 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Aurelia, CustomElement } from "@aurelia/runtime-html";
      import { TestContext, assert } from "@aurelia/testing";
      
      describe("3-runtime-html/generated/template-compiler.static.if-else.spec.ts", function () {
          function createFixture() {

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          it('cross children navigation with multiple hierarchical routing configuration', async function () {
            @customElement({ name: 'l-21', template: `l21 <a href="../l22"></a>` })
            class L21 {
              private rtCtx: IRouteContext;
              public canLoad(params: Params, next: RouteNode, _current: RouteNode): boolean {
        Severity: Major
        Found in packages/__tests__/src/router-lite/resources/href.spec.ts and 1 other location - About 5 days to fix
        packages/__tests__/src/router-lite/resources/load.spec.ts on lines 566..653

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 922.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          it('allow explicitly binding the routing context to null to perform navigation from root', async function () {
            @customElement({ name: 'l-21', template: `l21 <a load="route:l22; context.bind:rtCtx.parent"></a>` })
            class L21 {
              private rtCtx: IRouteContext;
              public canLoad(params: Params, next: RouteNode, _current: RouteNode): boolean {
        Severity: Major
        Found in packages/__tests__/src/router-lite/resources/load.spec.ts and 1 other location - About 5 days to fix
        packages/__tests__/src/router-lite/resources/href.spec.ts on lines 110..197

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 922.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        export class ArticleState {
          errors: ErrorList = [];
          current: Article = Article.NONE;
          comments: Comment[] = [];
        
        
        Severity: Major
        Found in examples/realworld-conventions/src/state.ts and 1 other location - About 5 days to fix
        examples/realworld/src/state.ts on lines 113..201

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 878.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        export class ArticleState {
          errors: ErrorList = [];
          current: Article = Article.NONE;
          comments: Comment[] = [];
        
        
        Severity: Major
        Found in examples/realworld/src/state.ts and 1 other location - About 5 days to fix
        examples/realworld-conventions/src/state.ts on lines 115..203

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 878.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            (isNode() ? it.skip : it)('explicit history strategy can be used for individual navigation - configured: replace', async function () {
              @customElement({ name: 'ce-three', template: 'ce3' })
              class CeThree implements IRouteViewModel { }
              @customElement({ name: 'ce-two', template: 'ce2' })
              class CeTwo implements IRouteViewModel { }
        Severity: Major
        Found in packages/__tests__/src/router-lite/smoke-tests.spec.ts and 1 other location - About 5 days to fix
        packages/__tests__/src/router-lite/smoke-tests.spec.ts on lines 6055..6140

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 873.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            (isNode() ? it.skip : it)('explicit history strategy can be used for individual navigation - configured: push', async function () {
              @customElement({ name: 'ce-three', template: 'ce3' })
              class CeThree implements IRouteViewModel { }
              @customElement({ name: 'ce-two', template: 'ce2' })
              class CeTwo implements IRouteViewModel { }
        Severity: Major
        Found in packages/__tests__/src/router-lite/smoke-tests.spec.ts and 1 other location - About 5 days to fix
        packages/__tests__/src/router-lite/smoke-tests.spec.ts on lines 6142..6227

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 873.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export class RouterConfiguration {
          // ONLY used during registration to support .customize. Transfered to
          // instance property after that.
          private static options = RouterOptions.create();
        
        
        Severity: Major
        Found in packages/router-html/src/configuration.ts and 1 other location - About 5 days to fix
        packages/router/src/configuration.ts on lines 56..190

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 856.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export class RouterConfiguration {
          // ONLY used during registration to support .customize. Transfered to
          // instance property after that.
          private static options = RouterOptions.create();
        
        
        Severity: Major
        Found in packages/router/src/configuration.ts and 1 other location - About 5 days to fix
        packages/router-html/src/configuration.ts on lines 60..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 856.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            it('hide + show', async function () {
              const { au, host, p } = createFixture();
        
              @customElement({ name: 'app', template: '<div hide.bind="hide"></div><div show.bind="show"></div>' })
              class App implements ICustomElementViewModel {
        Severity: Major
        Found in packages/__tests__/src/3-runtime-html/show.integration.spec.ts and 1 other location - About 4 days to fix
        packages/__tests__/src/3-runtime-html/show.integration.spec.ts on lines 14..67

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 822.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            it('show + hide', async function () {
              const { au, host, p } = createFixture();
        
              @customElement({ name: 'app', template: '<div show.bind="show"></div><div hide.bind="hide"></div>' })
              class App implements ICustomElementViewModel {
        Severity: Major
        Found in packages/__tests__/src/3-runtime-html/show.integration.spec.ts and 1 other location - About 4 days to fix
        packages/__tests__/src/3-runtime-html/show.integration.spec.ts on lines 69..122

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 822.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function getParentChildHooks has a Cognitive Complexity of 231 (exceeds 5 allowed). Consider refactoring.
        Open

        export function* getParentChildHooks(deferUntil, swapStrategy, componentKind, phase, from, to) {
          const parentAdd: HookName[] = [...addHooks];
          const childAdd: HookName[] = ['canLoad', 'loading', ...addHooks];
          const parentRemove: HookName[] = ['unloading', ...removeHooks];
          const childRemove: HookName[] = [...removeHooks];
        Severity: Minor
        Found in packages/__tests__/src/router/_shared/hooks.ts - About 4 days 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 controller.hook-timings.integration.spec.ts has 1727 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Registration, Writable, DI, resolve } from '@aurelia/kernel';
        import {
          Aurelia,
          customElement,
          ICustomElementController,

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export class HookSpecs {
            public static get DEFAULT(): HookSpecs {
              return HookSpecs.create({});
            }
          
          
          Severity: Major
          Found in packages/__tests__/src/router/_shared/view-models.ts and 1 other location - About 4 days to fix
          packages/__tests__/src/router-lite/_shared/view-models.ts on lines 25..97

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 730.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export class HookSpecs {
            public static get DEFAULT(): HookSpecs {
              return HookSpecs.create({});
            }
          
          
          Severity: Major
          Found in packages/__tests__/src/router-lite/_shared/view-models.ts and 1 other location - About 4 days to fix
          packages/__tests__/src/router/_shared/view-models.ts on lines 40..112

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 730.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          File inspect.ts has 1597 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Significant portion of this code is copy-pasted from the node.js source
          // Modifications consist primarily of removing dependencies on v8 natives and adding typings
          
          // Original license:
          /*
          Severity: Major
          Found in packages/testing/src/inspect.ts - About 4 days to fix

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

            import { delegateSyntax } from '@aurelia/compat-v1';
            import {
              Constructable,
              IContainer,
              kebabCase,
            Severity: Major
            Found in packages/__tests__/src/3-runtime-html/template-compiler.spec.ts - About 4 days to fix

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

              import {
                ArrayObserver,
                copyIndexMap,
                disableArrayObservation,
                enableArrayObservation,
              Severity: Major
              Found in packages/__tests__/src/2-runtime/array-observer.spec.ts - About 4 days to fix
                Severity
                Category
                Status
                Source
                Language