airbug/bugcore

View on GitHub
libraries/bugcore/js/src/util/ObjectUtil.js

Summary

Maintainability
D
2 days
Test Coverage

File ObjectUtil.js has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2016 airbug Inc. http://airbug.com
 *
 * bugcore may be freely distributed under the MIT license.
 */
Severity: Minor
Found in libraries/bugcore/js/src/util/ObjectUtil.js - About 3 hrs to fix

    Function iterate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ObjectUtil.iterate = function(object, iteratee, options) {
            if (!TypeUtil.isObjectLike(object)) {
                throw new TypeError("'object' must be Object like");
            }
            if (!iteratee || (iteratee && !iteratee.call)) {
    Severity: Minor
    Found in libraries/bugcore/js/src/util/ObjectUtil.js - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

              return true;
      Severity: Major
      Found in libraries/bugcore/js/src/util/ObjectUtil.js - About 30 mins to fix

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

                args.forEach(function(arg) {
                    if (TypeUtil.isArray(arg)) {
                        pickProperties = pickProperties.concat(arg);
                    } else if (TypeUtil.isString(arg)) {
                        pickProperties = pickProperties.concat([arg]);
        Severity: Major
        Found in libraries/bugcore/js/src/util/ObjectUtil.js and 1 other location - About 2 hrs to fix
        libraries/bugcore/js/src/util/ObjectUtil.js on lines 481..489

        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

                args.forEach(function(arg) {
                    if (TypeUtil.isArray(arg)) {
                        omitProperties = omitProperties.concat(arg);
                    } else if (TypeUtil.isString(arg)) {
                        omitProperties = omitProperties.concat([arg]);
        Severity: Major
        Found in libraries/bugcore/js/src/util/ObjectUtil.js and 1 other location - About 2 hrs to fix
        libraries/bugcore/js/src/util/ObjectUtil.js on lines 511..519

        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

                        if (ObjectUtil.hasProperty(object, dontEnumPropertyName, options)) {
                            var args = _in ? [dontEnumPropertyName, object[dontEnumPropertyName]] : [object[dontEnumPropertyName], dontEnumPropertyName];
                            var result = FunctionUtil.call(iteratee, context, args.concat(object));
                            if (result === false) {
                                break;
        Severity: Major
        Found in libraries/bugcore/js/src/util/ObjectUtil.js and 1 other location - About 2 hrs to fix
        libraries/bugcore/js/src/util/ObjectUtil.js on lines 416..422

        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

                    if (ObjectUtil.hasProperty(object, propertyName, options)) {
                        var args = _in ? [propertyName, object[propertyName]] : [object[propertyName], propertyName];
                        var result = FunctionUtil.apply(iteratee, context, args.concat(object));
                        if (result === false) {
                            break;
        Severity: Major
        Found in libraries/bugcore/js/src/util/ObjectUtil.js and 1 other location - About 2 hrs to fix
        libraries/bugcore/js/src/util/ObjectUtil.js on lines 428..434

        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

            ObjectUtil.options = function(options, overrides) {
                options = options || {};
                for (var key in overrides) {
                    options[key] = overrides[key];
                }
        Severity: Major
        Found in libraries/bugcore/js/src/util/ObjectUtil.js and 1 other location - About 1 hr to fix
        libraries/bugcore/js/src/util/ArrayUtil.js on lines 237..243

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

        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

            ObjectUtil.forIn = function(object, iteratee, options) {
                return ObjectUtil.for(object, iteratee, ObjectUtil.options(options, {in: true}));
            };
        Severity: Major
        Found in libraries/bugcore/js/src/util/ObjectUtil.js and 4 other locations - About 50 mins to fix
        libraries/bugcore/js/src/util/ArrayUtil.js on lines 97..99
        libraries/bugcore/js/src/util/DataUtil.js on lines 96..98
        libraries/bugcore/js/src/util/DataUtil.js on lines 139..141
        libraries/bugcore/js/src/util/DataUtil.js on lines 207..209

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

        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