src/widgets/widgets.polygon.js

Summary

Maintainability
F
3 wks
Test Coverage

Function widgetsPolygon has 446 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const widgetsPolygon = (three = window.THREE) => {
  if (three === undefined || three.Object3D === undefined) {
    return null;
  }

Severity: Major
Found in src/widgets/widgets.polygon.js - About 2 days to fix

    Function widgetsPolygon has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
    Open

    const widgetsPolygon = (three = window.THREE) => {
      if (three === undefined || three.Object3D === undefined) {
        return null;
      }
    
    
    Severity: Minor
    Found in src/widgets/widgets.polygon.js - About 1 day 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

    File widgets.polygon.js has 453 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { widgetsBase } from './widgets.base';
    import { widgetsHandle as widgetsHandleFactory } from './widgets.handle';
    import CoreUtils from '../core/core.utils';
    
    /**
    Severity: Minor
    Found in src/widgets/widgets.polygon.js - About 6 hrs to fix

      Function updateDOMContent has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          updateDOMContent(clear) {
            const meanSDContainer = this._label.querySelector('.mean-sd');
            const maxMinContainer = this._label.querySelector('.max-min');
            const areaContainer = this._label.querySelector('.area');
      
      
      Severity: Major
      Found in src/widgets/widgets.polygon.js - About 2 hrs to fix

        Function updateMesh has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            updateMesh() {
              if (this._mesh) {
                this.remove(this._mesh);
              }
        
        
        Severity: Minor
        Found in src/widgets/widgets.polygon.js - About 1 hr to fix

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

              onMove(evt) {
                let hovered = false;
          
                if (this.active) {
                  this._dragged = true;
          Severity: Minor
          Found in src/widgets/widgets.polygon.js - About 1 hr to fix

            Function free has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                free() {
                  this.removeEventListeners();
            
                  this._handles.forEach(h => {
                    this.remove(h);
            Severity: Minor
            Found in src/widgets/widgets.polygon.js - About 1 hr to fix

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

                  constructor(targetMesh, controls, params = {}) {
                    super(targetMesh, controls, params);
              
                    this._widgetType = 'Polygon';
              
              
              Severity: Minor
              Found in src/widgets/widgets.polygon.js - About 1 hr to fix

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

                    onEnd() {
                      let numHandles = this._handles.length;
                      let active = false;
                
                      if (
                Severity: Minor
                Found in src/widgets/widgets.polygon.js - About 1 hr to fix

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

                      updateDOMContent(clear) {
                        const meanSDContainer = this._label.querySelector('.mean-sd');
                        const maxMinContainer = this._label.querySelector('.max-min');
                        const areaContainer = this._label.querySelector('.area');
                  
                  
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 5 days to fix
                  src/widgets/widgets.freehand.js on lines 409..484

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

                  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

                      updateMesh() {
                        if (this._mesh) {
                          this.remove(this._mesh);
                        }
                  
                  
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 5 days to fix
                  src/widgets/widgets.freehand.js on lines 289..358

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

                  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

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

                      free() {
                        this.removeEventListeners();
                  
                        this._handles.forEach(h => {
                          this.remove(h);
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 2 days to fix
                  src/widgets/widgets.freehand.js on lines 519..562

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

                  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

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

                          if (this._newHandleRequired && !this._initialized) {
                            this._handles[this._handles.length - 1].hovered = false;
                            this._handles[this._handles.length - 1].active = false;
                            this._handles[this._handles.length - 1].tracking = false;
                  
                  
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 5 hrs to fix
                  src/widgets/widgets.freehand.js on lines 126..154

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

                  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

                      onHover(evt) {
                        if (evt) {
                          this.hoverDom(evt);
                        }
                  
                  
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 2 other locations - About 4 hrs to fix
                  src/widgets/widgets.freehand.js on lines 78..91
                  src/widgets/widgets.velocityTimeIntegral.js on lines 90..103

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

                  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

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

                      update() {
                        this.updateColor();
                  
                        // update handles
                        this._handles.forEach(elem => elem.update());
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 3 hrs to fix
                  src/widgets/widgets.freehand.js on lines 274..287

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

                  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

                  Identical blocks of code found in 3 locations. Consider refactoring.
                  Open

                      createLine() {
                        const line = document.createElement('div');
                  
                        line.className = 'widgets-line';
                        line.addEventListener('mouseenter', this.onHover);
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 2 other locations - About 3 hrs to fix
                  src/widgets/widgets.freehand.js on lines 250..258
                  src/widgets/widgets.velocityTimeIntegral.js on lines 285..293

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

                  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

                      addEventListeners() {
                        this._container.addEventListener('dblclick', this.onDoubleClick);
                        this._container.addEventListener('wheel', this.onMove);
                  
                        this._label.addEventListener('mouseenter', this.onHover);
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 2 hrs to fix
                  src/widgets/widgets.polygon.js on lines 74..80

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

                  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

                      removeEventListeners() {
                        this._container.removeEventListener('dblclick', this.onDoubleClick);
                        this._container.removeEventListener('wheel', this.onMove);
                  
                        this._label.removeEventListener('mouseenter', this.onHover);
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 2 hrs to fix
                  src/widgets/widgets.polygon.js on lines 66..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 88.

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

                      showDOM() {
                        this._handles.forEach(elem => elem.showDOM());
                  
                        this._lines.forEach(elem => (elem.style.display = ''));
                        this._label.style.display = '';
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 5 other locations - About 2 hrs to fix
                  src/widgets/widgets.freehand.js on lines 260..265
                  src/widgets/widgets.freehand.js on lines 267..272
                  src/widgets/widgets.polygon.js on lines 294..299
                  src/widgets/widgets.velocityTimeIntegral.js on lines 544..549
                  src/widgets/widgets.velocityTimeIntegral.js on lines 551..556

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

                      hideDOM() {
                        this._handles.forEach(elem => elem.hideDOM());
                  
                        this._lines.forEach(elem => (elem.style.display = 'none'));
                        this._label.style.display = 'none';
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 5 other locations - About 2 hrs to fix
                  src/widgets/widgets.freehand.js on lines 260..265
                  src/widgets/widgets.freehand.js on lines 267..272
                  src/widgets/widgets.polygon.js on lines 301..306
                  src/widgets/widgets.velocityTimeIntegral.js on lines 544..549
                  src/widgets/widgets.velocityTimeIntegral.js on lines 551..556

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

                        if (!this._dragged && this._active) {
                          this._selected = !this._selected; // change state if there was no dragging
                          this._handles.forEach(elem => (elem.selected = this._selected));
                        }
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 2 other locations - About 1 hr to fix
                  src/widgets/widgets.freehand.js on lines 201..204
                  src/widgets/widgets.velocityTimeIntegral.js on lines 217..220

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

                  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

                      set targetMesh(targetMesh) {
                        this._targetMesh = targetMesh;
                        this._handles.forEach(elem => (elem.targetMesh = targetMesh));
                        this._moveHandle.targetMesh = targetMesh;
                        this.update();
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 2 other locations - About 1 hr to fix
                  src/widgets/widgets.freehand.js on lines 575..580
                  src/widgets/widgets.velocityTimeIntegral.js on lines 617..622

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

                  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

                      createMaterial() {
                        this._material = new three.MeshBasicMaterial({ side: THREE.DoubleSide });
                        this._material.transparent = true;
                        this._material.opacity = 0.2;
                      }
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 1 hr to fix
                  src/widgets/widgets.freehand.js on lines 218..222

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

                  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

                      set worldPosition(worldPosition) {
                        this._handles.forEach(elem => elem.worldPosition.copy(worldPosition));
                        this._worldPosition.copy(worldPosition);
                        this.update();
                      }
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 3 other locations - About 1 hr to fix
                  src/widgets/widgets.biruler.js on lines 429..433
                  src/widgets/widgets.freehand.js on lines 586..590
                  src/widgets/widgets.velocityTimeIntegral.js on lines 628..632

                  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

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

                        this._units =
                          !this._calibrationFactor && !params.stack.frame[params.frameIndex].pixelSpacing
                            ? 'units'
                            : 'cm²';
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 3 other locations - About 40 mins to fix
                  src/widgets/widgets.ellipse.js on lines 26..29
                  src/widgets/widgets.freehand.js on lines 26..29
                  src/widgets/widgets.rectangle.js on lines 26..29

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

                        this._handles.forEach(elem => {
                          elem.onStart(evt);
                          active = active || elem.active;
                        });
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 4 other locations - About 35 mins to fix
                  src/widgets/widgets.freehand.js on lines 105..108
                  src/widgets/widgets.freehand.js on lines 157..160
                  src/widgets/widgets.polygon.js on lines 166..169
                  src/widgets/widgets.velocityTimeIntegral.js on lines 117..120

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

                        this._handles.forEach(elem => {
                          elem.onMove(evt);
                          hovered = hovered || elem.hovered;
                        });
                  Severity: Major
                  Found in src/widgets/widgets.polygon.js and 4 other locations - About 35 mins to fix
                  src/widgets/widgets.freehand.js on lines 105..108
                  src/widgets/widgets.freehand.js on lines 157..160
                  src/widgets/widgets.polygon.js on lines 108..111
                  src/widgets/widgets.velocityTimeIntegral.js on lines 117..120

                  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

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

                          !this._initialized &&
                          numHandles > 1 &&
                          this._handles[numHandles - 2].screenPosition.distanceTo(
                            this._handles[numHandles - 1].screenPosition
                          ) < 10
                  Severity: Minor
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 35 mins to fix
                  src/widgets/widgets.polygon.js on lines 224..227

                  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

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

                          (numHandles > 1 &&
                            this._handles[numHandles - 2].screenPosition.distanceTo(
                              this._handles[numHandles - 1].screenPosition
                            ) < 10)
                  Severity: Minor
                  Found in src/widgets/widgets.polygon.js and 1 other location - About 35 mins to fix
                  src/widgets/widgets.polygon.js on lines 182..186

                  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._domHovered && this._initialized) {
                          this._moving = true;
                          this._controls.enabled = false;
                        }
                  Severity: Minor
                  Found in src/widgets/widgets.polygon.js and 2 other locations - About 30 mins to fix
                  src/widgets/widgets.crossRuler.js on lines 125..128
                  src/widgets/widgets.freehand.js on lines 112..115

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 45.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status