talho/openphin

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

Summary

Maintainability
F
6 days
Test Coverage

File BorderLayout.js has 696 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/layout/BorderLayout.js - About 1 day to fix

    Function onLayout has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        onLayout : function(ct, target){
            var collapsed, i, c, pos, items = ct.items.items, len = items.length;
            if(!this.rendered){
                collapsed = [];
                for(i = 0; i < len; i++) {
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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

    prototype has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.layout.BorderLayout.Region.prototype = {
        /**
         * @cfg {Boolean} animFloat
         * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated
         * panel that will close again once the user mouses out of that panel (or clicks out if
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js - About 4 hrs to fix

      Function onLayout has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          onLayout : function(ct, target){
              var collapsed, i, c, pos, items = ct.items.items, len = items.length;
              if(!this.rendered){
                  collapsed = [];
                  for(i = 0; i < len; i++) {
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js - About 4 hrs to fix

        Function getCollapsedEl has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            getCollapsedEl : function(){
                if(!this.collapsedEl){
                    if(!this.toolTemplate){
                        var tt = new Ext.Template(
                             '<div class="x-tool x-tool-{id}">&#160;</div>'
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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 slideOut has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            slideOut : function(){
                if(this.isSlid || this.el.hasActiveFx()){
                    return;
                }
                this.isSlid = true;
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js - About 1 hr to fix

          Function getCollapsedEl has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getCollapsedEl : function(){
                  if(!this.collapsedEl){
                      if(!this.toolTemplate){
                          var tt = new Ext.Template(
                               '<div class="x-tool x-tool-{id}">&#160;</div>'
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js - About 1 hr to fix

            Function Region has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            Ext.layout.BorderLayout.Region = function(layout, config, pos){
                Ext.apply(this, config);
                this.layout = layout;
                this.position = pos;
                this.state = {};
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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 render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                render : function(ct, p){
                    Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
            
                    var ps = this.position;
            
            
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js - About 1 hr to fix

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

                  render : function(ct, p){
                      this.panel = p;
                      p.el.enableDisplayMode();
                      this.targetEl = ct;
                      this.el = p.el;
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js - About 1 hr to fix

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

                    slideOut : function(){
                        if(this.isSlid || this.el.hasActiveFx()){
                            return;
                        }
                        this.isSlid = true;
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    render : function(ct, p){
                        Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
                
                        var ps = this.position;
                
                
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    destroy: function() {
                        var r = ['north', 'south', 'east', 'west'], i, region;
                        for (i = 0; i < r.length; i++) {
                            region = this[r[i]];
                            if(region){
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    render : function(ct, p){
                        this.panel = p;
                        p.el.enableDisplayMode();
                        this.targetEl = ct;
                        this.el = p.el;
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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 initAutoHide has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    initAutoHide : function(){
                        if(this.autoHide !== false){
                            if(!this.autoHideHd){
                                this.autoHideSlideTask = new Ext.util.DelayedTask(this.slideIn, this);
                                this.autoHideHd = {
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.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

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

                    getVMaxSize : function(){
                        var cmax = this.maxSize || 10000;
                        var center = this.layout.center;
                        return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());
                    },
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 1107..1111

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

                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

                    getHMaxSize : function(){
                         var cmax = this.maxSize || 10000;
                         var center = this.layout.center;
                         return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());
                    },
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 1114..1118

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

                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

                    onShow : function(){
                        if(this.isCollapsed){
                            this.getCollapsedEl().show();
                        }else if(this.splitEl){
                            this.splitEl.show();
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 590..596

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

                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

                    onHide : function(){
                        if(this.isCollapsed){
                            this.getCollapsedEl().hide();
                        }else if(this.splitEl){
                            this.splitEl.hide();
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 599..605

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

                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

                        east : {
                            orientation: Ext.SplitBar.HORIZONTAL,
                            placement: Ext.SplitBar.RIGHT,
                            maxFn : 'getHMaxSize',
                            minProp: 'minWidth',
                Severity: Major
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js and 3 other locations - About 35 mins to fix
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 968..974
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 975..981
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 989..995

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

                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

                        south : {
                            orientation: Ext.SplitBar.VERTICAL,
                            placement: Ext.SplitBar.BOTTOM,
                            maxFn : 'getVMaxSize',
                            minProp: 'minHeight',
                Severity: Major
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js and 3 other locations - About 35 mins to fix
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 968..974
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 982..988
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 989..995

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

                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

                        north : {
                            orientation: Ext.SplitBar.VERTICAL,
                            placement: Ext.SplitBar.TOP,
                            maxFn : 'getVMaxSize',
                            minProp: 'minHeight',
                Severity: Major
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js and 3 other locations - About 35 mins to fix
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 975..981
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 982..988
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 989..995

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

                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

                        west : {
                            orientation: Ext.SplitBar.HORIZONTAL,
                            placement: Ext.SplitBar.LEFT,
                            maxFn : 'getHMaxSize',
                            minProp: 'minWidth',
                Severity: Major
                Found in app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js and 3 other locations - About 35 mins to fix
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 968..974
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 975..981
                app/assets/javascripts/ext/src/widgets/layout/BorderLayout.js on lines 982..988

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

                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