Microsoft/fast-dna

View on GitHub
packages/web-components/fast-element/src/di/di.spec.ts

Summary

Maintainability
F
6 days
Test Coverage

File di.spec.ts has 736 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    Container,
    ContainerImpl,
    DI,
    FactoryImpl,
Severity: Major
Found in packages/web-components/fast-element/src/di/di.spec.ts - About 1 day to fix

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

        it(`singleton() returns the correct resolver`, function () {
            class Foo {}
            const actual = Registration.singleton("key", Foo);
            expect(actual["key"]).eq("key", `actual['key']`);
            expect(actual["strategy"]).eq(ResolverStrategy.singleton, `actual['strategy']`);
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 4 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 842..848

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 119.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        it(`transient() returns the correct resolver`, function () {
            class Foo {}
            const actual = Registration.transient("key", Foo);
            expect(actual["key"]).eq("key", `actual['key']`);
            expect(actual["strategy"]).eq(ResolverStrategy.transient, `actual['strategy']`);
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 4 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 834..840

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 119.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        describe(`getResolver()`, function () {
            for (const key of [null, undefined]) {
                it(`throws on invalid key ${key}`, function () {
                    const { sut } = createFixture();
                    expect(() => sut.getResolver(key as any, null as any)).throws();
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 3 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 751..758

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 106.

    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

        describe(`registerTransformer()`, function () {
            for (const key of [null, undefined]) {
                it(`throws on invalid key ${key}`, function () {
                    const { sut } = createFixture();
                    expect(() => sut.registerTransformer(key as any, null as any)).throws();
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 3 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 760..767

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

    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(`returns a new singleton Factory if it does not exist`, function () {
                class Foo {}
                const sut = new ResolverImpl(Foo, ResolverStrategy.singleton, Foo);
                const actual = sut.getFactory(container)!;
                expect(actual).instanceOf(FactoryImpl, `actual`);
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 3 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 461..467

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

    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(`returns a new transient Factory if it does not exist`, function () {
                class Foo {}
                const sut = new ResolverImpl(Foo, ResolverStrategy.transient, Foo);
                const actual = sut.getFactory(container)!;
                expect(actual).instanceOf(FactoryImpl, `actual`);
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 3 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 453..459

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

    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

        describe(`get()`, function () {
            for (const key of [null, undefined]) {
                it(`throws on invalid key ${key}`, function () {
                    const { sut } = createFixture();
                    expect(() => sut.get(key as any)).throws();
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 3 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 799..806

    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

        describe(`getAll()`, function () {
            for (const key of [null, undefined]) {
                it(`throws on invalid key ${key}`, function () {
                    const { sut } = createFixture();
                    expect(() => sut.getAll(key as any)).throws();
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 1 other location - About 3 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 790..797

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

            it(`returns a null for callback strategy`, function () {
                class Foo {}
                const sut = new ResolverImpl(Foo, ResolverStrategy.callback, Foo);
                const actual = sut.getFactory(container);
                expect(actual).eq(null, `actual`);
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 2 other locations - About 2 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 469..474
    packages/web-components/fast-element/src/di/di.spec.ts on lines 476..481

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

            it(`returns a null for array strategy`, function () {
                class Foo {}
                const sut = new ResolverImpl(Foo, ResolverStrategy.array, Foo);
                const actual = sut.getFactory(container);
                expect(actual).eq(null, `actual`);
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 2 other locations - About 2 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 469..474
    packages/web-components/fast-element/src/di/di.spec.ts on lines 491..496

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

            it(`returns a null for instance strategy`, function () {
                class Foo {}
                const sut = new ResolverImpl(Foo, ResolverStrategy.instance, Foo);
                const actual = sut.getFactory(container);
                expect(actual).eq(null, `actual`);
    Severity: Major
    Found in packages/web-components/fast-element/src/di/di.spec.ts and 2 other locations - About 2 hrs to fix
    packages/web-components/fast-element/src/di/di.spec.ts on lines 476..481
    packages/web-components/fast-element/src/di/di.spec.ts on lines 491..496

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status