src/widgets/widgets.crossRuler.js

Summary

Maintainability
F
2 wks
Test Coverage

Function widgetsCrossRuler has 477 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

    Function widgetsCrossRuler has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

    const widgetsCrossRuler = (three = window.THREE) => {
      if (three === undefined || three.Object3D === undefined) {
        return null;
      }
    
    
    Severity: Minor
    Found in src/widgets/widgets.crossRuler.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.crossRuler.js has 483 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { widgetsBase } from './widgets.base';
    import { widgetsHandle as widgetsHandleFactory } from './widgets.handle';
    
    /**
     * @module widgets/crossRuler
    Severity: Minor
    Found in src/widgets/widgets.crossRuler.js - About 7 hrs to fix

      Function updateDOM has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          updateDOM() {
            this.updateDOMColor();
      
            // update first line
            const lineData = this.getLineData(
      Severity: Major
      Found in src/widgets/widgets.crossRuler.js - About 3 hrs to fix

        Function recalculateOrtho has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            recalculateOrtho() {
              // called onMove if 2nd or 3rd handle is active
              const activeInd = this._handles[2].active ? 2 : 3;
              const lines = [];
              const intersect = new three.Vector3();
        Severity: Minor
        Found in src/widgets/widgets.crossRuler.js - About 1 hr to fix

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

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

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

                onEnd() {
                  this._handles[0].onEnd();
                  this._handles[2].onEnd();
                  this._handles[3].onEnd();
            
            
            Severity: Minor
            Found in src/widgets/widgets.crossRuler.js - About 1 hr to fix

              Function initCoordinates has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  initCoordinates(first, second, third, fourth) {
                    const intersectR = new three.Vector3();
                    const intersectS = new three.Vector3();
                    const ray = new three.Ray(first);
              
              
              Severity: Minor
              Found in src/widgets/widgets.crossRuler.js - About 1 hr to fix

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

                      const label2Padding =
                          Math.tan(angle2) < this._label2.offsetHeight / this._label2.offsetWidth
                            ? this._label2.offsetWidth / 2 / Math.cos(angle2) + 15 // 5px for each handle + padding
                            : this._label2.offsetHeight / 2 / Math.cos(Math.PI / 2 - angle2) + 15,
                        paddingVector2 = line2Data.line.normalize().multiplyScalar(label2Padding),
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 1 day to fix
                src/widgets/widgets.crossRuler.js on lines 365..374

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

                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

                      const labelPadding =
                          Math.tan(angle) < this._label.offsetHeight / this._label.offsetWidth
                            ? this._label.offsetWidth / 2 / Math.cos(angle) + 15 // 5px for each handle + padding
                            : this._label.offsetHeight / 2 / Math.cos(Math.PI / 2 - angle) + 15,
                        paddingVector = lineData.line.normalize().multiplyScalar(labelPadding),
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 1 day to fix
                src/widgets/widgets.crossRuler.js on lines 383..392

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

                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

                    createMesh() {
                      // geometry
                      this._geometry = new three.Geometry();
                      this._geometry.vertices = [
                        this._handles[0].worldPosition,
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 2 other locations - About 7 hrs to fix
                src/widgets/widgets.angle.js on lines 203..222
                src/widgets/widgets.biruler.js on lines 148..167

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

                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

                      if (this._active) {
                        const prevPosition = this._moveHandle.worldPosition.clone();
                
                        this._dragged = true;
                        this._moveHandle.onMove(evt, true);
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 2 other locations - About 6 hrs to fix
                src/widgets/widgets.angle.js on lines 132..145
                src/widgets/widgets.ruler.js on lines 117..130

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

                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

                      if (distanceData.units === 'units' && !this._label.hasAttribute('title')) {
                        this._label.setAttribute('title', title);
                        this._label.style.color = this._colors.error;
                      } else if (distanceData.units !== 'units' && this._label.hasAttribute('title')) {
                        this._label.removeAttribute('title');
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 3 other locations - About 5 hrs to fix
                src/widgets/widgets.biruler.js on lines 309..315
                src/widgets/widgets.biruler.js on lines 316..322
                src/widgets/widgets.crossRuler.js on lines 350..356

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

                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

                      if (distanceData2.units === 'units' && !this._label2.hasAttribute('title')) {
                        this._label2.setAttribute('title', title);
                        this._label2.style.color = this._colors.error;
                      } else if (distanceData2.units !== 'units' && this._label2.hasAttribute('title')) {
                        this._label2.removeAttribute('title');
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 3 other locations - About 5 hrs to fix
                src/widgets/widgets.biruler.js on lines 309..315
                src/widgets/widgets.biruler.js on lines 316..322
                src/widgets/widgets.crossRuler.js on lines 343..349

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

                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

                    showDOM() {
                      this._line.style.display = '';
                      this._line2.style.display = '';
                      this._label.style.display = '';
                      this._label2.style.display = '';
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 4 hrs to fix
                src/widgets/widgets.crossRuler.js on lines 249..256

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

                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

                    hideDOM() {
                      this._line.style.display = 'none';
                      this._line2.style.display = 'none';
                      this._label.style.display = 'none';
                      this._label2.style.display = 'none';
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 4 hrs to fix
                src/widgets/widgets.crossRuler.js on lines 258..265

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

                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 (distanceData.units && distanceData2.units && distanceData.units === distanceData2.units) {
                        this._units = distanceData.units;
                      } else {
                        if (!distanceData.units) {
                          distanceData.units = this._units;
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 3 hrs to fix
                src/widgets/widgets.biruler.js on lines 298..307

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

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

                    removeEventListeners() {
                      this._line.removeEventListener('mouseenter', this.onHover);
                      this._line.removeEventListener('mouseleave', this.onHover);
                      this._line2.removeEventListener('mouseenter', this.onHover);
                      this._line2.removeEventListener('mouseleave', this.onHover);
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 9 other locations - About 3 hrs to fix
                src/widgets/widgets.crossRuler.js on lines 71..78
                src/widgets/widgets.peakVelocity.js on lines 65..72
                src/widgets/widgets.peakVelocity.js on lines 74..81
                src/widgets/widgets.pressureHalfTime.js on lines 78..85
                src/widgets/widgets.pressureHalfTime.js on lines 87..94
                src/widgets/widgets.rectangle.js on lines 68..75
                src/widgets/widgets.rectangle.js on lines 77..84
                src/widgets/widgets.ruler.js on lines 63..70
                src/widgets/widgets.ruler.js on lines 72..79

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

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

                    addEventListeners() {
                      this._line.addEventListener('mouseenter', this.onHover);
                      this._line.addEventListener('mouseleave', this.onHover);
                      this._line2.addEventListener('mouseenter', this.onHover);
                      this._line2.addEventListener('mouseleave', this.onHover);
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 9 other locations - About 3 hrs to fix
                src/widgets/widgets.crossRuler.js on lines 80..87
                src/widgets/widgets.peakVelocity.js on lines 65..72
                src/widgets/widgets.peakVelocity.js on lines 74..81
                src/widgets/widgets.pressureHalfTime.js on lines 78..85
                src/widgets/widgets.pressureHalfTime.js on lines 87..94
                src/widgets/widgets.rectangle.js on lines 68..75
                src/widgets/widgets.rectangle.js on lines 77..84
                src/widgets/widgets.ruler.js on lines 63..70
                src/widgets/widgets.ruler.js on lines 72..79

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

                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._hovered =
                        this._handles[0].hovered ||
                        this._handles[1].hovered ||
                        this._handles[2].hovered ||
                        this._handles[3].hovered ||
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 2 hrs to fix
                src/widgets/widgets.crossRuler.js on lines 118..123

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

                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._active =
                        this._handles[0].active ||
                        this._handles[1].active ||
                        this._handles[2].active ||
                        this._handles[3].active ||
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 2 hrs to fix
                src/widgets/widgets.crossRuler.js on lines 96..101

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

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

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

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

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

                Refactorings

                Further Reading

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

                      this._active =
                        this._handles[0].active ||
                        this._handles[1].active ||
                        this._handles[2].active ||
                        this._handles[3].active;
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 3 other locations - About 1 hr to fix
                src/widgets/widgets.biruler.js on lines 71..75
                src/widgets/widgets.biruler.js on lines 84..88
                src/widgets/widgets.biruler.js on lines 134..138

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

                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._handles[3].worldPosition.copy(
                        intersect.clone().sub(this._normal.clone().multiplyScalar(this._distances[3]))
                      );
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 1 hr to fix
                src/widgets/widgets.crossRuler.js on lines 475..477

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 65.

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

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

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

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

                Refactorings

                Further Reading

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

                      this._handles[2].worldPosition.copy(
                        intersect.clone().add(this._normal.clone().multiplyScalar(this._distances[2]))
                      );
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 1 hr to fix
                src/widgets/widgets.crossRuler.js on lines 478..480

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 65.

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

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

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

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

                Refactorings

                Further Reading

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

                      for (let i = 0; i < 4; i++) {
                        handle = new WidgetsHandle(targetMesh, controls, params);
                        this.add(handle);
                        this._handles.push(handle);
                      }
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 7 other locations - About 1 hr to fix
                src/widgets/widgets.angle.js on lines 43..47
                src/widgets/widgets.annotation.js on lines 49..53
                src/widgets/widgets.biruler.js on lines 44..48
                src/widgets/widgets.ellipse.js on lines 49..53
                src/widgets/widgets.pressureHalfTime.js on lines 58..62
                src/widgets/widgets.rectangle.js on lines 48..52
                src/widgets/widgets.ruler.js on lines 43..47

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

                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._handles[1].tracking &&
                        this._handles[0].screenPosition.distanceTo(this._handles[1].screenPosition) < 10
                      ) {
                        return;
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 1 hr to fix
                src/widgets/widgets.biruler.js on lines 101..106

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

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

                    set targetMesh(targetMesh) {
                      this._targetMesh = targetMesh;
                      this._handles.forEach(elem => (elem.targetMesh = targetMesh));
                      this.update();
                    }
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 7 other locations - About 1 hr to fix
                src/widgets/widgets.angle.js on lines 391..395
                src/widgets/widgets.annotation.js on lines 408..412
                src/widgets/widgets.biruler.js on lines 419..423
                src/widgets/widgets.ellipse.js on lines 458..462
                src/widgets/widgets.pressureHalfTime.js on lines 430..434
                src/widgets/widgets.rectangle.js on lines 421..425
                src/widgets/widgets.ruler.js on lines 343..347

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 57.

                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

                      const center = this._handles[1].worldPosition
                        .clone()
                        .add(this._handles[0].worldPosition)
                        .multiplyScalar(0.5);
                Severity: Minor
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 55 mins to fix
                src/widgets/widgets.biruler.js on lines 268..271

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

                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

                      lines[2] = this._handles[2].worldPosition.clone().sub(this._handles[0].worldPosition);
                Severity: Minor
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 45 mins to fix
                src/widgets/widgets.crossRuler.js on lines 490..490

                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

                      lines[3] = this._handles[3].worldPosition.clone().sub(this._handles[0].worldPosition);
                Severity: Minor
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 45 mins to fix
                src/widgets/widgets.crossRuler.js on lines 489..489

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

                      this._line2.style.transform = `translate3D(${line2Data.transformX}px, ${
                        line2Data.transformY
                      }px, 0)
                            rotate(${line2Data.transformAngle}rad)`;
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 10 other locations - About 40 mins to fix
                src/widgets/widgets.angle.js on lines 302..305
                src/widgets/widgets.angle.js on lines 314..317
                src/widgets/widgets.annotation.js on lines 304..307
                src/widgets/widgets.annotation.js on lines 338..341
                src/widgets/widgets.biruler.js on lines 245..248
                src/widgets/widgets.biruler.js on lines 257..260
                src/widgets/widgets.biruler.js on lines 277..280
                src/widgets/widgets.crossRuler.js on lines 299..302
                src/widgets/widgets.pressureHalfTime.js on lines 346..349
                src/widgets/widgets.ruler.js on lines 262..265

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 48.

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

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

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

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

                Refactorings

                Further Reading

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

                      this._line.style.transform = `translate3D(${lineData.transformX}px, ${
                        lineData.transformY
                      }px, 0)
                            rotate(${lineData.transformAngle}rad)`;
                Severity: Major
                Found in src/widgets/widgets.crossRuler.js and 10 other locations - About 40 mins to fix
                src/widgets/widgets.angle.js on lines 302..305
                src/widgets/widgets.angle.js on lines 314..317
                src/widgets/widgets.annotation.js on lines 304..307
                src/widgets/widgets.annotation.js on lines 338..341
                src/widgets/widgets.biruler.js on lines 245..248
                src/widgets/widgets.biruler.js on lines 257..260
                src/widgets/widgets.biruler.js on lines 277..280
                src/widgets/widgets.crossRuler.js on lines 311..314
                src/widgets/widgets.pressureHalfTime.js on lines 346..349
                src/widgets/widgets.ruler.js on lines 262..265

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 48.

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

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

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

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

                Refactorings

                Further Reading

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

                      const distanceData = this.getDistanceData(
                        this._handles[0].worldPosition,
                        this._handles[1].worldPosition,
                        this._calibrationFactor
                      );
                Severity: Minor
                Found in src/widgets/widgets.crossRuler.js and 2 other locations - About 35 mins to fix
                src/widgets/widgets.biruler.js on lines 284..288
                src/widgets/widgets.ruler.js on lines 224..228

                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

                      const distanceData2 = this.getDistanceData(
                        this._handles[2].worldPosition,
                        this._handles[3].worldPosition,
                        this._calibrationFactor
                      );
                Severity: Minor
                Found in src/widgets/widgets.crossRuler.js and 1 other location - About 30 mins to fix
                src/widgets/widgets.biruler.js on lines 289..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 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

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

                      if (this._domHovered && this._distances) {
                        this._moving = true;
                        this._controls.enabled = false;
                      }
                Severity: Minor
                Found in src/widgets/widgets.crossRuler.js and 2 other locations - About 30 mins to fix
                src/widgets/widgets.freehand.js on lines 112..115
                src/widgets/widgets.polygon.js on lines 120..123

                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