gerich-home/it-depends

View on GitHub

Showing 119 of 119 total issues

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

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

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

Function describeUsageSyntax has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var describeUsageSyntax = function(invokeComputed) {
        var defineTest = function(i) {
            var values = exampleValues[i];
            var valuesString = stringify(values);
            
Severity: Major
Found in specs/parametricComputedWithNoDependencies.js - About 2 hrs to fix

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

export default function<T>(stateListener?: IStateListener): ISubscriptions<T> {
    interface ILinkedListItem {
        next: ILinkedListItem;
        prev: ILinkedListItem;
        handler?: IChangeHandler<T>;
Severity: Major
Found in src/subscriptionList.ts - About 2 hrs to fix

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

export default function<T>(calculator: ICalculator<T>, writeCallback?: IWriteCallback<T>): IParametricComputed<T> {
    const cache: IComputedHash = {};
    const allArguments = [];

    const self = <IParametricComputedValue<T>>read;
Severity: Minor
Found in src/parametricComputed.ts - About 2 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 default has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export default function<T>(stateListener?: IStateListener): ISubscriptions<T> {
    interface ILinkedListItem {
        next: ILinkedListItem;
        prev: ILinkedListItem;
        handler?: IChangeHandler<T>;
Severity: Minor
Found in src/subscriptionList.ts - About 2 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 defineTest has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        var defineTest = function(i) {
            var values = exampleValues[i];
            var valuesString = stringify(values);
            
            it('should calculate when requested with values ' + valuesString, function () {
Severity: Major
Found in specs/parametricComputedWithNoDependencies.js - About 2 hrs to fix

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

export default function<T>(calculator: ICalculator<T>, writeCallback?: IWriteCallback<T>): IParametricComputed<T> {
    const cache: IComputedHash = {};
    const allArguments = [];

    const self = <IParametricComputedValue<T>>read;
Severity: Minor
Found in src/parametricComputed.ts - About 1 hr to fix

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

            it('should not recalculate when requested second time', function () {
                c();
                var actualValue = c();
                
                expect(actualValue).to.equal(5);
Severity: Major
Found in specs/realWorldUseCases.js and 2 other locations - About 1 hr to fix
specs/realWorldUseCases.js on lines 60..66
specs/realWorldUseCases.js on lines 158..164

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

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 second time', function () {
                c();
                var actualValue = c();
                
                expect(actualValue).to.equal(5);
Severity: Major
Found in specs/realWorldUseCases.js and 2 other locations - About 1 hr to fix
specs/realWorldUseCases.js on lines 60..66
specs/realWorldUseCases.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 71.

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 second time', function () {
                d();
                var actualValue = d();
                
                expect(actualValue).to.equal(6);
Severity: Major
Found in specs/realWorldUseCases.js and 2 other locations - About 1 hr to fix
specs/realWorldUseCases.js on lines 136..142
specs/realWorldUseCases.js on lines 158..164

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

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

    function executeCalculator(): void {
        const dependenciesById: IDependencyHash = {};

        const oldDependencies = dependencies;
        dependencies = [];
Severity: Minor
Found in src/computed.ts - About 1 hr to fix

Function exports has 42 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/computedUpdates.js - About 1 hr to fix

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

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

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

            var a = itDepends.computed(function() {
                var z = 0;
                for (var j = 0; j < dependenciesCount; j++) {
                    z += x[j]();
                }
Severity: Major
Found in specs/realWorldUseCases.js and 2 other locations - About 1 hr to fix
performance-tests/scenarios/computedDiamondUpdate.js on lines 31..37
performance-tests/scenarios/computedDiamondUpdate.js on lines 66..72

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

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

            var a = ko.pureComputed(function() {
                var z = 0;
                for (var j = 0; j < dependenciesCount; j++) {
                    z += x[j]();
                }
Severity: Major
Found in performance-tests/scenarios/computedDiamondUpdate.js and 2 other locations - About 1 hr to fix
performance-tests/scenarios/computedDiamondUpdate.js on lines 66..72
specs/realWorldUseCases.js on lines 178..184

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

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

            var a = itDepends.computed(function() {
                var z = 0;
                for (var j = 0; j < dependenciesCount; j++) {
                    z += x[j]();
                }
Severity: Major
Found in performance-tests/scenarios/computedDiamondUpdate.js and 2 other locations - About 1 hr to fix
performance-tests/scenarios/computedDiamondUpdate.js on lines 31..37
specs/realWorldUseCases.js on lines 178..184

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

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

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

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/bulkChange.js and 1 other location - About 1 hr to fix
specs/computedChangeCallback.js on lines 37..40

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 calculate 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 149..154
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 once when requested', function () {
                var actualValue = c();
                
                expect(actualValue).to.equal(5);
                expect(calls.count).to.equal(2);
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 129..134

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

Severity
Category
Status
Source
Language