seiyria/bootstrap-slider

View on GitHub

Showing 62 of 62 total issues

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

            if (this.options.selection === 'none') {
                this._addClass(this.trackLow, 'hide');
                this._addClass(this.trackSelection, 'hide');
                this._addClass(this.trackHigh, 'hide');
            }
Severity: Major
Found in src/js/bootstrap-slider.js and 3 other locations - About 50 mins to fix
src/js/bootstrap-slider.js on lines 733..737
src/js/bootstrap-slider.js on lines 797..853
src/js/bootstrap-slider.js on lines 1232..1236

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

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._state.value[1] = this.options.ticks[this._getClosestTickIndex(this._state.value[1])];
Severity: Minor
Found in src/js/bootstrap-slider.js and 1 other location - About 50 mins to fix
src/js/bootstrap-slider.js on lines 939..939

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

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._state.value[0] = this.options.ticks[this._getClosestTickIndex(this._state.value[0])];
Severity: Minor
Found in src/js/bootstrap-slider.js and 1 other location - About 50 mins to fix
src/js/bootstrap-slider.js on lines 940..940

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

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

Avoid deeply nested control flow statements.
Open

                                if (this.options.selection === 'after' && percentage >= positionPercentages[0]) {
                                    this._addClass(this.tickLabels[i], 'label-in-selection');
                                } else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) {
                                    this._addClass(this.tickLabels[i], 'label-in-selection');
                                }
Severity: Major
Found in src/js/bootstrap-slider.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    if (percentage === positionPercentages[0]) {
                                        this._addClass(this.tickLabels[i], 'label-is-selection');
                                    }
    Severity: Major
    Found in src/js/bootstrap-slider.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                      if (this.tickLabelContainer.childNodes[i].offsetHeight > extraMargin) {
                                          extraMargin = this.tickLabelContainer.childNodes[i].offsetHeight;
                                      }
      Severity: Major
      Found in src/js/bootstrap-slider.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if(this.options.rtl){
                                            this.tickLabels[i].style['marginRight'] = `${this.sliderElem.offsetWidth }px`;
                                        }else{
                                            this.tickLabels[i].style['marginLeft'] = `${this.sliderElem.offsetWidth }px`;
                                        }
        Severity: Major
        Found in src/js/bootstrap-slider.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      } else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) {
                                          this._addClass(this.tickLabels[i], 'label-in-selection');
                                          if (percentage === positionPercentages[0] || positionPercentages[1]) {
                                              this._addClass(this.tickLabels[i], 'label-is-selection');
                                          }
          Severity: Major
          Found in src/js/bootstrap-slider.js - About 45 mins to fix

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

                                if (this._state.dragged === 0 && this._applyToFixedAndParseFloat(this._state.percentage[1], precision) < percentageWithAdjustedPrecision) {
                                    this._state.percentage[0] = this._state.percentage[1];
                                    this._state.dragged = 1;
                                } else if (this._state.dragged === 1 && this._applyToFixedAndParseFloat(this._state.percentage[0], precision) > percentageWithAdjustedPrecision) {
                                    this._state.percentage[1] = this._state.percentage[0];
            Severity: Minor
            Found in src/js/bootstrap-slider.js and 1 other location - About 45 mins to fix
            src/js/bootstrap-slider.js on lines 1781..1794

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

            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 (this._state.dragged === 1 && this._applyToFixedAndParseFloat(this._state.percentage[0], precision) > percentageWithAdjustedPrecision) {
                                    this._state.percentage[1] = this._state.percentage[0];
                                    this._state.dragged = 0;
                                }
                                else if (this._state.keyCtrl === 0 && (this._toPercentage(this._state.value[1]) < percentage)) {
            Severity: Minor
            Found in src/js/bootstrap-slider.js and 1 other location - About 45 mins to fix
            src/js/bootstrap-slider.js on lines 1778..1794

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

            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

            Avoid deeply nested control flow statements.
            Open

                                            if(this.options.rtl){
                                                this.rangeHighlightElements[i].style.right = `${currentRange.start}%`;
                                            } else {
                                                this.rangeHighlightElements[i].style.left = `${currentRange.start}%`;
                                            }
            Severity: Major
            Found in src/js/bootstrap-slider.js - About 45 mins to fix

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

                              if (this.touchCapable) {
                                  // Touch: Unbind touch event handlers:
                                  document.removeEventListener("touchmove", this.mousemove, false);
                                  document.removeEventListener("touchend", this.mouseup, false);
                              }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 1 other location - About 40 mins to fix
              src/js/bootstrap-slider.js on lines 1616..1620

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

              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.touchCapable) {
                                  // Touch: Bind touch events:
                                  document.addEventListener("touchmove", this.mousemove, false);
                                  document.addEventListener("touchend", this.mouseup, false);
                              }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 1 other location - About 40 mins to fix
              src/js/bootstrap-slider.js on lines 1806..1810

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

              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 (isLabelledbyArray && this.options.labelledby[1]) {
                                  sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby[1]);
                              }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 1 other location - About 35 mins to fix
              src/js/bootstrap-slider.js on lines 509..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 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

                              if (isLabelledbyArray && this.options.labelledby[0]) {
                                  sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby[0]);
                              }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 1 other location - About 35 mins to fix
              src/js/bootstrap-slider.js on lines 512..514

              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

                          if(this.options.orientation === "vertical" && (this.options.tooltip_position === "top" || this.options.tooltip_position === "bottom")) {
                              if(this.options.rtl) {
                                  this.options.tooltip_position = "left";
                              }else{
                                  this.options.tooltip_position = "right";
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 1 other location - About 35 mins to fix
              src/js/bootstrap-slider.js on lines 426..430

              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

                          else if(this.options.orientation === "horizontal" && (this.options.tooltip_position === "left" || this.options.tooltip_position === "right")) {
              
                              this.options.tooltip_position = "top";
              
                          }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 1 other location - About 35 mins to fix
              src/js/bootstrap-slider.js on lines 419..430

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

                                  if (this.hideTooltip) {
                                      this.handle1.removeEventListener("touchend", this.hideTooltip, false);
                                      this.handle2.removeEventListener("touchend", this.hideTooltip, false);
                                  }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 2 other locations - About 35 mins to fix
              src/js/bootstrap-slider.js on lines 784..787
              src/js/bootstrap-slider.js on lines 1180..1183

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

                                  if (this.showTooltip) {
                                      this.sliderElem.removeEventListener("touchstart", this.showTooltip, false);
                                      this.sliderElem.removeEventListener("touchmove", this.showTooltip, false);
                                  }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 2 other locations - About 35 mins to fix
              src/js/bootstrap-slider.js on lines 784..787
              src/js/bootstrap-slider.js on lines 1174..1177

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

                          if (this.touchCapable) {
                              this.sliderElem.addEventListener("touchstart", this.touchstart, false);
                              this.sliderElem.addEventListener("touchmove", this.touchmove, false);
                          }
              Severity: Minor
              Found in src/js/bootstrap-slider.js and 2 other locations - About 35 mins to fix
              src/js/bootstrap-slider.js on lines 1174..1177
              src/js/bootstrap-slider.js on lines 1180..1183

              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

              Severity
              Category
              Status
              Source
              Language