talho/openphin

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

Summary

Maintainability
F
4 days
Test Coverage

File Slider.js has 473 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/Slider.js - About 7 hrs to fix

    MultiSlider has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.slider.MultiSlider = Ext.extend(Ext.BoxComponent, {
        /**
         * @cfg {Number} value The value to initialize the slider with. Defaults to minValue.
         */
        /**
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/Slider.js - About 3 hrs to fix

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

          onKeyDown : function(e){
              /*
               * The behaviour for keyboard handling with multiple thumbs is currently undefined.
               * There's no real sane default for it, so leave it like this until we come up
               * with a better way of doing it.
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.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 afterRender has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          afterRender : function(){
              Ext.slider.MultiSlider.superclass.afterRender.apply(this, arguments);
      
              for (var i=0; i < this.thumbs.length; i++) {
                  var thumb = this.thumbs[i];
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.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 onDrag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          onDrag: function(e) {
              var slider   = this.slider,
                  index    = this.index,
                  newValue = this.getNewValue();
      
      
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.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 onEnable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          onEnable: function(){
              Ext.slider.MultiSlider.superclass.onEnable.call(this);
      
              for (var i=0; i < this.thumbs.length; i++) {
                  var thumb = this.thumbs[i],
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.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 doSnap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          doSnap : function(value){
              if (!(this.increment && value)) {
                  return value;
              }
              var newValue = value,
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.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 setValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          setValue : function(index, v, animate, changeComplete) {
              var thumb = this.thumbs[index],
                  el    = thumb.el;
      
              v = this.normalizeValue(v);
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.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 onDisable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          onDisable: function(){
              Ext.slider.MultiSlider.superclass.onDisable.call(this);
      
              for (var i=0; i < this.thumbs.length; i++) {
                  var thumb = this.thumbs[i],
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.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

          setMinValue : function(val){
              this.minValue = val;
              var i = 0,
                  thumbs = this.thumbs,
                  len = thumbs.length,
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 643..655

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

      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

          setMaxValue : function(val){
              this.maxValue = val;
              var i = 0,
                  thumbs = this.thumbs,
                  len = thumbs.length,
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 624..636

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

      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.tracker = new Ext.dd.DragTracker({
                  onBeforeStart: this.onBeforeDragStart.createDelegate(this),
                  onStart      : this.onDragStart.createDelegate(this),
                  onDrag       : this.onDrag.createDelegate(this),
                  onEnd        : this.onDragEnd.createDelegate(this),
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/ext/src/widgets/list/ColumnResizer.js on lines 31..38

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

      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

                  case e.RIGHT:
                      e.stopEvent();
                      val = e.ctrlKey ? this.maxValue : this.getValue(0) + this.keyIncrement;
                      this.setValue(0, val, undefined, true);
                  break;
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 539..543

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

      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

                  case e.LEFT:
                      e.stopEvent();
                      val = e.ctrlKey ? this.minValue : this.getValue(0) - this.keyIncrement;
                      this.setValue(0, val, undefined, true);
                  break;
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 533..537

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

      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(!animate || this.animate === false){
                  thumb.setLeft(v);
              }else{
                  thumb.shift({left: v, stopFx: true, duration:.35});
              }
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 939..943

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

      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 (!animate || this.animate === false) {
                  el.setBottom(v);
              } else {
                  el.shift({bottom: v, stopFx: true, duration:.35});
              }
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 710..714

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

      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.innerEl.setHeight(h - (this.el.getPadding('t') + this.endEl.getPadding('b')));
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 35 mins to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 737..737

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

                  this.innerEl.setWidth(w - (this.el.getPadding('l') + this.endEl.getPadding('r')));
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 35 mins to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 925..925

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

          disable: function() {
              this.disabled = true;
              this.el.addClass(this.slider.disabledClass);
          },
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 35 mins to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 61..64

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

      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

          enable: function() {
              this.disabled = false;
              this.el.removeClass(this.slider.disabledClass);
          },
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Slider.js and 1 other location - About 35 mins to fix
      app/assets/javascripts/ext/src/widgets/Slider.js on lines 69..72

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

      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