axsh/wakame-vdc

View on GitHub
frontend/admin/app/assets/javascripts/backbone.paginator.js

Summary

Maintainability
F
1 wk
Test Coverage

Function Paginator has 534 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Backbone.Paginator = (function ( Backbone, _, $ ) {
    "use strict";

    var Paginator = {};
    Paginator.version = "0.15";
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 2 days to fix

Function Paginator has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

Backbone.Paginator = (function ( Backbone, _, $ ) {
    "use strict";

    var Paginator = {};
    Paginator.version = "0.15";
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 1 day 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

File backbone.paginator.js has 537 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*globals Backbone:true, _:true, jQuery:true*/
Backbone.Paginator = (function ( Backbone, _, $ ) {
    "use strict";

    var Paginator = {};
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 1 day to fix

Function _fieldFilter has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _fieldFilter: function( models, rules ) {

            // Check if there are any rules
            if ( _.isEmpty(rules) ) {
                return models;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 3 hrs to fix

Function _filter has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _filter: function ( models, fields, filter ) {

            //  For example, if you had a data model containing cars like { color: '', description: '', hp: '' },
            //  your fields was set to ['color', 'description', 'hp'] and your filter was set
            //  to "Black Mustang 300", the word "Black" will match all the cars that have black color, then
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 2 hrs to fix

Function sync has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        sync: function ( method, model, options ) {

            var self = this;

            // Create default values if no others are specified
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 1 hr to fix

Function _sort has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _sort: function ( models, sort, direction ) {
            models = models.sort(function (a, b) {
                var ac = a.get(sort),
                    bc = b.get(sort);

Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 1 hr to fix

Function sync has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        sync: function ( method, model, options ) {

            var self = this;

            // Create default values if no others are specified
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 1 hr to fix

Function setPagination has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        setPagination: function ( info ) {
            var pages = [], i = 0, l = 0;


            // How many adjacent pages should be shown on each side?
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 1 hr to fix

Function pager has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        pager: function () {
            var self = this,
                disp = this.perPage,
                start = (self.currentPage - 1) * disp,
                stop = start + disp;
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

                        if( !_.isNaN( Number( model.get(rule.field) ) ) &&
                            !_.isNaN( Number( rule.value ) ) &&
                            Number( model.get(rule.field) ) <= Number( rule.value ) ) {
                            should_push = true;
                        }
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    else if (LASTPAGE - ADJACENTx2 > info.currentPage && info.currentPage > ADJACENTx2) {
                        for (i = info.currentPage - ADJACENT; i <= info.currentPage + ADJACENT; i++) {
                            pages.push(i);
                        }
                    }
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    }else if(rule.type === "range"){
                        if( !_.isNaN( Number( model.get(rule.field) ) ) &&
                            _.isObject( rule.value ) &&
                            !_.isNaN( Number( rule.value.min ) ) &&
                            !_.isNaN( Number( rule.value.max ) ) &&
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        for (i = 1, l = 4 + ADJACENTx2; i < l; i++) {
                            pages.push(i);
                        }
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 45 mins to fix

Consider simplifying this complex logical expression.
Open

                        if( !_.isNaN( Number( model.get(rule.field) ) ) &&
                            _.isObject( rule.value ) &&
                            !_.isNaN( Number( rule.value.min ) ) &&
                            !_.isNaN( Number( rule.value.max ) ) &&
                            Number( model.get(rule.field) ) >= Number( rule.value.min ) &&
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 40 mins to fix

Avoid too many return statements within this function.
Open

                            return -1;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return -1;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return -1;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return 1;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return 1;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                return 0;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js - About 30 mins to fix

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

                    }else if(rule.type === "min"){
                        if( !_.isNaN( Number( model.get(rule.field) ) ) &&
                            !_.isNaN( Number( rule.value ) ) &&
                            Number( model.get(rule.field) ) >= Number( rule.value ) ) {
                            should_push = true;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 3 hrs to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 392..454

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

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

                    }else if(rule.type === "max"){
                        if( !_.isNaN( Number( model.get(rule.field) ) ) &&
                            !_.isNaN( Number( rule.value ) ) &&
                            Number( model.get(rule.field) ) <= Number( rule.value ) ) {
                            should_push = true;
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 3 hrs to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 384..454

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

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

        requestPreviousPage: function ( options ) {
            if ( this.currentPage !== undefined ) {
                this.currentPage -= 1;
                return this.pager( options );
            } else {
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 2 hrs to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 746..755

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

        requestNextPage: function ( options ) {
            if ( this.currentPage !== undefined ) {
                this.currentPage += 1;
                return this.pager( options );
            } else {
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 2 hrs to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 757..766

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

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

            _.each(self.server_api, function(value, key){
                if( _.isFunction(value) ) {
                    value = _.bind(value, self);
                    value = value();
                }
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 2 hrs to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 704..710

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

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

            _.each(self.server_api, function(value, key){
                if( _.isFunction(value) ) {
                    value = _.bind(value, self);
                    value = value();
                }
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 2 hrs to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 58..64

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

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

            _.each(queryOptions, function(value, key){
                if( _.isFunction(value) ) {
                    value = _.bind(value, self);
                    value = value();
                }
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 1 hr to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 67..73

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

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

            _.each(queryOptions, function(value, key){
                if( _.isFunction(value) ) {
                    value = _.bind(value, self);
                    value = value();
                }
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 1 hr to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 713..719

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

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

            _.each(self.paginator_ui, function(value, key) {
                if( _.isUndefined(self[key]) ) {
                    self[key] = self.paginator_ui[key];
                }
            });
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 1 hr to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 49..53

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

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

            _.each(self.paginator_ui, function(value, key) {
                if( _.isUndefined(self[key]) ) {
                    self[key] = self.paginator_ui[key];
                }
            });
Severity: Major
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 1 hr to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 695..699

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

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 ( this.filterExpression !== "" ) {
                self.models = self._filter(self.models, this.filterFields, this.filterExpression);
            }
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 50 mins to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 238..240

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

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 ( this.sortColumn !== "" ) {
                self.models = self._sort(self.models, this.sortColumn, this.sortDirection);
            }
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 50 mins to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 248..250

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

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

                    }else if(rule.type === "maxLength"){
                        if( model.get(rule.field).toString().length <= rule.value ) {
                            should_push = true;
                        }

Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 50 mins to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 411..454

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

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

                    }else if(rule.type === "minLength"){
                        if( model.get(rule.field).toString().length >= rule.value ) {
                            should_push = true;
                        }

Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 50 mins to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 417..454

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

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

                    if((!ac.match(/[^\d\.]/) && ac.match(/[\d\.]*/)) &&
                        (!bc.match(/[^\d\.]/) && bc.match(/[\d\.]*/))
                    ){
                        if( (ac - 0) < (bc - 0) ) {
                            return -1;
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 45 mins to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 293..310

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

                    if((!ac.match(/[^\d\.]/) && ac.match(/[\d\.]*/)) &&
                        (!bc.match(/[^\d\.]/) && bc.match(/[\d\.]*/))
                    ){

                        if( (ac - 0) < (bc - 0) ) {
Severity: Minor
Found in frontend/admin/app/assets/javascripts/backbone.paginator.js and 1 other location - About 45 mins to fix
frontend/admin/app/assets/javascripts/backbone.paginator.js on lines 315..331

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

There are no issues that match your filters.

Category
Status