packages/miew/src/gfx/VolumeMesh.js

Summary

Maintainability
F
3 days
Test Coverage

Function _updateVertices has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

  _updateVertices() {
    // Algorithm:
    // 1. Get plane parameters
    // 2. Compute culling flags for all vertices
    // 3. If intersection occurs => compute from 3 to 6 intersection points
Severity: Minor
Found in packages/miew/src/gfx/VolumeMesh.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 VolumeMesh.js has 368 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import VolumeMaterial from './shaders/VolumeMaterial'
import settings from '../settings'
import {
  BufferAttribute,
  BufferGeometry,
Severity: Minor
Found in packages/miew/src/gfx/VolumeMesh.js - About 4 hrs to fix

    Function _updateVertices has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _updateVertices() {
        // Algorithm:
        // 1. Get plane parameters
        // 2. Compute culling flags for all vertices
        // 3. If intersection occurs => compute from 3 to 6 intersection points
    Severity: Major
    Found in packages/miew/src/gfx/VolumeMesh.js - About 4 hrs to fix

      Function _updateIndices has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        _updateIndices() {
          // Algorithm:
          // 1. Get plane vertices (from 3 to 6 vertices)
          // 2. Get "right" vector in plane
          // 3. Sort vertices using Graham-like method
      Severity: Minor
      Found in packages/miew/src/gfx/VolumeMesh.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

      Function _updateIndices has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _updateIndices() {
          // Algorithm:
          // 1. Get plane vertices (from 3 to 6 vertices)
          // 2. Get "right" vector in plane
          // 3. Sort vertices using Graham-like method
      Severity: Major
      Found in packages/miew/src/gfx/VolumeMesh.js - About 2 hrs to fix

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

          constructor() {
            const geo = new BufferGeometry()
            super(geo)
            this.clipPlane = new Plane()
            const size = new Vector3(0.5, 0.5, 0.5)
        Severity: Major
        Found in packages/miew/src/gfx/VolumeMesh.js - About 2 hrs to fix

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

            _sortIndices(face, right) {
              let i
              let j
              const vert = this.vertices
              const angle = []
          Severity: Minor
          Found in packages/miew/src/gfx/VolumeMesh.js - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Avoid too many return statements within this function.
          Open

                return 0
          Severity: Major
          Found in packages/miew/src/gfx/VolumeMesh.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return 0
            Severity: Major
            Found in packages/miew/src/gfx/VolumeMesh.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return 0
              Severity: Major
              Found in packages/miew/src/gfx/VolumeMesh.js - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status