Showing 711 of 1,553 total issues

Function setValues has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  setValues(values) {
    if (typeof values === 'undefined') {
      return
    }

Severity: Major
Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 3 hrs to fix

    Function finalize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      finalize(opts) {
        opts = opts || {}
        // Put bonds into atoms
        const bonds = this._bonds
        let i
    Severity: Minor
    Found in packages/miew/src/chem/Complex.js - About 3 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 prepareComponentCompound has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function prepareComponentCompound(data) {
          let atoms = []
          if (
            data.molecule &&
            data.molecule.atomArray &&
    Severity: Major
    Found in packages/miew/src/io/parsers/CMLParser.js - About 3 hrs to fix

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

        constructor(opts: MiewOptions) {
          super()
          this._opts = merge(
            {
              settingsCookie: 'settings',
      Severity: Major
      Found in packages/miew/src/Miew.ts - About 3 hrs to fix

        Function H has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function H(r) {
            function t(r) {
              for (var t = {}, n = 0; r > n; n++) {
                var e = o()
                t[e] = o()
        Severity: Major
        Found in packages/miew/src/vendors/mmtf.js - About 3 hrs to fix

          Function finalize has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            finalize(opts) {
              opts = opts || {}
              // Put bonds into atoms
              const bonds = this._bonds
              let i
          Severity: Major
          Found in packages/miew/src/chem/Complex.js - About 3 hrs to fix

            Function _extractAtoms has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _extractAtoms(complex, complexData) {
                const atomData = complexData.atom_site
                if (!atomData) {
                  throw new AtomDataError('CIF parsing error: atom_site is not specified!')
                }
            Severity: Major
            Found in packages/miew/src/io/parsers/CIFParser.js - About 3 hrs to fix

              Function _calcHBondEnergy has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _calcHBondEnergy(predonor, donor, acceptor) {
                  let result = 0
              
                  if (predonor === null) {
                    return result
              Severity: Major
              Found in packages/miew/src/chem/HBondInfo.js - About 3 hrs to fix

                Function propagateProp has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  propagateProp(path, arg) {
                    if (path !== undefined) {
                      let argExc = {}
                      const adapter = options.adapters[typeof get(settings.defaults, path)]
                      if (adapter === undefined) {
                Severity: Minor
                Found in packages/miew-cli/src/Miew-cli.js - About 3 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 gaussdensity has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  gaussdensity(surface, packedArrays, atomicNum, params) {
                    const numAtoms = packedArrays.posRad.length / 4
                    const { posRad, colors } = packedArrays
                    const { numVoxels } = this
                    const { radScale, gaussLim, gridSpacing } = params
                Severity: Minor
                Found in packages/miew/src/gfx/geometries/QuickSurfGeometry.js - About 3 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 _buildVW has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  _buildVW() {
                    const self = this
                    const residues = this._complex._residues
                    let ri
                    let preri
                Severity: Minor
                Found in packages/miew/src/chem/HBondInfo.js - About 3 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

                File FBXInfoExtractor.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import utils from '../../../utils'
                import gfxutils from '../../../gfx/gfxutils'
                import logger from '../../../utils/logger'
                
                import FBXModel from './FBXModel'
                Severity: Minor
                Found in packages/miew/src/io/exporters/fbx/FBXInfoExtractor.js - About 3 hrs to fix

                  Function buildGeoFromCorners has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) {
                      const arrSize = 12
                      const cNumVerts = 8
                      const numCells = meshRes - 1
                      const side = meshRes
                  Severity: Major
                  Found in packages/miew/src/gfx/geometries/SSIsosurfaceGeometry.js - About 3 hrs to fix

                    Function default has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function (webVRPoC) {
                      function showEnterVR(button) {
                        button.style.display = ''
                        button.style.cursor = 'pointer'
                        button.style.left = 'calc(50% - 50px)'
                    Severity: Major
                    Found in packages/miew/src/gfx/vr/createWebVRButton.js - About 3 hrs to fix

                      Function _updateInfo has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Menu.prototype._updateInfo = function (dataSource) {
                        if (dataSource && dataSource.id !== 'Complex') {
                          return
                        }
                        const complex = dataSource
                      Severity: Major
                      Found in demo/src/scripts/ui/Menu.js - About 3 hrs to fix

                        Function _extractSGroups has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _extractSGroups(molecule, atoms) {
                            const moleculeArr = this._extractSGroup(molecule)
                        
                            const count = atoms.length
                            let i
                        Severity: Major
                        Found in packages/miew/src/io/parsers/CMLParser.js - About 3 hrs to fix

                          Function _onLoad has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            _onLoad(dataSource, opts) {
                              const gfx = this._gfx
                              let visualName = null
                          
                              if (opts.animation) {
                          Severity: Major
                          Found in packages/miew/src/Miew.ts - About 3 hrs to fix

                            File VoxelWorld.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import utils from '../utils'
                            import { Vector2, Vector3 } from 'three'
                            
                            /**
                             * Calculate min & max radius of a sphere slice between zMin & zMax
                            Severity: Minor
                            Found in packages/miew/src/chem/VoxelWorld.js - About 3 hrs to fix

                              Function calculateGridCorners has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                              Open

                                calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) {
                                  const side2 = side * side
                                  const side3 = side2 * side
                                  const vCorner = new Vector3()
                                  const vDif = new Vector3()
                              Severity: Minor
                              Found in packages/miew/src/gfx/geometries/SSIsosurfaceGeometry.js - About 3 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 buildTiledTexture has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                              Open

                                buildTiledTexture() {
                                  let tilesX = Math.ceil(Math.sqrt((this._dimZ * this._dimY) / this._dimX))
                              
                                  let width = tilesX * (this._dimX + 2) - 1
                                  width = pow2ceil(width)
                              Severity: Minor
                              Found in packages/miew/src/chem/Volume.js - About 3 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

                              Severity
                              Category
                              Status
                              Source
                              Language