Showing 711 of 1,553 total issues

Function _initGfx has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _initGfx() {
    const gfx = {
      width: this._container.clientWidth,
      height: this._container.clientHeight
    }
Severity: Major
Found in packages/miew/src/Miew.ts - About 6 hrs to fix

    Function setColorVolTex has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) {
        let i
        let idx
        const numVerts = this._position.length / 3
        const vertices = this._position
    Severity: Major
    Found in packages/miew/src/gfx/geometries/IsoSurface.js - About 6 hrs to fix

      File MiewCLIHelp.js has 427 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // import palettes from '../gfx/palettes' // TODO actualy, does nothing
      // import settings from '../settings'
      
      const modeIdDesc = {
        $help: [
      Severity: Minor
      Found in packages/miew-cli/src/MiewCLIHelp.js - About 6 hrs to fix

        Function _innerBuild has 155 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _innerBuild() {
            let ok
            const expandFactor = 1.2
        
            // performance test
        Severity: Major
        Found in packages/miew/src/gfx/geometries/SSIsosurfaceGeometry.js - About 6 hrs to fix

          File ContactSurface.js has 421 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import utils from '../../utils'
          import { Vector3 } from 'three'
          
          /**
           * Modifed from SpatialHash
          Severity: Minor
          Found in packages/miew/src/gfx/geometries/ContactSurface.js - About 6 hrs to fix

            File CIFParser.js has 421 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import Parser from './Parser'
            import chem from '../../chem'
            import StructuralElement from '../../chem/StructuralElement'
            import readCIF from './readCIF'
            import { isArray, isString } from 'lodash'
            Severity: Minor
            Found in packages/miew/src/io/parsers/CIFParser.js - About 6 hrs to fix

              Function _buildSelectorFromSortedLists has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

                _buildSelectorFromSortedLists(atoms, residues, chains) {
                  const complex = this._complex
              
                  function optimizeList(list) {
                    const result = []
              Severity: Minor
              Found in packages/miew/src/ComplexVisual.js - About 6 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 ObjectControls has 152 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function ObjectControls(object, objectPivot, camera, domElement, getAltObj) {
                EventDispatcher.call(this)
                const self = this
              
                this.object = object
              Severity: Major
              Found in packages/miew/src/ui/ObjectControls.js - About 6 hrs to fix

                File settings.js has 417 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import utils from './utils'
                import EventDispatcher from './utils/EventDispatcher'
                import { isEmpty, isString, get, set, merge, cloneDeep, filter } from 'lodash'
                
                const VERSION = 0
                Severity: Minor
                Found in packages/miew/src/settings.js - About 6 hrs to fix

                  Function _initReprListItemListeners has 148 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Menu.prototype._initReprListItemListeners = function (index) {
                    const self = this
                    const reprList = $(
                      `${self._menuId} [data-panel-type=miew-menu-panel-representation] .miew-repr-list`
                    )
                  Severity: Major
                  Found in demo/src/scripts/ui/Menu.js - About 5 hrs to fix

                    Function buildGeoFromCorners has a Cognitive Complexity of 39 (exceeds 5 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: Minor
                    Found in packages/miew/src/gfx/geometries/SSIsosurfaceGeometry.js - About 5 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 _initOnSettingsChanged has 146 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _initOnSettingsChanged() {
                        const on = (props, func) => {
                          props = isArray(props) ? props : [props]
                          props.forEach((prop) => {
                            this.settings.addEventListener(`change:${prop}`, func)
                    Severity: Major
                    Found in packages/miew/src/Miew.ts - About 5 hrs to fix

                      Function setColorVolTex has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                      Open

                        setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) {
                          let i
                          let idx
                          const numVerts = this._position.length / 3
                          const vertices = this._position
                      Severity: Minor
                      Found in packages/miew/src/gfx/geometries/IsoSurface.js - About 5 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 options.js has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import settings from './settings'
                      import utils from './utils'
                      import logger from './utils/logger'
                      import { isString, set, get, isArray, isEmpty } from 'lodash'
                      
                      
                      Severity: Minor
                      Found in packages/miew/src/options.js - About 5 hrs to fix

                        Function _updateReprList has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        Menu.prototype._updateReprList = function () {
                          const self = this
                        
                          function _createOptionsFromMVData(index, property, element, itemId) {
                            const curRep = self._viewer.repGet(index)
                        Severity: Major
                        Found in demo/src/scripts/ui/Menu.js - About 5 hrs to fix

                          Function createVoxels has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                          Open

                            createVoxels() {
                              let numAtomsRefs
                              let rad
                              const ATOM_VOXEL_REF_SCALE = 4.5
                          
                          
                          Severity: Minor
                          Found in packages/miew/src/gfx/geometries/IsosurfaceBuildNormals.js - About 5 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 Smooth.js has 398 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /*
                          Smooth.js version 0.1.7
                          
                          Turn arrays into smooth functions.
                          
                          
                          Severity: Minor
                          Found in packages/miew/src/vendors/Smooth.js - About 5 hrs to fix

                            File MMTFParser.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import Parser from './Parser'
                            import chem from '../../chem'
                            import MMTF from '../../vendors/mmtf'
                            import StructuralElement from '../../chem/StructuralElement'
                            import { isArrayBuffer, isUndefined } from 'lodash'
                            Severity: Minor
                            Found in packages/miew/src/io/parsers/MMTFParser.js - About 5 hrs to fix

                              File gfxutils.js has 394 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /* eslint-disable no-magic-numbers */
                              
                              import logger from '../utils/logger'
                              import CSS2DObject from './CSS2DObject'
                              import RCGroup from './RCGroup'
                              Severity: Minor
                              Found in packages/miew/src/gfx/gfxutils.js - About 5 hrs to fix

                                Function parse has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    parse: function parse(input) {
                                      var self = this,
                                          stack = [0],
                                          tstack = [],
                                          vstack = [null],
                                Severity: Major
                                Found in packages/miew-cli/dist/index.js - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language