eliace/ergo-js

View on GitHub
js/core/widget-data.js

Summary

Maintainability
F
5 days
Test Coverage

Function _dataDiff has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
Open

    _dataDiff: function(created, deleted, updated) {

        var o = this.options;

        var filter = o.dynamicFilter ? o.dynamicFilter.bind(this) : null;
Severity: Minor
Found in js/core/widget-data.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

Function bind has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    bind: function(data, update, pivot) {

        var o = this.options;
        var self = this;
        var w = this;
Severity: Minor
Found in js/core/widget-data.js - About 6 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 _dataDiff has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _dataDiff: function(created, deleted, updated) {

        var o = this.options;

        var filter = o.dynamicFilter ? o.dynamicFilter.bind(this) : null;
Severity: Major
Found in js/core/widget-data.js - About 4 hrs to fix

    Function bind has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        bind: function(data, update, pivot) {
    
            var o = this.options;
            var self = this;
            var w = this;
    Severity: Major
    Found in js/core/widget-data.js - About 3 hrs to fix

      File widget-data.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      
      
      
      /**
       * @lends Ergo.core.Widget.prototype
      Severity: Minor
      Found in js/core/widget-data.js - About 2 hrs to fix

        Function _rebind has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            _rebind: function(update, diff, initial) {
        
                var o = this.options;
                var self = this;
        
        
        Severity: Minor
        Found in js/core/widget-data.js - 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 _dataChanged has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            _dataChanged: function(lazy, cascade, no_dynamic) {
        
        //        this.events.fire('refresh');//, e);
        
                // если отключено каскадирование, то обновление не производим
        Severity: Minor
        Found in js/core/widget-data.js - About 1 hr 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 _rebind has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _rebind: function(update, diff, initial) {
        
                var o = this.options;
                var self = this;
        
        
        Severity: Minor
        Found in js/core/widget-data.js - About 1 hr to fix

          Function _dataChanged has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _dataChanged: function(lazy, cascade, no_dynamic) {
          
          //        this.events.fire('refresh');//, e);
          
                  // если отключено каскадирование, то обновление не производим
          Severity: Minor
          Found in js/core/widget-data.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                        if( index <= item.data._id[0] ) {
                                            return true;
                                        }
            Severity: Major
            Found in js/core/widget-data.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if(index != _item._index+1) {
                                          n_upd++;
              //                            _item.unrender()
                                          this.items.remove(_item);
                                          this.items.add(_item, index);
              Severity: Major
              Found in js/core/widget-data.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if( _item ) {
                                            _item._destroy();
                                            _item = null;
                                        }
                Severity: Major
                Found in js/core/widget-data.js - About 45 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                      if(!child._pivot && !(initial.data == child.data && child.options.dynamic) && (child.data != self.data || update === false || !child._static)) {//child.options.binding)) {
                                          child._rebind(false, undefined, initial);
                                      }
                  Severity: Major
                  Found in js/core/widget-data.js - About 40 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status