eliace/ergo-js

View on GitHub

Showing 296 of 296 total issues

Function open has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

        open: function(position) {

            var popups = Ergo.context._popups;

            // в эксклюзивном режиме закрываем другие всплывающие виджеты
Severity: Minor
Found in js/includes/popup.js - About 4 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

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

    E.hasGetter = function(obj, i) {

        var desc = Object.getOwnPropertyDescriptor(obj, i);
        if(desc && desc.get)
            return desc;
Severity: Major
Found in js/core/core-classes.js and 1 other location - About 4 hrs to fix
js/core/core-classes.js on lines 125..139

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

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

    E.hasSetter = function(obj, i) {

        var desc = Object.getOwnPropertyDescriptor(obj, i);
        if(desc && desc.set)
            return desc;
Severity: Major
Found in js/core/core-classes.js and 1 other location - About 4 hrs to fix
js/core/core-classes.js on lines 109..123

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

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

Function _construct has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    _construct: function(o) {

        var _w = this;

        this.navigator = {
Severity: Minor
Found in js/includes/list-navigator.js - About 3 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

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

            if(typeof val == 'string') {
                // action
                var a = val.split(':');
                var action = $ergo.alias('actions:'+a[0]) || this._widget[a[0]];
                if(action == null) {
Severity: Major
Found in js/core/states.js and 1 other location - About 3 hrs to fix
js/core/states.js on lines 379..390

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

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(typeof val == 'string') {
                // action
                var a = val.split(':');
                var action = $ergo.alias('actions:'+a[0]) || this._widget[a[0]];
                if(action == null) {
Severity: Major
Found in js/core/states.js and 1 other location - About 3 hrs to fix
js/core/states.js on lines 319..330

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

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

Function add has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    add: function(item, i, type) {

//        console.log('add item');

//        var key;
Severity: Minor
Found in js/core/widget-list.js - About 3 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 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

    Function addBefore has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        addBefore: function(item, otherItem, w, group) {
    
            var o = this.options;
    
            var itemEl = item.dom.outerEl;
    Severity: Minor
    Found in js/core/layout.js - About 3 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

    `` has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ergo.defineClass('Ergo.core.Widget', /** @lends Ergo.core.Widget.prototype */{
    
        extends: 'Ergo.core.Object',
    
        mixins: ['observable', 'statable'],
    Severity: Minor
    Found in js/core/widget.js - About 3 hrs to fix

      Function open has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              open: function(position) {
      
                  var popups = Ergo.context._popups;
      
                  // в эксклюзивном режиме закрываем другие всплывающие виджеты
      Severity: Major
      Found in js/includes/popup.js - About 3 hrs to fix

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

            sync: function(newData) {
        
                var self = this;
        
                var valueUid = (this.options.valueUid || this._valueUid);
        Severity: Major
        Found in js/core/data.js - About 3 hrs to fix

          Function _construct has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _construct: function(o) {
                  this._super(o);
          
          
                  var grid = this;
          Severity: Major
          Found in js/widgets/grids/table-grid.js - About 3 hrs to fix

            Function set has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                set: function(to, data) {
            
                    if(!to || (typeof to !== 'string')) {
                        console.warn('State key ['+$ergo.print(to)+'] must be of type string');
                        return false;
            Severity: Major
            Found in js/core/states.js - About 3 hrs to fix

              File states.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              
              //= require events
              
              
              
              Severity: Minor
              Found in js/core/states.js - About 3 hrs to fix

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

                                if( desc && (desc.set || desc.get) ) {
                                    var desc2 = Object.getOwnPropertyDescriptor(obj, i);
                                    if(desc2) {
                                        desc2.set = desc2.set || desc.set;
                                        desc2.get = desc2.get || desc.get;
                Severity: Major
                Found in js/core/core-def.js and 3 other locations - About 3 hrs to fix
                js/core/core-def.js on lines 22..35
                js/core/core-def.js on lines 105..133
                js/core/core-def.js on lines 317..340

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

                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

                                if(desc && (desc.get || desc.set) ) {
                                    var descOrig = Object.getOwnPropertyDescriptor(o, i);
                                    if(descOrig) {
                                        descOrig.set = desc.set || descOrig.set;
                                        descOrig.get = desc.get || descOrig.get;
                Severity: Major
                Found in js/core/core-def.js and 3 other locations - About 3 hrs to fix
                js/core/core-def.js on lines 22..35
                js/core/core-def.js on lines 66..76
                js/core/core-def.js on lines 317..340

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

                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

                                if( desc && (desc.set || desc.get) ) {
                                    var descOrig = Object.getOwnPropertyDescriptor(obj, i);
                                    if(descOrig) {
                                        descOrig.set = desc.set || descOrig.set;
                                        descOrig.get = desc.get || descOrig.get;
                Severity: Major
                Found in js/core/core-def.js and 3 other locations - About 3 hrs to fix
                js/core/core-def.js on lines 66..76
                js/core/core-def.js on lines 105..133
                js/core/core-def.js on lines 317..340

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

                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

                                if( desc && (desc.set || desc.get) ) {
                                    var desc2 = Object.getOwnPropertyDescriptor(obj, i);
                                    if(desc2) {
                                        desc2.set = desc2.set || desc.set;
                                        desc2.get = desc2.get || desc.get;
                Severity: Major
                Found in js/core/core-def.js and 3 other locations - About 3 hrs to fix
                js/core/core-def.js on lines 22..35
                js/core/core-def.js on lines 66..76
                js/core/core-def.js on lines 105..133

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

                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

                Function _construct has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                    _construct: function(o) {
                        this._super(o);
                
                
                        this._scopes = {};
                Severity: Minor
                Found in js/core/context.js - About 3 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

                Severity
                Category
                Status
                Source
                Language