aurelia/aurelia

View on GitHub
packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

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

import {
  DefaultLogger, IContainer, ILogEvent, ISink, kebabCase, LoggerConfiguration, LogLevel
} from '@aurelia/kernel';
import {
  BindingMode,

    Function from has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      public static from(def: CustomAttributeDefinition | null, alias: string): AttrInfo | null {
        if (def === null) {
          return null;
        }
        let rec = attrInfoLookup.get(def);

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getLocalTemplateTestData has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function* getLocalTemplateTestData() {
          yield new LocalTemplateTestData(
            `<template as-custom-element="foo-bar">static</template>
            <foo-bar></foo-bar>`,
            new Map([['foo-bar', new ElementInfo('foo-bar', void 0, false)]]),

      Function from has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        public static from(def: CustomElementDefinition | null, alias: string): ElementInfo | null {
          if (def === null) {
            return null;
          }
          let rec = elementInfoLookup.get(def);

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function from has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public static from(def: CustomAttributeDefinition | null, alias: string): AttrInfo | null {
          if (def === null) {
            return null;
          }
          let rec = attrInfoLookup.get(def);

        Function from has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public static from(def: CustomElementDefinition | null, alias: string): ElementInfo | null {
            if (def === null) {
              return null;
            }
            let rec = elementInfoLookup.get(def);

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

          class AttrInfo {
            /**
             * A lookup of the bindables of this attribute, indexed by the (pre-processed)
             * bindable names as they would be found in the attribute value.
             *
          packages/__tests__/src/3-runtime-html/template-compiler.spec.ts on lines 679..758

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

          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

          class ElementInfo {
            /**
             * A lookup of the bindables of this element, indexed by the (pre-processed)
             * attribute names as they would be found in parsed markup.
             */
          packages/__tests__/src/3-runtime-html/template-compiler.spec.ts on lines 616..671

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

          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('works with non-global dependencies - template-controllers - if', async function () {
              @customElement({ name: 'my-ce', template: 'my-ce-content' })
              class MyCe { }
          
              const template = `
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 590..618
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 650..679

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

          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('works with non-global dependencies - nested-template-controllers - [repeat.for]>[if]', async function () {
              @customElement({ name: 'my-ce', template: 'my-ce-content' })
              class MyCe { }
          
              const template = `
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 590..618
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 620..648

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

          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('works with non-global dependencies in owning template', async function () {
              @customElement({ name: 'my-ce', template: 'my-ce-content' })
              class MyCe { }
          
              const template = `
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 620..648
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 650..679

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

          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('works with nested templates - 2', async function () {
              const template = `
                <template as-custom-element="el-one">
                  <template as-custom-element="one-two">
                    1
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 470..492
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 494..515

          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('works with for', async function () {
              const template = `<template as-custom-element="foo-bar">
                <bindable name='prop'></bindable>
                \${prop}
               </template>
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 470..492
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 554..588

          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('works with if', async function () {
              const template = `<template as-custom-element="foo-bar">
                <bindable name='prop'></bindable>
                \${prop}
               </template>
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 494..515
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 554..588

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

              it('throws error if a local template is not under root', function () {
                const template = `<div><template as-custom-element="foo-bar">Can I hide here?</template></div>`;
                const { container, sut } = $$createFixture();
                assert.throws(() => sut.compile({ name: 'lorem-ipsum', template }, container), 'Local templates needs to be defined directly under root.');
              });
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

              it('throws error if a local template does not have name', function () {
                const template = `<template as-custom-element="">foo-bar</template><div></div>`;
                const { container, sut } = $$createFixture();
                assert.throws(() => sut.compile({ name: 'lorem-ipsum', template }, container), 'The value of "as-custom-element" attribute cannot be empty for local template');
              });
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

              it('throws error if bindable is not under root', function () {
                const template = `<template as-custom-element="foo-bar">
                  <div>
                    <bindable name="prop"></bindable>
                  </div>
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

              it('throws error if duplicate bindable attributes are found', function () {
                const template = `<template as-custom-element="foo-bar">
                  <bindable name="prop1" attribute="bar"></bindable>
                  <bindable name="prop2" attribute="bar"></bindable>
                </template>
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417

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

          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

              it('throws error if the custom element has only local templates', function () {
                const template = `
                <template as-custom-element="foo-bar">Does this work?</template>
                <template as-custom-element="fiz-baz">Of course not!</template>
                `;
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

              it('throws error if duplicate bindable properties are found', function () {
                const template = `<template as-custom-element="foo-bar">
                  <bindable name="prop" attribute="bar"></bindable>
                  <bindable name="prop" attribute="baz"></bindable>
                </template>
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

              it('throws error if a duplicate local templates are found', function () {
                const template = `<template as-custom-element="foo-bar">foo-bar1</template><template as-custom-element="foo-bar">foo-bar2</template><div></div>`;
                const { container, sut } = $$createFixture();
                assert.throws(() => sut.compile({ name: 'lorem-ipsum', template }, container), 'Duplicate definition of the local template named foo-bar');
              });
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

              it('throws error if bindable property is missing', function () {
                const template = `<template as-custom-element="foo-bar">
                  <bindable attribute="prop"></bindable>
                </template>
                <div></div>`;
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 353..357
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

              it('throws error if a root template is a local template', function () {
                const template = `<template as-custom-element="foo-bar">I have local root!</template>`;
                const { container, sut } = $$createFixture();
                assert.throws(() => sut.compile({ name: 'lorem-ipsum', template }, container), 'The root cannot be a local template itself.');
              });
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 359..366
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 368..372
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 374..378
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 380..384
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 386..395
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 397..404
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 406..417
          packages/__tests__/src/3-runtime-html/template-compiler.local-templates.spec.ts on lines 419..430

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

          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

          class EventLog implements ISink {
            public readonly log: ILogEvent[] = [];
            public handleEvent(event: ILogEvent): void {
              this.log.push(event);
            }
          packages/__tests__/src/validation-html/validation-controller.spec.ts on lines 174..179
          packages/__tests__/src/validation/rule-provider.spec.ts on lines 559..564

          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

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

          export function createAttribute(name: string, value: string): Attr {
            const attr = document.createAttribute(name);
            attr.value = value;
            return attr;
          }
          packages/__tests__/src/3-runtime-html/template-compiler.au-slot.spec.ts on lines 21..25

          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

          There are no issues that match your filters.

          Category
          Status