talho/openphin

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

Summary

Maintainability
F
3 days
Test Coverage

Function setElementSize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    setElementSize : function(s, newSize, onComplete){
        if(s.orientation == Ext.SplitBar.HORIZONTAL){
            if(!s.animate){
                s.resizingEl.setWidth(newSize);
                if(onComplete){
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/SplitBar.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 SplitBar has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){

    /** @private */
    this.el = Ext.get(dragElement, true);
    this.el.dom.unselectable = "on";
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/SplitBar.js - About 1 hr to fix

    Function onStartProxyDrag has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        onStartProxyDrag : function(x, y){
            this.fireEvent("beforeresize", this);
            this.overlay =  Ext.DomHelper.append(document.body,  {cls: "x-drag-overlay", html: " "}, true);
            this.overlay.unselectable();
            this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/SplitBar.js - About 1 hr to fix

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

          onEndProxyDrag : function(e){
              Ext.get(this.proxy).setDisplayed(false);
              var endPoint = Ext.lib.Event.getXY(e);
              if(this.overlay){
                  Ext.destroy(this.overlay);
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/SplitBar.js - About 1 hr to fix

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

            onEndProxyDrag : function(e){
                Ext.get(this.proxy).setDisplayed(false);
                var endPoint = Ext.lib.Event.getXY(e);
                if(this.overlay){
                    Ext.destroy(this.overlay);
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/SplitBar.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 onStartProxyDrag has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            onStartProxyDrag : function(x, y){
                this.fireEvent("beforeresize", this);
                this.overlay =  Ext.DomHelper.append(document.body,  {cls: "x-drag-overlay", html: " "}, true);
                this.overlay.unselectable();
                this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/SplitBar.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 SplitBar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){
        
            /** @private */
            this.el = Ext.get(dragElement, true);
            this.el.dom.unselectable = "on";
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/SplitBar.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 SplitBar has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/SplitBar.js - About 35 mins to fix

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

                  }else{
                      newSize = this.dragSpecs.startSize +
                          (this.placement == Ext.SplitBar.TOP ?
                              endPoint[1] - this.dragSpecs.startPoint[1] :
                              this.dragSpecs.startPoint[1] - endPoint[1]
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 187..193

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

          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.orientation == Ext.SplitBar.HORIZONTAL){
                      newSize = this.dragSpecs.startSize +
                          (this.placement == Ext.SplitBar.LEFT ?
                              endPoint[0] - this.dragSpecs.startPoint[0] :
                              this.dragSpecs.startPoint[0] - endPoint[0]
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 193..199

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

          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.orientation == Ext.SplitBar.HORIZONTAL){
                  /** @private */
                  this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT);
                  this.el.addClass("x-splitbar-h");
              }else{
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 107..111

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

          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

              }else{
                  /** @private */
                  this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM);
                  this.el.addClass("x-splitbar-v");
              }
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 103..107

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

          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(s.orientation == Ext.SplitBar.HORIZONTAL){
                      if(!s.animate){
                          s.resizingEl.setWidth(newSize);
                          if(onComplete){
                              onComplete(s, newSize);
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 337..347

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

          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

                  }else{
          
                      if(!s.animate){
                          s.resizingEl.setHeight(newSize);
                          if(onComplete){
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 328..337

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

          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

                      this.dd.setYConstraint(
                          this.placement == Ext.SplitBar.TOP ? c1 : c2,
                          this.placement == Ext.SplitBar.TOP ? c2 : c1,
                          this.tickSize
                      );
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 156..160

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

          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

                      this.dd.setXConstraint(
                          this.placement == Ext.SplitBar.LEFT ? c1 : c2,
                          this.placement == Ext.SplitBar.LEFT ? c2 : c1,
                          this.tickSize
                      );
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/SplitBar.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/ext/src/widgets/SplitBar.js on lines 165..169

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

          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/SplitBar.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/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