airbug/bugcore

View on GitHub
libraries/bugcore/js/src/observable/Observable.js

Summary

Maintainability
D
2 days
Test Coverage

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

        attachObserver: function(changeType, observer) {
            var changeTypeObserverList = this.changeTypeObserverMap.get(changeType);
            if (!changeTypeObserverList) {
                this.changeTypeObserverMap.put(changeType, observer);
            } else if (!changeTypeObserverList.contains(observer)) {
Severity: Major
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 2 hrs to fix
libraries/bugcore/js/src/event/EventReceiver.js on lines 198..205

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

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

        removeObserver: function(changeTypes, pathPatterns, observerFunction, observerContext) {
            if (TypeUtil.isArray(pathPatterns)) {
                var observerSet = this.factoryObservers(pathPatterns, observerFunction, observerContext);
                this.detachObserversFromTypes(changeTypes, observerSet);
            } else {
Severity: Major
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 2 hrs to fix
libraries/bugcore/js/src/observable/Observable.js on lines 320..328

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

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

        buildObservers: function(changeTypes, pathPatterns, observerFunction, observerContext) {
            if (TypeUtil.isArray(pathPatterns)) {
                var observerSet = this.factoryObservers(pathPatterns, observerFunction, observerContext);
                this.attachObserversToTypes(changeTypes, observerSet);
            } else {
Severity: Major
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 2 hrs to fix
libraries/bugcore/js/src/observable/Observable.js on lines 170..178

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

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

        detachObserverFromTypes: function(changeTypes, observer) {
            var _this = this;
            if (TypeUtil.isArray(changeTypes)) {
                changeTypes.forEach(function(changeType) {
                    _this.detachObserver(changeType, observer);
Severity: Major
Found in libraries/bugcore/js/src/observable/Observable.js and 3 other locations - About 2 hrs to fix
libraries/bugcore/js/src/event/EventReceiver.js on lines 211..220
libraries/bugcore/js/src/event/EventReceiver.js on lines 234..243
libraries/bugcore/js/src/observable/Observable.js on lines 224..233

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

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

        attachObserverToTypes: function(changeTypes, observer) {
            var _this = this;
            if (TypeUtil.isArray(changeTypes)) {
                changeTypes.forEach(function(changeType) {
                    _this.attachObserver(changeType, observer);
Severity: Major
Found in libraries/bugcore/js/src/observable/Observable.js and 3 other locations - About 2 hrs to fix
libraries/bugcore/js/src/event/EventReceiver.js on lines 211..220
libraries/bugcore/js/src/event/EventReceiver.js on lines 234..243
libraries/bugcore/js/src/observable/Observable.js on lines 265..274

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

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

        propagateObservationToPropagators: function(observation) {
            var clonePropagatorList = this.getObservationPropagatorList().clone();
            clonePropagatorList.forEach(function(propagator) {
                propagator.propagateObservation(observation);
            });
Severity: Major
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 1 hr to fix
libraries/bugcore/js/src/event/EventReceiver.js on lines 339..344

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

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

        attachObserversToTypes: function(changeTypes, observerSet) {
            var _this = this;
            observerSet.forEach(function(observer) {
                _this.attachObserverToTypes(changeTypes, observer);
            });
Severity: Minor
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 45 mins to fix
libraries/bugcore/js/src/observable/Observable.js on lines 280..285

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

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

        detachObserversFromTypes: function(changeTypes, observerSet) {
            var _this = this;
            observerSet.forEach(function(observer) {
                _this.detachObserverFromTypes(changeTypes, observer);
            });
Severity: Minor
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 45 mins to fix
libraries/bugcore/js/src/observable/Observable.js on lines 239..244

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

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

        _constructor: function() {

            this._super();


Severity: Major
Found in libraries/bugcore/js/src/observable/Observable.js and 8 other locations - About 40 mins to fix
libraries/bugcore/js/src/data/Collection.js on lines 77..91
libraries/bugcore/js/src/data/UnorderedPair.js on lines 58..72
libraries/bugcore/js/src/observable/ObservationPropagator.js on lines 57..71
libraries/bugcore/js/src/promise/Deferred.js on lines 56..70
libraries/bugcore/js/src/publisher/Publisher.js on lines 66..80
libraries/bugcore/js/src/query/Query.js on lines 58..72
libraries/bugcore/js/src/query/QueryBuilder.js on lines 58..72
libraries/bugcore/js/src/util/WeightedRandomizer.js on lines 60..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 49.

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

                while (iterator.hasNext()) {
                    var observer = iterator.next();
                    if (observer.match(observationPath)) {
                        return true;
                    }
Severity: Minor
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 35 mins to fix
libraries/bugcore/js/src/data/MultiMap.js on lines 94..99

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

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

            if (!TypeUtil.isArray(pathPatterns) && !TypeUtil.isString(pathPatterns)) {
                throw new ArgumentBug(ArgumentBug.ILLEGAL, "observationPathPatterns", pathPatterns, "parameter must either be an Array or a string");
            }
Severity: Minor
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 30 mins to fix
libraries/bugcore/js/src/observable/Observable.js on lines 107..109

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

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

            if (!TypeUtil.isArray(changeTypes) && !TypeUtil.isString(changeTypes)) {
                throw new ArgumentBug(ArgumentBug.ILLEGAL, "changeTypes", changeTypes, "parameter must either be an Array or a string");
            }
Severity: Minor
Found in libraries/bugcore/js/src/observable/Observable.js and 1 other location - About 30 mins to fix
libraries/bugcore/js/src/observable/Observable.js on lines 110..112

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

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