talho/openphin

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

Summary

Maintainability
F
3 days
Test Coverage

File Window.js has 587 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: Major
Found in app/assets/javascripts/ext/src/widgets/Window.js - About 1 day to fix

    Window has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.Window = Ext.extend(Ext.Panel, {
        /**
         * @cfg {Number} x
         * The X position of the left edge of the window on initial showing. Defaults to centering the Window within
         * the width of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/Window.js - About 5 hrs to fix

      Function focus has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          focus : function(){
              var f = this.focusEl,
                  db = this.defaultButton,
                  t = typeof db,
                  el,
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Window.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 initEvents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          initEvents : function(){
              Ext.Window.superclass.initEvents.call(this);
              if(this.animateTarget){
                  this.setAnimateTarget(this.animateTarget);
              }
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Window.js - About 1 hr to fix

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

            afterShow : function(isAnim){
                if (this.isDestroyed){
                    return false;
                }
                this.proxy.hide();
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/Window.js - About 1 hr to fix

          Function afterShow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              afterShow : function(isAnim){
                  if (this.isDestroyed){
                      return false;
                  }
                  this.proxy.hide();
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/Window.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 restore has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              restore : function(){
                  if(this.maximized){
                      var t = this.tools;
                      this.el.removeClass('x-window-maximized');
                      if(t.restore){
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/Window.js - About 1 hr to fix

            Function restore has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                restore : function(){
                    if(this.maximized){
                        var t = this.tools;
                        this.el.removeClass('x-window-maximized');
                        if(t.restore){
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.js - About 55 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 beforeShow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                beforeShow : function(){
                    delete this.el.lastXY;
                    delete this.el.lastLT;
                    if(this.x === undefined || this.y === undefined){
                        var xy = this.el.getAlignToXY(this.container, 'c-c');
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.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 show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                show : function(animateTarget, cb, scope){
                    if(!this.rendered){
                        this.render(Ext.getBody());
                    }
                    if(this.hidden === false){
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.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 maximize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                maximize : function(){
                    if(!this.maximized){
                        this.expand(false);
                        this.restoreSize = this.getSize();
                        this.restorePos = this.getPosition(true);
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.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 doConstrain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                doConstrain : function(){
                    if(this.constrain || this.constrainHeader){
                        var offsets;
                        if(this.constrain){
                            offsets = {
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.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

            Function initEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                initEvents : function(){
                    Ext.Window.superclass.initEvents.call(this);
                    if(this.animateTarget){
                        this.setAnimateTarget(this.animateTarget);
                    }
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.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

            Function unghost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                unghost : function(show, matchPosition){
                    if(!this.activeGhost) {
                        return;
                    }
                    if(show !== false){
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.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

            Function hide has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                hide : function(animateTarget, cb, scope){
                    if(this.hidden || this.fireEvent('beforehide', this) === false){
                        return this;
                    }
                    if(cb){
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.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 2 locations. Consider refactoring.
            Open

                    if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
                        Ext.EventManager.onWindowResize(this.onWindowResize, this);
                    }
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Window.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/ext/src/widgets/Window.js on lines 635..637

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

                    if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
                        Ext.EventManager.removeResizeListener(this.onWindowResize, this);
                    }
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Window.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/ext/src/widgets/Window.js on lines 566..568

            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.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/Window.js and 3 other locations - About 40 mins to fix
            app/assets/javascripts/ext/src/widgets/Resizable.js on lines 331..331
            app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 146..146
            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

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

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

            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

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

                    Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Window.js and 1 other location - About 30 mins to fix
            app/assets/javascripts/ext/src/widgets/tips/Tip.js on lines 146..146

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

            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