src/widgets/widgets.voxelProbe.js

Summary

Maintainability
F
3 days
Test Coverage

Function widgetsVoxelprobe has 196 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Major
Found in src/widgets/widgets.voxelProbe.js - About 7 hrs to fix

    Function widgetsVoxelprobe has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    const widgetsVoxelprobe = (three = window.THREE) => {
      if (three === undefined || three.Object3D === undefined) {
        return null;
      }
    
    
    Severity: Minor
    Found in src/widgets/widgets.voxelProbe.js - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        createDOM() {
          this._label = document.createElement('div');
          this._label.className = 'widgets-label';
    
          // measurements
    Severity: Major
    Found in src/widgets/widgets.voxelProbe.js and 1 other location - About 1 day to fix
    src/widgets/widgets.freehand.js on lines 224..248

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

    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

        onHover(evt) {
          if (evt) {
            this.hoverDom(evt);
          }
    
    
    Severity: Major
    Found in src/widgets/widgets.voxelProbe.js and 1 other location - About 2 hrs to fix
    src/widgets/widgets.peakVelocity.js on lines 83..90

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 83.

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

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

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

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

    Refactorings

    Further Reading

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

        set worldPosition(worldPosition) {
          this._handle.worldPosition.copy(worldPosition);
          this._moveHandle.worldPosition.copy(worldPosition);
          this._worldPosition.copy(worldPosition);
          this.update();
    Severity: Major
    Found in src/widgets/widgets.voxelProbe.js and 1 other location - About 1 hr to fix
    src/widgets/widgets.peakVelocity.js on lines 279..284

    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

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

          if (!this._dragged && this._active && this._initialized) {
            this._selected = !this._selected; // change state if there was no dragging
            this._handle.selected = this._selected;
          }
    Severity: Major
    Found in src/widgets/widgets.voxelProbe.js and 1 other location - About 1 hr to fix
    src/widgets/widgets.peakVelocity.js on lines 138..141

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 69.

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

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

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

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

    Refactorings

    Further Reading

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

        addEventListeners() {
          this._label.addEventListener('mouseenter', this.onHover);
          this._label.addEventListener('mouseleave', this.onHover);
    
          this._container.addEventListener('wheel', this.onMove);
    Severity: Major
    Found in src/widgets/widgets.voxelProbe.js and 5 other locations - About 1 hr to fix
    src/widgets/widgets.freehand.js on lines 64..69
    src/widgets/widgets.freehand.js on lines 71..76
    src/widgets/widgets.velocityTimeIntegral.js on lines 76..81
    src/widgets/widgets.velocityTimeIntegral.js on lines 83..88
    src/widgets/widgets.voxelProbe.js on lines 58..63

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

    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

        removeEventListeners() {
          this._label.removeEventListener('mouseenter', this.onHover);
          this._label.removeEventListener('mouseleave', this.onHover);
    
          this._container.removeEventListener('wheel', this.onMove);
    Severity: Major
    Found in src/widgets/widgets.voxelProbe.js and 5 other locations - About 1 hr to fix
    src/widgets/widgets.freehand.js on lines 64..69
    src/widgets/widgets.freehand.js on lines 71..76
    src/widgets/widgets.velocityTimeIntegral.js on lines 76..81
    src/widgets/widgets.velocityTimeIntegral.js on lines 83..88
    src/widgets/widgets.voxelProbe.js on lines 51..56

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

    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

        set targetMesh(targetMesh) {
          this._targetMesh = targetMesh;
          this._handle.targetMesh = targetMesh;
          this._moveHandle.targetMesh = targetMesh;
          this.update();
    Severity: Major
    Found in src/widgets/widgets.voxelProbe.js and 1 other location - About 1 hr to fix
    src/widgets/widgets.peakVelocity.js on lines 268..273

    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

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

        set active(active) {
          this._active = active;
          this._controls.enabled = !this._active;
    
          this.update();
    Severity: Minor
    Found in src/widgets/widgets.voxelProbe.js and 1 other location - About 50 mins to fix
    src/widgets/widgets.peakVelocity.js on lines 290..295

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 51.

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

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

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

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

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status