src/models/models.frame.js

Summary

Maintainability
D
2 days
Test Coverage

ModelsFrame has 71 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class ModelsFrame extends ModelsBase {
  /**
   * Constructor
   */
  constructor() {
Severity: Major
Found in src/models/models.frame.js - About 1 day to fix

    File models.frame.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /** * Imports ***/
    import ModelsBase from '../models/models.base';
    
    import { Vector3 } from 'three/src/math/Vector3';
    
    
    Severity: Minor
    Found in src/models/models.frame.js - About 5 hrs to fix

      Function _frameToCanvas has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        _frameToCanvas() {
          const dimension = this._columns * this._rows;
      
          const params = {
            invert: this._invert,
      Severity: Minor
      Found in src/models/models.frame.js - About 1 hr 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 _frameToCanvas has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _frameToCanvas() {
          const dimension = this._columns * this._rows;
      
          const params = {
            invert: this._invert,
      Severity: Minor
      Found in src/models/models.frame.js - About 1 hr to fix

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

          constructor() {
            super();
        
            this._sopInstanceUID = null;
            this._url = null;
        Severity: Minor
        Found in src/models/models.frame.js - About 1 hr to fix

          Function cosines has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            cosines() {
              let cosines = [new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)];
          
              if (this._imageOrientation && this._imageOrientation.length === 6) {
                let xCos = new Vector3(
          Severity: Minor
          Found in src/models/models.frame.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                if (
                  !(
                    super.validate(model) &&
                    typeof model.cosines === 'function' &&
                    typeof model.spacingXY === 'function' &&
            Severity: Major
            Found in src/models/models.frame.js - About 1 hr to fix

              Function _pixelTo8Bit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                _pixelTo8Bit(value, params) {
                  // values equal to pixelPaddingValue are outside of the image and should be ignored
                  let packedValue = value <= params.min || value === params.padding ? 0 : 255;
              
                  if (value > params.min && value < params.max) {
              Severity: Minor
              Found in src/models/models.frame.js - About 25 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

              There are no issues that match your filters.

              Category
              Status