gerich-home/it-depends

View on GitHub

Showing 119 of 119 total issues

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

export default function<T>(calculator: ICalculator<T>, args: any[], writeCallback?: IWriteCallback<T>): IComputed<T> {
    let currentValue: T;
    let oldValue: T;

    let dependencies: IDependency[];
Severity: Major
Found in src/computed.ts - About 4 hrs to fix

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

    suite.add('itDepends', function() {
        var subscriptions = [];
        
        for (var i = 0; i < subscribersCount; i++) {
            subscriptions.push(idcomputed.onChange(_noop()));
Severity: Major
Found in performance-tests/scenarios/computedSubscription.js and 3 other locations - About 4 hrs to fix
performance-tests/scenarios/computedSubscription.js on lines 31..43
performance-tests/scenarios/observableSubscription.js on lines 29..41
performance-tests/scenarios/observableSubscription.js on lines 43..55

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

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

    suite.add('itDepends', function() {
        var subscriptions = [];
        
        for (var i = 0; i < subscribersCount; i++) {
            subscriptions.push(idobservable.onChange(_noop()));
Severity: Major
Found in performance-tests/scenarios/observableSubscription.js and 3 other locations - About 4 hrs to fix
performance-tests/scenarios/computedSubscription.js on lines 31..43
performance-tests/scenarios/computedSubscription.js on lines 45..57
performance-tests/scenarios/observableSubscription.js on lines 29..41

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

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

    suite.add('knockout', function() {
        var subscriptions = [];
        
        for (var i = 0; i < subscribersCount; i++) {
            subscriptions.push(koobservable.subscribe(_noop()));
Severity: Major
Found in performance-tests/scenarios/observableSubscription.js and 3 other locations - About 4 hrs to fix
performance-tests/scenarios/computedSubscription.js on lines 31..43
performance-tests/scenarios/computedSubscription.js on lines 45..57
performance-tests/scenarios/observableSubscription.js on lines 43..55

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

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

    suite.add('knockout', function() {
        var subscriptions = [];
        
        for (var i = 0; i < subscribersCount; i++) {
            subscriptions.push(kocomputed.subscribe(_noop()));
Severity: Major
Found in performance-tests/scenarios/computedSubscription.js and 3 other locations - About 4 hrs to fix
performance-tests/scenarios/computedSubscription.js on lines 45..57
performance-tests/scenarios/observableSubscription.js on lines 29..41
performance-tests/scenarios/observableSubscription.js on lines 43..55

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

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 describeUsageSyntax has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var describeUsageSyntax = function(invokeComputed) {
        var describeCalledWithParameters = function(expectCalls, parameterValue, parameterName) {
            var parameters = [parameterValue];
            var observableValue;
            var originalValue;
Severity: Major
Found in specs/parametricComputedWithValueDependency.js - About 3 hrs to fix

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

    var expectLastChanges = function(expected) {
        expect(calls.lastChange.changed).to.equal(expected.changed);
        expect(calls.lastChange.from).to.equal(expected.from);
        expect(calls.lastChange.to).to.equal(expected.to);
    };
Severity: Major
Found in specs/generalChangeCallback.js and 1 other location - About 3 hrs to fix
specs/valueChangeCallback.js on lines 9..13

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

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

    var expectLastChanges = function(expected) {
        expect(calls.lastChange.changed).to.equal(expected.changed);
        expect(calls.lastChange.from).to.equal(expected.from);
        expect(calls.lastChange.to).to.equal(expected.to);
    };
Severity: Major
Found in specs/valueChangeCallback.js and 1 other location - About 3 hrs to fix
specs/generalChangeCallback.js on lines 9..13

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

    beforeEach(function() {
        var callsSpy = { count: 0 };
        calls = callsSpy;

        observableValue = itDepends.value('Bob');
Severity: Major
Found in specs/generalChangeCallback.js and 1 other location - About 3 hrs to fix
specs/valueChangeCallback.js on lines 15..25

Duplicated Code

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

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

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

Tuning

This issue has a mass of 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

    beforeEach(function() {
        var callsSpy = { count: 0 };
        calls = callsSpy;

        observableValue = itDepends.value('Bob');
Severity: Major
Found in specs/valueChangeCallback.js and 1 other location - About 3 hrs to fix
specs/generalChangeCallback.js on lines 16..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 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

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

module.exports = function(updatesCount, dependenciesCount) {
    Benchmark.prototype.args = {
        updatesCount: updatesCount,
        dependenciesCount: dependenciesCount,
        ko: ko,
Severity: Major
Found in performance-tests/scenarios/computedDiamondUpdate.js - About 3 hrs to fix

Function exports has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(updatesCount, dependenciesCount) {
    Benchmark.prototype.args = {
        updatesCount: updatesCount,
        dependenciesCount: dependenciesCount,
        ko: ko,
Severity: Minor
Found in performance-tests/scenarios/computedDiamondUpdate.js - About 3 hrs 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

Function describeCalledWithParameters has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var describeCalledWithParameters = function(parameterValue, parameterName) {
        var parameters = [parameterValue];
        var observableValue;
        var originalValue;
        var computedValueWithArgs;
Severity: Major
Found in specs/parametricComputedChangeCallback.js - About 3 hrs to fix

Function describeCalledWithParameters has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        var describeCalledWithParameters = function(expectCalls, parameterValue, parameterName) {
            var parameters = [parameterValue];
            var observableValue;
            var originalValue;
            
Severity: Major
Found in specs/parametricComputedWithValueDependency.js - About 2 hrs to fix

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

        for(var i = 0; i < arguments.length; i++) {
            var arg = arguments[i];
            var key = arg[0];
            expect(expectedCounts).to.not.include.keys(key);
            expectedCounts[key] = arg[1];
Severity: Major
Found in specs/parametricComputedWithValueDependency.js and 1 other location - About 2 hrs to fix
specs/parametricComputedChangeCallback.js on lines 30..35

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

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

        for(var i = 0; i < arguments.length; i++) {
            var arg = arguments[i];
            var key = arg[0];
            expect(expectedCounts).to.not.include.keys(key);
            expectedCounts[key] = arg[1];
Severity: Major
Found in specs/parametricComputedChangeCallback.js and 1 other location - About 2 hrs to fix
specs/parametricComputedWithValueDependency.js on lines 12..17

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

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('should calculate when passing trailing undefined values', function () {
                var extendedValues = _(values).concat([undefined, undefined]).value();
                var actualValue = invokeComputed(extendedValues);
                
                expect(actualValue).to.equal(makeKey(values));
Severity: Major
Found in specs/parametricComputedWithNoDependencies.js and 1 other location - About 2 hrs to fix
specs/parametricComputedWithNoDependencies.js on lines 136..142

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

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('should not calculate when passing trailing undefined values', function () {
                    var extendedValues = _(values).concat([undefined, undefined]).value();
                    var actualValue = invokeComputed(extendedValues);
                    
                    expect(actualValue).to.equal(makeKey(values));
Severity: Major
Found in specs/parametricComputedWithNoDependencies.js and 1 other location - About 2 hrs to fix
specs/parametricComputedWithNoDependencies.js on lines 105..111

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

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 setup has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Benchmark.prototype.setup = function() {
        var updatesCount = this.args.updatesCount;
        var dependenciesCount = this.args.dependenciesCount;
        var ko = this.args.ko;
        var itDepends = this.args.itDepends;
Severity: Major
Found in performance-tests/scenarios/computedDiamondUpdate.js - About 2 hrs to fix

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

        it('should be triggered once when changed back', function () {
            observableValue.write('Bob');
            expect(calls.count).to.equal(2);
            expectLastChanges({ changed: computedValue.withNoArgs(), from: 'Hello, Jack', to: 'Hello, Bob', args: [] });
        });
Severity: Major
Found in specs/computedChangeCallback.js and 1 other location - About 2 hrs to fix
specs/computedChangeCallback.js on lines 96..101

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

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