gerich-home/it-depends

View on GitHub

Showing 119 of 119 total issues

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

                    it('should not calculate second time with values ' + otherValuesString, function () {
                        var actualValue = invokeComputed(otherValues);
                        
                        expect(actualValue).to.equal(makeKey(otherValues));
                        expectCounts([values, 1], [otherValues, 1]);
Severity: Major
Found in specs/parametricComputedWithNoDependencies.js and 2 other locations - About 1 hr to fix
specs/parametricComputedWithNoDependencies.js on lines 129..134
specs/parametricComputedWithNoDependencies.js on lines 149..154

Duplicated Code

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

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

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

Tuning

This issue has a mass of 65.

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

        it('should recalculate when requested', function () {
            var actualValue = c();
            
            expect(actualValue).to.equal(4);
            expect(calls.count).to.equal(1);
Severity: Major
Found in specs/realWorldUseCases.js and 4 other locations - About 1 hr to fix
specs/realWorldUseCases.js on lines 35..40
specs/realWorldUseCases.js on lines 53..58
specs/realWorldUseCases.js on lines 129..134
specs/realWorldUseCases.js on lines 151..156

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

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

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

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

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

Refactorings

Further Reading

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

        subscription = computedValue.onChange(function(changed, from, to, args) {
            callsSpy.count++;
            callsSpy.lastChange = { changed: changed, from: from, to: to, args: args };
        });
Severity: Major
Found in specs/computedChangeCallback.js and 1 other location - About 1 hr to fix
specs/bulkChange.js on lines 43..46

Duplicated Code

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

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

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

Tuning

This issue has a mass of 65.

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('should not calculate second time with values ' + valuesString, function () {
                        var actualValue = invokeComputed(values);
                        
                        expect(actualValue).to.equal(makeKey(values));
                        expectCounts([values, 1], [otherValues, 1]);
Severity: Major
Found in specs/parametricComputedWithNoDependencies.js and 2 other locations - About 1 hr to fix
specs/parametricComputedWithNoDependencies.js on lines 129..134
specs/parametricComputedWithNoDependencies.js on lines 156..161

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

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

        it('should recalculate when requested', function () {
            var actualValue = d();
            
            expect(actualValue).to.equal(2);
            expect(calls.count).to.equal(1);
Severity: Major
Found in specs/realWorldUseCases.js and 4 other locations - About 1 hr to fix
specs/realWorldUseCases.js on lines 53..58
specs/realWorldUseCases.js on lines 113..118
specs/realWorldUseCases.js on lines 129..134
specs/realWorldUseCases.js on lines 151..156

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

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

            it('should recalculate once when requested', function () {
                var actualValue = c();
                
                expect(actualValue).to.equal(5);
                expect(calls.count).to.equal(1);
Severity: Major
Found in specs/realWorldUseCases.js and 4 other locations - About 1 hr to fix
specs/realWorldUseCases.js on lines 35..40
specs/realWorldUseCases.js on lines 53..58
specs/realWorldUseCases.js on lines 113..118
specs/realWorldUseCases.js on lines 151..156

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

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

            it('should recalculate once when requested', function () {
                var actualValue = d();
                
                expect(actualValue).to.equal(6);
                expect(calls.count).to.equal(1);
Severity: Major
Found in specs/realWorldUseCases.js and 4 other locations - About 1 hr to fix
specs/realWorldUseCases.js on lines 35..40
specs/realWorldUseCases.js on lines 113..118
specs/realWorldUseCases.js on lines 129..134
specs/realWorldUseCases.js on lines 151..156

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

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

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

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

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

Refactorings

Further Reading

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

        _(expectedKeys)
            .union(actualKeys)
            .forEach(function(key) {
                expect(calls[key] || 0).to.equal(expectedCounts[key] || 0);
            });
Severity: Major
Found in specs/parametricComputedWithValueDependency.js and 1 other location - About 1 hr to fix
specs/parametricComputedWithNoDependencies.js on lines 70..74

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

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

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

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

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

Refactorings

Further Reading

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

        _(expectedKeys)
            .union(actualKeys)
            .forEach(function(key) {
                expect(calls[key] || 0).to.equal(expectedCounts[key] || 0);
            });
Severity: Major
Found in specs/parametricComputedWithNoDependencies.js and 1 other location - About 1 hr to fix
specs/parametricComputedWithValueDependency.js on lines 22..26

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

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

Function exports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(updatesCount, subscribersCount) {
    Benchmark.prototype.args = {
        updatesCount: updatesCount,
        subscribersCount: subscribersCount,
        ko: ko,
Severity: Minor
Found in performance-tests/scenarios/observableWriteWithSubscription.js - About 1 hr to fix

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

    it('should not be triggered when other observable is changed', function () {
        var otherValue = itDepends.value('Jack');
        otherValue.write('James');
        
        expect(calls.count).to.equal(0);
Severity: Major
Found in specs/computedChangeCallback.js and 1 other location - About 1 hr to fix
specs/valueChangeCallback.js on lines 57..62

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

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

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

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

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

Refactorings

Further Reading

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

    it('should not be triggered when other observable is changed', function () {
        var otherValue = itDepends.value('Jack');
        otherValue.write('James');
        
        expect(calls.count).to.equal(0);
Severity: Major
Found in specs/valueChangeCallback.js and 1 other location - About 1 hr to fix
specs/computedChangeCallback.js on lines 73..78

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

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

Function default has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function<T>(initialValue: T): IValue<T> {
    const id = tracking.takeNextObservableId();

    let currentValue = initialValue;
    let subscriptions: ISubscriptions<T>;
Severity: Minor
Found in src/value.ts - About 1 hr to fix

Function subscribe has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        subscribe(handler: IChangeHandler<T>): ISubscription {
            let item: ILinkedListItem = undefined;

            const subscription = {
                disable(): void {
Severity: Minor
Found in src/subscriptionList.ts - About 1 hr to fix

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

                    it('should not calculate second time if value dependency was not changed', function () {
                        var actualValue = invokeComputed(parameters);
                        expect(actualValue).to.equal('Hello, ' + originalValue);
                        expectCalls([parameterName, 1]);
                    });
Severity: Major
Found in specs/parametricComputedWithValueDependency.js and 2 other locations - About 1 hr to fix
specs/parametricComputedWithValueDependency.js on lines 73..77
specs/parametricComputedWithValueDependency.js on lines 110..114

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

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('should not recalculate when requested', function () {
                                var actualValue = invokeComputed(parameters);
                                expect(actualValue).to.equal('Hello, ' + originalValue);
                                expectCalls([parameterName, 1]);
                            });
Severity: Major
Found in specs/parametricComputedWithValueDependency.js and 2 other locations - About 1 hr to fix
specs/parametricComputedWithValueDependency.js on lines 73..77
specs/parametricComputedWithValueDependency.js on lines 84..88

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

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('should calculate when requested', function () {
                    var actualValue = invokeComputed(parameters);
                    expect(actualValue).to.equal('Hello, ' + originalValue);
                    expectCalls([parameterName, 1]);
                });
Severity: Major
Found in specs/parametricComputedWithValueDependency.js and 2 other locations - About 1 hr to fix
specs/parametricComputedWithValueDependency.js on lines 84..88
specs/parametricComputedWithValueDependency.js on lines 110..114

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

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

Function default has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function(changeAction: () => void): void {
    const isFirstBulk = bulkLevels === 0;

    if (isFirstBulk) {
        changes = [];
Severity: Minor
Found in src/bulkChange.ts - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

                        it('should not calculate second time if value dependency was not changed', function () {
                            var actualValue = invokeComputed(parameters);
                            expect(actualValue).to.equal('Hello, Jack');
                            expectCalls([parameterName, 1]);
                        });
Severity: Major
Found in specs/parametricComputedWithValueDependency.js and 2 other locations - About 55 mins to fix
specs/parametricComputedWithValueDependency.js on lines 99..103
specs/parametricComputedWithValueDependency.js on lines 128..132

Duplicated Code

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

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

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

Tuning

This issue has a mass of 53.

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('should recalculate when requested', function () {
                            var actualValue = invokeComputed(parameters);
                            expect(actualValue).to.equal('Hello, Jack');
                            expectCalls([parameterName, 2]);
                        });
Severity: Major
Found in specs/parametricComputedWithValueDependency.js and 2 other locations - About 55 mins to fix
specs/parametricComputedWithValueDependency.js on lines 128..132
specs/parametricComputedWithValueDependency.js on lines 139..143

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

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

Severity
Category
Status
Source
Language