aurelia/aurelia

View on GitHub
packages/__tests__/src/router/router.lifecycle-hooks.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

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 _expected has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          function _expected($config: typeof config) {
            let oneLoaded = false;
            let twoChecked = false;
            let twoLoaded = false;
            const expected = [];
    Severity: Major
    Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 2 hrs to fix

      Function _expected has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function _expected(config: typeof configs[0]) {
              let oneLoaded = false;
              let twoChecked = false;
              // let twoLoaded = false;
              const expected = [];
      Severity: Major
      Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 2 hrs to fix

        Function $setup has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async function $setup(
            config?: IRouterOptions,
            dependencies: any[] = [],
            routes: IRoute[] = [],
            stateSpy: NavigationStateSpy = void 0,
        Severity: Minor
        Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 1 hr to fix

          Function _elements has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _elements(config, calledHooks) {
                @lifecycleHooks()
                class Hooks {
                  name = 'Hooks';
                  canLoad(vm) { calledHooks.push(`${this.name}:${vm.name}:canLoad`); return config.Hooks_canLoad; }
          Severity: Minor
          Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                          if (config.Two_canUnload) {
                            expected.push('Hooks:my-two:unloading', 'VM:my-two:unloading');
                            // two = false;
                          }
            Severity: Major
            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if ($config.Two_canUnload) {
                              expected.push('Hooks:my-two:unloading', 'VM:my-two:unloading');
                              // two = false;
                            }
              Severity: Major
              Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                        return expected;
                Severity: Major
                Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          if (!config.Two_canUnload) return expected;
                  Severity: Major
                  Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            if (!config.One_canUnload) return expected;
                    Severity: Major
                    Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return expected;
                      Severity: Major
                      Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                if (!config.One_canUnload) return expected;
                        Severity: Major
                        Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  if (!config.Two_canUnload) return expected;
                          Severity: Major
                          Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts - About 30 mins to fix

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

                              async function $setup(
                                config?: IRouterOptions,
                                dependencies: any[] = [],
                                routes: IRoute[] = [],
                                stateSpy: NavigationStateSpy = void 0,
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 6 other locations - About 2 days to fix
                            packages/__tests__/src/router/router.fast-switch.spec.ts on lines 41..83
                            packages/__tests__/src/router/router.link-click-navigation.spec.ts on lines 41..78
                            packages/__tests__/src/router/router.redirect.spec.ts on lines 41..78
                            packages/__tests__/src/router/router.title.spec.ts on lines 41..78
                            packages/__tests__/src/router/router.viewport-scope.spec.ts on lines 41..78
                            packages/__tests__/src/router/router.with-configuration.spec.ts on lines 41..78

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

                            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

                                  const One = CustomElement.define({ name: 'my-one', template: '!my-one!<au-viewport></au-viewport>', dependencies: [Hooks] },
                                    class {
                                      public name = 'my-one';
                                      public canLoad() { calledHooks.push(`VM:${this.name}:canLoad`); /* return config.One_canLoad; */ return new Promise((res) => { setTimeout(() => res(config.One_canLoad), 100); }); }
                                      public loading() { calledHooks.push(`VM:${this.name}:loading`); return new Promise((res) => { setTimeout(() => res(void 0), 50); }); }
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 1 day to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 306..314

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

                            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

                                  const Two = CustomElement.define({ name: 'my-two', template: '!my-two!', dependencies: [Hooks] },
                                    class {
                                      public name = 'my-two';
                                      public canLoad() { calledHooks.push(`VM:${this.name}:canLoad`); /* return config.Two_canLoad; */ return new Promise((res) => { setTimeout(() => res(config.Two_canLoad), 100); }); }
                                      public loading() { calledHooks.push(`VM:${this.name}:loading`); return new Promise((res) => { setTimeout(() => res(void 0), 50); }); }
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 1 day to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 296..304

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

                            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

                                const configs = [
                                  { Hooks_canLoad: true, Hooks_canUnload: true, One_canLoad: true, One_canUnload: true, Two_canLoad: true, Two_canUnload: true },
                                  { Hooks_canLoad: false, Hooks_canUnload: true, One_canLoad: true, One_canUnload: true, Two_canLoad: true, Two_canUnload: true },
                                  { Hooks_canLoad: true, Hooks_canUnload: true, One_canLoad: false, One_canUnload: true, Two_canLoad: true, Two_canUnload: true },
                                  { Hooks_canLoad: true, Hooks_canUnload: true, One_canLoad: true, One_canUnload: true, Two_canLoad: false, Two_canUnload: true },
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 1 day to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 119..127

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

                            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

                                const configs = [
                                  { Hooks_canLoad: true, Hooks_canUnload: true, One_canLoad: true, One_canUnload: true, Two_canLoad: true, Two_canUnload: true },
                                  { Hooks_canLoad: false, Hooks_canUnload: true, One_canLoad: true, One_canUnload: true, Two_canLoad: true, Two_canUnload: true },
                                  { Hooks_canLoad: true, Hooks_canUnload: true, One_canLoad: false, One_canUnload: true, Two_canLoad: true, Two_canUnload: true },
                                  { Hooks_canLoad: true, Hooks_canUnload: true, One_canLoad: true, One_canUnload: true, Two_canLoad: false, Two_canUnload: true },
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 1 day to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 318..326

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

                            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

                                  const One = CustomElement.define({ name: 'my-one', template: '!my-one!<au-viewport></au-viewport>', dependencies: [Hooks] },
                                    class {
                                      name = 'my-one';
                                      canLoad() { calledHooks.push(`VM:${this.name}:canLoad`); return config.One_canLoad; }
                                      loading() { calledHooks.push(`VM:${this.name}:loading`); }
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 1 day to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 107..115

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

                            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

                                  const Two = CustomElement.define({ name: 'my-two', template: '!my-two!', dependencies: [Hooks] },
                                    class {
                                      name = 'my-two';
                                      canLoad() { calledHooks.push(`VM:${this.name}:canLoad`); return config.Two_canLoad; }
                                      loading() { calledHooks.push(`VM:${this.name}:loading`); }
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 1 day to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 98..106

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

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

                              function spyNavigationStates(router: IRouter, spy?: NavigationStateSpy) {
                                let _pushState;
                                let _replaceState;
                                if (spy) {
                                  _pushState = router.viewer.location.pushState;
                            packages/__tests__/src/router/router.fallback.spec.ts on lines 17..33
                            packages/__tests__/src/router/router.fast-switch.spec.ts on lines 17..33
                            packages/__tests__/src/router/router.link-click-navigation.spec.ts on lines 17..33
                            packages/__tests__/src/router/router.redirect.spec.ts on lines 17..33
                            packages/__tests__/src/router/router.spec.ts on lines 17..33
                            packages/__tests__/src/router/router.title.spec.ts on lines 17..33
                            packages/__tests__/src/router/router.viewport-scope.spec.ts on lines 17..33
                            packages/__tests__/src/router/router.with-configuration.spec.ts on lines 17..33

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

                            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

                                  it(`with hook and vm (falses: ${_falses(config)})`, async function () {
                                    const { platform, router, $teardown } = await $setup({}, [Hooks, One, Two]);
                            
                                    const expected = _expected(config);
                            
                            
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 5 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 419..433

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

                            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

                                  it(`with hook and vm (falses: ${_falses(config)})`, async function () {
                                    const { platform, router, $teardown } = await $setup({}, [Hooks, One, Two]);
                            
                                    const expected = _expected(config);
                            
                            
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 5 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 215..229

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

                            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

                                  it(`in parent-child with hook and vm (falses: ${_falses(config)})`, async function () {
                                    const { platform, router, $teardown } = await $setup({}, [Hooks, One, Two]);
                            
                                    await $load('/my-one/my-two', router, platform);
                            
                            
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 5 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 466..477

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

                            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

                                  it(`in parent-child with hook and vm (falses: ${_falses(config)})`, async function () {
                                    const { platform, router, $teardown } = await $setup({}, [Hooks, One, Two]);
                            
                                    await $load('/my-one/my-two', router, platform);
                                    await $load('-', router, platform);
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 5 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 260..272

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

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

                              function getModifiedRouter(container: IContainer) {
                                const router = container.get(IRouter) as IRouter;
                                const mockBrowserHistoryLocation = new MockBrowserHistoryLocation();
                                mockBrowserHistoryLocation.changeCallback = async (ev) => { router.viewer.handlePopStateEvent(ev); };
                                router.viewer.history = mockBrowserHistoryLocation as any;
                            packages/__tests__/src/router/router.fallback.spec.ts on lines 7..14
                            packages/__tests__/src/router/router.fast-switch.spec.ts on lines 7..14
                            packages/__tests__/src/router/router.link-click-navigation.spec.ts on lines 7..14
                            packages/__tests__/src/router/router.redirect.spec.ts on lines 7..14
                            packages/__tests__/src/router/router.spec.ts on lines 7..14
                            packages/__tests__/src/router/router.title.spec.ts on lines 7..14
                            packages/__tests__/src/router/router.viewport-scope.spec.ts on lines 7..14
                            packages/__tests__/src/router/router.with-configuration.spec.ts on lines 7..14

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

                            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

                                function _falses(config: typeof configs[0]) {
                                  const falses = [];
                                  for (const [key, value] of Object.entries(config)) {
                                    if (!value) {
                                      falses.push(key);
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 2 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 129..137

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

                            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

                                function _falses($config: typeof configs[0]) {
                                  const falses = [];
                                  for (const [key, value] of Object.entries($config)) {
                                    if (!value) {
                                      falses.push(key);
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 2 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 328..336

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

                            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

                                    public async canLoad(vm: Vm) { calledHooks.push(`${this.name}:${vm.name}:canLoad`); /* return config.Hooks_canLoad; */ return new Promise((res) => { setTimeout(() => res(config.Hooks_canLoad), 100); }); }
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 2 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 286..286

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

                            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

                                    public async canUnload(vm: Vm) { calledHooks.push(`${this.name}:${vm.name}:canUnload`); /* return config.Hooks_canUnload; */ return new Promise((res) => { setTimeout(() => res(config.Hooks_canUnload), 100); }); }
                            Severity: Major
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 2 hrs to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 284..284

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

                            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

                                    public async loading(vm: Vm) { calledHooks.push(`${this.name}:${vm.name}:loading`); return new Promise((res) => { setTimeout(() => res(void 0), 75); }); }
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 287..287

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

                            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

                                    public async unloading(vm: Vm) { calledHooks.push(`${this.name}:${vm.name}:unloading`); return new Promise((res) => { setTimeout(() => res(void 0), 75); }); }
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 285..285

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

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

                            const $load = async (path: string, router: IRouter, platform: IPlatform) => {
                              await router.load(path);
                              platform.domQueue.flush();
                            };
                            packages/__tests__/src/router/router.fast-switch.spec.ts on lines 196..199
                            packages/__tests__/src/router/router.link-click-navigation.spec.ts on lines 240..243
                            packages/__tests__/src/router/router.local-deps.spec.ts on lines 257..260
                            packages/__tests__/src/router/router.redirect.spec.ts on lines 230..233
                            packages/__tests__/src/router/router.spec.ts on lines 955..958
                            packages/__tests__/src/router/router.title.spec.ts on lines 251..254
                            packages/__tests__/src/router/router.viewport-scope.spec.ts on lines 127..130
                            packages/__tests__/src/router/router.with-configuration.spec.ts on lines 311..314
                            packages/__tests__/src/router/routing-hook.spec.ts on lines 76..79

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

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

                              function unspyNavigationStates(router, _push, _replace) {
                                if (_push) {
                                  router.viewer.location.pushState = _push;
                                  router.viewer.location.replaceState = _replace;
                                }
                            packages/__tests__/src/router/router.fallback.spec.ts on lines 34..39
                            packages/__tests__/src/router/router.fast-switch.spec.ts on lines 34..39
                            packages/__tests__/src/router/router.link-click-navigation.spec.ts on lines 34..39
                            packages/__tests__/src/router/router.redirect.spec.ts on lines 34..39
                            packages/__tests__/src/router/router.spec.ts on lines 34..39
                            packages/__tests__/src/router/router.title.spec.ts on lines 34..39
                            packages/__tests__/src/router/router.viewport-scope.spec.ts on lines 34..39
                            packages/__tests__/src/router/router.with-configuration.spec.ts on lines 34..39
                            packages/__tests__/src/router/routing-hook.spec.ts on lines 70..75

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

                            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

                                    canLoad(vm) { calledHooks.push(`${this.name}:${vm.name}:canLoad`); return config.Hooks_canLoad; }
                            Severity: Minor
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 40 mins to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 94..94

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

                            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

                                    canUnload(vm) { calledHooks.push(`${this.name}:${vm.name}:canUnload`); return config.Hooks_canUnload; }
                            Severity: Minor
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 40 mins to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 92..92

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

                            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

                                        if (config.Hooks_canUnload) {
                                          expected.push('VM:my-two:canUnload');
                                          if (config.Two_canUnload) {
                                            expected.push('Hooks:my-two:unloading', 'VM:my-two:unloading');
                                            // two = false;
                            Severity: Minor
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 35 mins to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 202..208

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

                            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

                                        if ($config.Hooks_canUnload) {
                                          expected.push('VM:my-two:canUnload');
                                          if ($config.Two_canUnload) {
                                            expected.push('Hooks:my-two:unloading', 'VM:my-two:unloading');
                                            // two = false;
                            Severity: Minor
                            Found in packages/__tests__/src/router/router.lifecycle-hooks.spec.ts and 1 other location - About 35 mins to fix
                            packages/__tests__/src/router/router.lifecycle-hooks.spec.ts on lines 405..411

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

                            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