aurelia/aurelia

View on GitHub
packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

Function testFn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        async function testFn(fn: (ctx: $ctx) => Promise<void>) {
          const ctx = TestContext.create();
          const au = new Aurelia(ctx.container);
          const host = ctx.createElement("div");

Severity: Minor
Found in packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts - About 1 hr to fix

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

            async function testFn(fn: (ctx: $ctx) => Promise<void>) {
              const ctx = TestContext.create();
              const au = new Aurelia(ctx.container);
              const host = ctx.createElement("div");
    
    
    packages/__tests__/src/3-runtime-html/repeat.keyed.set.spec.ts on lines 53..85

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

    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

    function create$it<K extends any[], T extends (...args: K) => unknown>(testFn: T) {
      function $it(title: string, fn: (ctx: K[0]) => Promise<void>) {
        it(title, async function () { await testFn.bind(this)(fn); });
      }
      $it.only = function (title: string, fn: (ctx: K[0]) => Promise<void>) {
    packages/__tests__/src/3-runtime-html/repeat.keyed.array.spec.ts on lines 1123..1137
    packages/__tests__/src/3-runtime-html/repeat.keyed.set.spec.ts on lines 261..275

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

    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('replace 3 interleaved items', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[0, $(0)], [1, $(1)], [2, $(2)], [3, $(3)], [4, $(4)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '01234');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 209..223
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 225..239

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

    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('replace last 3 items', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[0, $(0)], [1, $(1)], [2, $(2)], [3, $(3)], [4, $(4)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '01234');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 209..223
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 241..255

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

    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('replace first 3 items', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[0, $(0)], [1, $(1)], [2, $(2)], [3, $(3)], [4, $(4)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '01234');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 225..239
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 241..255

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

    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('remove last 3 items', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[0, $(0)], [1, $(1)], [2, $(2)], [3, $(3)], [4, $(4)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '01234');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 164..177
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 194..207

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

    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('2 initial items, 3 additions interleaved', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[1, $(1)], [3, $(3)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '13');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 104..117
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 119..132

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

    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('2 initial items, 3 additions at end', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[0, $(0)], [1, $(1)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '01');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 119..132
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 134..147

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

    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('2 initial items, 3 additions at start', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[3, $(3)], [4, $(4)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '34');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 104..117
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 134..147

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

    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('remove first 3 items', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[0, $(0)], [1, $(1)], [2, $(2)], [3, $(3)], [4, $(4)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '01234');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 179..192
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 194..207

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

    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('remove 3 interleaved items', async function ({ au, host, mutations, mutate, component }) {
                component.items = new Map([[0, $(0)], [1, $(1)], [2, $(2)], [3, $(3)], [4, $(4)]]);
    
                await au.start();
                assert.strictEqual(host.textContent, '01234');
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 164..177
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 179..192

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

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

      function assertAdd(start: number, mutations: MutationRecord[], ...textContents: unknown[]) {
        const end = start + textContents.length - 1;
        for (let i = start; i <= end; ++i) {
          const mutation = mutations[i];
          const textContent = textContents[i - start];
    packages/__tests__/src/3-runtime-html/repeat.keyed.array.spec.ts on lines 16..24
    packages/__tests__/src/3-runtime-html/repeat.keyed.array.spec.ts on lines 26..34
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 24..32
    packages/__tests__/src/3-runtime-html/repeat.keyed.set.spec.ts on lines 14..22
    packages/__tests__/src/3-runtime-html/repeat.keyed.set.spec.ts on lines 24..32

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

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

      function assertRem(start: number, mutations: MutationRecord[], ...textContents: unknown[]) {
        const end = start + textContents.length - 1;
        for (let i = start; i <= end; ++i) {
          const mutation = mutations[i];
          const textContent = textContents[i - start];
    packages/__tests__/src/3-runtime-html/repeat.keyed.array.spec.ts on lines 16..24
    packages/__tests__/src/3-runtime-html/repeat.keyed.array.spec.ts on lines 26..34
    packages/__tests__/src/3-runtime-html/repeat.keyed.map.spec.ts on lines 14..22
    packages/__tests__/src/3-runtime-html/repeat.keyed.set.spec.ts on lines 14..22
    packages/__tests__/src/3-runtime-html/repeat.keyed.set.spec.ts on lines 24..32

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

    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

        type $ctx = {
          au: Aurelia;
          host: HTMLElement;
          mutations: MutationRecord[];
          mutate: (cb: () => void) => Promise<void>;
    packages/__tests__/src/3-runtime-html/repeat.keyed.array.spec.ts on lines 43..49
    packages/__tests__/src/3-runtime-html/repeat.keyed.set.spec.ts on lines 40..46

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

    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