aurelia/aurelia

View on GitHub
packages/__tests__/src/router-lite/resources/href.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

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

    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 3 locations. Consider refactoring.
    Open

      it('allow navigating to route defined in parent context using ../ prefix', async function () {
        @customElement({ name: 'pro-duct', template: `product \${id} <a href="../products"></a>` })
        class Product {
          id: unknown;
          public canLoad(params: Params, _next: RouteNode, _current: RouteNode): boolean {
    Severity: Major
    Found in packages/__tests__/src/router-lite/resources/href.spec.ts and 2 other locations - About 3 days to fix
    packages/__tests__/src/router-lite/resources/load.spec.ts on lines 242..294
    packages/__tests__/src/router-lite/resources/load.spec.ts on lines 296..348

    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 621.

    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 navigating to route defined in grand-parent context using ../../ prefix', async function () {
        @customElement({ name: 'l-21', template: `l21 \${id} <a href="../../l12"></a>` })
        class L21 { }
        @customElement({ name: 'l-22', template: `l22 \${id} <a href="../../l11"></a>` })
        class L22 { }
    Severity: Major
    Found in packages/__tests__/src/router-lite/resources/href.spec.ts and 1 other location - About 2 days to fix
    packages/__tests__/src/router-lite/resources/load.spec.ts on lines 412..457

    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 473.

    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('supports routing instruction with parenthesized parameters', async function () {
        @route('c1/:id1/:id2?')
        @customElement({ name: 'c-1', template: 'c1 ${id1} ${id2}' })
        class C1 implements IRouteViewModel {
          private id1: string;
    Severity: Major
    Found in packages/__tests__/src/router-lite/resources/href.spec.ts and 1 other location - About 2 days to fix
    packages/__tests__/src/router-lite/resources/load.spec.ts on lines 1105..1135

    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 370.

    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 3 locations. Consider refactoring.
    Open

        @route({ id: 'product', path: 'product/:id{{^\\d+$}}' })
        @customElement({ name: 'pro-duct', template: `product \${id}` })
        class Product {
          public id: unknown;
          public canLoad(params: Params, _next: RouteNode, _current: RouteNode): boolean {
    Severity: Major
    Found in packages/__tests__/src/router-lite/resources/href.spec.ts and 2 other locations - About 3 hrs to fix
    packages/__tests__/src/router-lite/resources/load.spec.ts on lines 1242..1250
    packages/__tests__/src/router-lite/smoke-tests.spec.ts on lines 7083..7091

    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 106.

    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 3 locations. Consider refactoring.
    Open

        @route({ routes: [Product, NotFound], fallback: 'nf' })
        @customElement({
          name: 'ro-ot',
          template: `
            <a href="product/42"></a>
    Severity: Major
    Found in packages/__tests__/src/router-lite/resources/href.spec.ts and 2 other locations - About 50 mins to fix
    packages/__tests__/src/router-lite/resources/load.spec.ts on lines 1252..1262
    packages/__tests__/src/router-lite/smoke-tests.spec.ts on lines 7093..7098

    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 51.

    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

    There are no issues that match your filters.

    Category
    Status