packages/miew/src/gfx/FrameInfo.js

Summary

Maintainability
D
2 days
Test Coverage

File FrameInfo.js has 332 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import SecondaryStructureColorer from './colorers/SecondaryStructureColorer'
import { Vector3 } from 'three'

const cDataOffset = 12
const cFirstMask = 0x0fffff00
Severity: Minor
Found in packages/miew/src/gfx/FrameInfo.js - About 4 hrs to fix

    Function parseBinaryData has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      parseBinaryData(arrayBuffer) {
        const dataView = new DataView(arrayBuffer)
        let offset = 0
        const atomsCount = dataView.getUint32(offset, true)
        offset += 4
    Severity: Major
    Found in packages/miew/src/gfx/FrameInfo.js - About 2 hrs to fix

      Function _prepareBuffer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        _prepareBuffer(framesStart, framesEnd) {
          if (framesStart === undefined || framesStart === null) {
            framesStart = 0
          }
          if (framesEnd === undefined || framesEnd === null) {
      Severity: Minor
      Found in packages/miew/src/gfx/FrameInfo.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 _prepareBuffer has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _prepareBuffer(framesStart, framesEnd) {
          if (framesStart === undefined || framesStart === null) {
            framesStart = 0
          }
          if (framesEnd === undefined || framesEnd === null) {
      Severity: Major
      Found in packages/miew/src/gfx/FrameInfo.js - About 2 hrs to fix

        Function parseBinaryData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          parseBinaryData(arrayBuffer) {
            const dataView = new DataView(arrayBuffer)
            let offset = 0
            const atomsCount = dataView.getUint32(offset, true)
            offset += 4
        Severity: Minor
        Found in packages/miew/src/gfx/FrameInfo.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 setFrame has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          setFrame(frameIdx) {
            this.frameIsReady = false
            if (
              frameIdx >= this._framesRange.start &&
              frameIdx <= this._framesRange.end
        Severity: Minor
        Found in packages/miew/src/gfx/FrameInfo.js - About 1 hr to fix

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

          function _createSecondary(strArray, complex) {
            const residues = complex._residues
            const nRes = residues.length
            const resid = new Uint8Array(nRes)
          
          
          Severity: Minor
          Found in packages/miew/src/gfx/FrameInfo.js - About 1 hr to fix

            Function _createSecondary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function _createSecondary(strArray, complex) {
              const residues = complex._residues
              const nRes = residues.length
              const resid = new Uint8Array(nRes)
            
            
            Severity: Minor
            Found in packages/miew/src/gfx/FrameInfo.js - About 45 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

            Function setFrame has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              setFrame(frameIdx) {
                this.frameIsReady = false
                if (
                  frameIdx >= this._framesRange.start &&
                  frameIdx <= this._framesRange.end
            Severity: Minor
            Found in packages/miew/src/gfx/FrameInfo.js - About 45 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