aurelia/aurelia

View on GitHub
packages/__tests__/src/3-runtime-html/portal.spec.tsx

Summary

Maintainability
F
6 days
Test Coverage

File portal.spec.tsx has 498 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @typescript-eslint/no-unused-expressions */
import { Constructable, IRegistry } from '@aurelia/kernel';
import { CustomElement, Aurelia } from '@aurelia/runtime-html';
import {
  assert,
Severity: Minor
Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx - About 7 hrs to fix

    Function assertionFn has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            assertionFn: (ctx, _host, comp: IPortalTestRootVm & { target: any; divdiv: HTMLDivElement }) => {
              assert.equal(
                childrenQuerySelector(comp.localDiv, '.divdiv'),
                null,
                'comp.localDiv should not have contained .divdiv (1)'
    Severity: Minor
    Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx - About 1 hr to fix

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

                {
                  name: 'app',
                  template: <template>
                    <div ref='divdiv' portal='target.bind: target; render-context.bind: renderContext' class='divdiv'>{'${message}'}</div>
                    <div ref='localDiv'></div>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 1 day to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 368..384

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

      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

                {
                  name: 'app',
                  template: <template>
                    <div ref='divdiv' portal='target.bind: target; render-context: #mock-render-context' class='divdiv'>{'${message}'}</div>
                    <div ref='localDiv'></div>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 1 day to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 408..424

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

      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('moves view when position change beforeend -> afterend', function () {
          const { component, assertHtml } = createFixture(
            <>
              <div id="d1">hello</div>
              <button portal="target: #d1; position.bind: position">click me</button>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 3 hrs to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 66..76

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

      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('moves view when position change afterend -> beforebegin', function () {
          const { component, assertHtml } = createFixture(
            <>
              <div id="d1">hello</div>
              <button portal="target: #d1; position.bind: position">click me</button>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 3 hrs to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 54..64

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

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

        it('portals to "afterbegin" position', function () {
          const { assertHtml } = createFixture(
            <>
              <div id="d1">hello</div>
              <button portal="target: #d1; position: afterbegin">click me</button>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 3 other locations - About 2 hrs to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 14..22
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 34..42
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 44..52

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

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

        it('portals to "beforeend" position', function () {
          const { assertHtml } = createFixture(
            <>
              <div id="d1">hello</div>
              <button portal="target: #d1; position: beforeend">click me</button>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 3 other locations - About 2 hrs to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 14..22
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 24..32
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 44..52

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

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

        it('portals to "afterend" position', function () {
          const { assertHtml } = createFixture(
            <>
              <div id="d1">hello</div>
              <button portal="target: #d1; position: afterend">click me</button>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 3 other locations - About 2 hrs to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 14..22
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 24..32
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 34..42

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

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

        it('portals to "beforebegin" position 🚪-🔁-🚪', function () {
          const { assertHtml } = createFixture(
            <>
              <div id="d1">hello</div>
              <button portal="target: #d1; position: beforebegin">click me</button>
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 3 other locations - About 2 hrs to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 24..32
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 34..42
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 44..52

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

      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

              assertionFn: (ctx, host, _comp) => {
      
                assert.equal(host.childElementCount, 0, 'It should have been empty.');
                assert.notEqual(
                  childrenQuerySelector(ctx.doc.body, 'c-e'),
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 1 hr to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 109..116

      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

              assertionFn: (ctx, host, _component) => {
                assert.equal(host.childElementCount, 0, 'It should have been empty.');
                assert.notEqual(
                  childrenQuerySelector(ctx.doc.body, '.portaled'),
                  null,
      Severity: Major
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 1 hr to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 138..146

      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

                {
                  name: 'app',
                  template: <template><div portal repeat$for='item of items' class='divdiv'>{'${message}'}</div></template>
                },
      Severity: Minor
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 40 mins to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 151..154

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

      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

                {
                  name: 'app',
                  template: <template><div portal if$='showCe' class='divdiv'>{'${message}'}</div></template>
                },
      Severity: Minor
      Found in packages/__tests__/src/3-runtime-html/portal.spec.tsx and 1 other location - About 40 mins to fix
      packages/__tests__/src/3-runtime-html/portal.spec.tsx on lines 205..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 49.

      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