aurelia/aurelia

View on GitHub
packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

File preprocess-resource.spec.ts has 725 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as path from 'path';
import { preprocessResource, preprocessOptions } from '@aurelia/plugin-conventions';
import { assert } from '@aurelia/testing';

describe('preprocessResource', function () {

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

      it('injects customElement decorator with index file', function () {
        const code = `\nexport class FooBar {}\n`;
        const expected = `import { CustomElement } from '@aurelia/runtime-html';
    import * as __au2ViewDef from './index.html';
    
    
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 860..877

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

    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('injects customElement decorator for loosely equal class name with index file', function () {
        const code = `export class UAFooBarCustomElement {}\n`;
        const expected = `import { CustomElement } from '@aurelia/runtime-html';
    import * as __au2ViewDef from './index.html';
    export class UAFooBarCustomElement {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 840..858

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

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

      it('injects customElement decorator with existing runtime import', function () {
        const code = `import { containerless } from '@aurelia/runtime-html';
    
    const A = 0;
    @containerless()
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('skips existing bindingCommand decorator', function () {
        const code = `import { bindingCommand } from '@aurelia/runtime-html';
    @bindingCommand('lorem')
    export class FooBarBindingCommand {}
    `;
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects customElement decorator for loosely equal class name', function () {
        const code = `export class UAFooBarCustomElement {}\n`;
        const expected = `import { CustomElement } from '@aurelia/runtime-html';
    import * as __au2ViewDef from './ua-foo-bar.html';
    export class UAFooBarCustomElement {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('skips existing templateController decorator', function () {
        const code = `import { templateController } from '@aurelia/runtime-html';
    @templateController('some-thing')
    export class FooBarCustomAttribute {}
    `;
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('skips existing bindingBehavior decorator', function () {
        const code = `import { bindingBehavior } from 'aurelia';
    @bindingBehavior('fooBar')
    export class FooBar {}
    `;
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('merges CustomElement.define', function () {
        const code = `import { CustomElement } from '@aurelia/runtime-html'
    export class FooBar {}
    CustomElement.define({ name: 'lorem', bindables: ['value'] }, FooBar);
    `;
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('makes sure implicit custom element is after in-file dependencies', function () {
        const code = `export class FooBar {}
    
    export class SomeValueConverter {
      toView(value: string): string {
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects bindingBehavior decorator for non-kebab case file name', function () {
        const code = `export class FooBarBindingBehavior {}\n`;
        const expected = `import { BindingBehavior } from '@aurelia/runtime-html';
    export class FooBarBindingBehavior {}
    BindingBehavior.define('fooBar', FooBarBindingBehavior);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects various decorators when there is no implicit custom element', function () {
        const code = `import {Foo} from './foo.js';
    import Aurelia, { valueConverter } from 'aurelia';
    
    export class LeaveMeAlone {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects customElement decorator', function () {
        const code = `\nexport class FooBar {}\n`;
        const expected = `import { CustomElement } from '@aurelia/runtime-html';
    import * as __au2ViewDef from './foo-bar.html';
    
    
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects customElement decorator for non-kebab case file name', function () {
        const code = `export class FooBar {}\n`;
        const expected = `import { CustomElement } from '@aurelia/runtime-html';
    import * as __au2ViewDef from './FooBar.html';
    export class FooBar {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('does not inject customElement decorator for decorated resource', function () {
        const code = `import { customElement } from '@aurelia/runtime-html';
    import * as lorem from './lorem.html';
    
    @customElement(lorem)
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects valueConverter decorator for non-kebab case file name', function () {
        const code = `export class FooBarValueConverter {}\n`;
        const expected = `import { ValueConverter } from '@aurelia/runtime-html';
    export class FooBarValueConverter {}
    ValueConverter.define('fooBar', FooBarValueConverter);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('skips existing valueConverter decorator', function () {
        const code = `import { valueConverter } from '@aurelia/runtime-html';
    @valueConverter('fooBar')
    export class FooBar {}
    `;
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects various decorators when there is implicit custom element', function () {
        const code = `import {Foo} from './foo.js';
    import { templateController, other } from '@aurelia/runtime-html';
    
    export class LeaveMeAlone {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects new decorator before existing decorator', function () {
        const code = `import { something } from '@aurelia/runtime-html';
    @something
    export class FooBar {}
    
    
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798

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

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

      it('supports customized name in customElement decorator when there is html file pair', function () {
        const code = `import { customElement } from '@aurelia/runtime-html';
    
    @customElement('lorem')
    export class FooBar {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects bindingCommand decorator for non-kebab case file name', function () {
        const code = `export class FooBarBindingCommand {}\n`;
        const expected = `import { BindingCommand } from '@aurelia/runtime-html';
    export class FooBarBindingCommand {}
    BindingCommand.define('foo-bar', FooBarBindingCommand);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects various decorators when there is implicit custom element with customized name', function () {
        const code = `import {Foo} from './foo.js';
    import { templateController, customElement, other } from '@aurelia/runtime-html';
    
    export class LeaveMeAlone {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects templateController decorator for non-kebab case file name', function () {
        const code = `export class FooBarTemplateController {}\n`;
        const expected =  `import { CustomAttribute } from '@aurelia/runtime-html';
    export class FooBarTemplateController {}
    CustomAttribute.define({ name: 'foo-bar', isTemplateController: true }, FooBarTemplateController);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('injects customAttribute decorator for non-kebab case file name', function () {
        const code = `export class FooBarCustomAttribute {}\n`;
        const expected = `import { CustomAttribute } from '@aurelia/runtime-html';
    export class FooBarCustomAttribute {}
    CustomAttribute.define('foo-bar', FooBarCustomAttribute);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('skips existing customAttribute decorator', function () {
        const code = `import { customAttribute } from 'aurelia';
    @customAttribute('some-thing')
    export class FooBar {}
    `;
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 487..512
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

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

      it('merges $au - custom element', function () {
        const code = `
    export class FooBar {
      static $au = { type: 'custom-element', name: 'foo-bar', bindables: ['x'] };
      x: string;
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 31..49
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 51..68
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 70..87
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 89..118
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 120..142
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 144..167
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 207..223
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 225..243
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 262..278
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 280..298
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 317..333
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 335..353
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 372..388
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 390..408
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 427..443
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 445..463
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 465..485
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 517..596
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 598..679
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 681..763
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 765..798
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 800..838

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

    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

      it('ignores customized name in customElement decorator when there is no html file pair. This default behaviour is like @noView in Aurelia 1.', function () {
        const code = `import { customElement } from '@aurelia/runtime-html';
    
    @customElement('lorem')
    export class FooBar {}
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 190..205
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 245..260
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 300..315
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 355..370
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 410..425

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

    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

      it('injects bindingBehavior decorator', function () {
        const code = `export class FooBarBindingBehavior {}\n`;
        const expected = `import { BindingBehavior } from '@aurelia/runtime-html';
    export class FooBarBindingBehavior {}
    BindingBehavior.define('fooBar', FooBarBindingBehavior);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 169..188
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 190..205
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 245..260
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 300..315
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 410..425

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

    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

      it('injects bindingCommand decorator', function () {
        const code = `export class FooBarBindingCommand {}\n`;
        const expected = `import { BindingCommand } from '@aurelia/runtime-html';
    export class FooBarBindingCommand {}
    BindingCommand.define('foo-bar', FooBarBindingCommand);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 169..188
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 190..205
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 245..260
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 300..315
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 355..370

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

    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

      it('injects customAttribute decorator', function () {
        const code = `export class FooBarCustomAttribute {}\n`;
        const expected = `import { CustomAttribute } from '@aurelia/runtime-html';
    export class FooBarCustomAttribute {}
    CustomAttribute.define('foo-bar', FooBarCustomAttribute);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 169..188
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 245..260
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 300..315
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 355..370
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 410..425

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

    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

      it('injects valueConverter decorator', function () {
        const code = `export class FooBarValueConverter {}\n`;
        const expected = `import { ValueConverter } from '@aurelia/runtime-html';
    export class FooBarValueConverter {}
    ValueConverter.define('fooBar', FooBarValueConverter);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 169..188
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 190..205
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 245..260
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 355..370
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 410..425

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

    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

      it('injects templateController decorator', function () {
        const code = `export class FooBarTemplateController {}\n`;
        const expected = `import { CustomAttribute } from '@aurelia/runtime-html';
    export class FooBarTemplateController {}
    CustomAttribute.define({ name: 'foo-bar', isTemplateController: true }, FooBarTemplateController);
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 169..188
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 190..205
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 300..315
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 355..370
    packages-tooling/__tests__/src/plugin-conventions/preprocess-resource.spec.ts on lines 410..425

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

    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