eliace/ergo-js

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

Summary

Maintainability
D
2 days
Test Coverage

Function render has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    render: function(target, cascade, beforeItem) {

//        console.log('render');

//    var el = this.el;
Severity: Minor
Found in js/core/widget-render.js - About 5 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 render has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render: function(target, cascade, beforeItem) {

//        console.log('render');

//    var el = this.el;
Severity: Major
Found in js/core/widget-render.js - About 2 hrs to fix

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

        _rerender: function(cascade, diff) {
    
            var w = this;
            var o = this.options;
    
    
    Severity: Minor
    Found in js/core/widget-render.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 _renderDiff has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        _renderDiff: function(created, deleted, updated) {
    
    //        console.log('render diff', arguments);
    
            var o = this.options;
    Severity: Minor
    Found in js/core/widget-render.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 _bindDOM has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        _bindDOM: function() {
    
            var o = this.options;
    
            if(o.layout) {
    Severity: Minor
    Found in js/core/widget-render.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 _renderDiff has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _renderDiff: function(created, deleted, updated) {
    
    //        console.log('render diff', arguments);
    
            var o = this.options;
    Severity: Minor
    Found in js/core/widget-render.js - About 1 hr to fix

      Function _rerender has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _rerender: function(cascade, diff) {
      
              var w = this;
              var o = this.options;
      
      
      Severity: Minor
      Found in js/core/widget-render.js - About 1 hr to fix

        Function _bindDOM has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _bindDOM: function() {
        
                var o = this.options;
        
                if(o.layout) {
        Severity: Minor
        Found in js/core/widget-render.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if( (this.options.autoRender === false && target !== true) || (this.options.autoRender == 'non-empty' && !this.__txt && (!this.__c || this.__c.src.length == 0)) ) {
                      return;
                  }
          Severity: Major
          Found in js/core/widget-render.js - About 40 mins to fix

            There are no issues that match your filters.

            Category
            Status