talho/openphin

View on GitHub
app/assets/javascripts/ext/src/widgets/Resizable.js

Summary

Maintainability
F
4 days
Test Coverage

Function constructor has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    constructor: function(el, config){
        this.el = Ext.get(el);
        if(config && config.wrap){
            config.resizeChild = this.el;
            this.el = this.el.wrap(typeof config.wrap == 'object' ? config.wrap : {cls:'xresizable-wrap'});
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/Resizable.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 Resizable.js has 483 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Ext JS Library 3.3.0
 * Copyright(c) 2006-2010 Ext JS, Inc.
 * licensing@extjs.com
 * http://www.extjs.com/license
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/Resizable.js - About 7 hrs to fix

    Function onMouseMove has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        onMouseMove : function(e){
            if(this.enabled && this.activeHandle){
                try{// try catch so if something goes wrong the user doesn't get hung
    
                if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {
    Severity: Major
    Found in app/assets/javascripts/ext/src/widgets/Resizable.js - About 6 hrs to fix

      Function constructor has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          constructor: function(el, config){
              this.el = Ext.get(el);
              if(config && config.wrap){
                  config.resizeChild = this.el;
                  this.el = this.el.wrap(typeof config.wrap == 'object' ? config.wrap : {cls:'xresizable-wrap'});
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Resizable.js - About 3 hrs to fix

        Function onMouseMove has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            onMouseMove : function(e){
                if(this.enabled && this.activeHandle){
                    try{// try catch so if something goes wrong the user doesn't get hung
        
                    if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/Resizable.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 startSizing has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            startSizing : function(e, handle){
                this.fireEvent('beforeresize', this, e);
                if(this.enabled){ // 2nd enabled check in case disabled before beforeresize handler
        
                    if(!this.overlay){
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/Resizable.js - About 1 hr to fix

          Function constructor has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              constructor : function(rz, pos, disableTrackOver, transparent, cls){
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/Resizable.js - About 35 mins to fix

            Function startSizing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                startSizing : function(e, handle){
                    this.fireEvent('beforeresize', this, e);
                    if(this.enabled){ // 2nd enabled check in case disabled before beforeresize handler
            
                        if(!this.overlay){
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js - About 35 mins 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 snap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                snap : function(value, inc, min){
                    if(!inc || !value){
                        return value;
                    }
                    var newValue = value;
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js - About 25 mins 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 3 locations. Consider refactoring.
            Open

                                case 'east':
                                    h = oh * (w/ow);
                                    h = Math.min(Math.max(mh, h), mxh);
                                    w = ow * (h/oh);
                                   break;
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js and 2 other locations - About 1 hr to fix
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 595..599
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 600..604

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

            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 3 locations. Consider refactoring.
            Open

                                case 'south':
                                    w = ow * (h/oh);
                                    w = Math.min(Math.max(mw, w), mxw);
                                    h = oh * (w/ow);
                                    break;
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js and 2 other locations - About 1 hr to fix
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 590..594
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 600..604

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

            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 3 locations. Consider refactoring.
            Open

                                case 'northeast':
                                    w = ow * (h/oh);
                                    w = Math.min(Math.max(mw, w), mxw);
                                    h = oh * (w/ow);
                                break;
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js and 2 other locations - About 1 hr to fix
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 590..594
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 595..599

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

            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

                                if(el.dom.offsetWidth){
                                    var b = el.getSize(true);
                                    child.setSize(b.width+adj[0], b.height+adj[1]);
                                }
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 379..382

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

            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

                        if(el.dom.offsetWidth){
                            var b = el.getSize(true);
                            child.setSize(b.width+adj[0], b.height+adj[1]);
                        }
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 389..392

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

            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

                        this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Resizable.js and 3 other locations - About 40 mins to fix
            app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 146..146
            app/assets/javascripts/ext/src/widgets/Window.js on lines 511..511
            app/assets/javascripts/ext/src/widgets/Window.js on lines 681..681

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

            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