Showing 711 of 1,553 total issues

Function setValues has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 4 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 mousedown has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

ObjectControls.prototype.mousedown = function (event) {
  if (this.enabled === false || this._state !== STATE.NONE) {
    return
  }

Severity: Minor
Found in packages/miew/src/ui/ObjectControls.js - About 4 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 _findSuitableMolecule has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  _findSuitableMolecule(data, molSet) {
    for (const key in data) {
      if (key === 'xmlNode') {
        continue
      } else if (key === 'molecule') {
Severity: Minor
Found in packages/miew/src/io/parsers/CMLParser.js - About 4 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 _renderScene has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  _renderScene(camera, distortion, target) {
    distortion = distortion || false
    target = target || null

    const gfx = this._gfx
Severity: Minor
Found in packages/miew/src/Miew.ts - About 4 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 _presetsPanelActionsPdbInputsRefresh has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Menu.prototype._presetsPanelActionsPdbInputsRefresh = function (self) {
  const loadPdbButton = $(
    `${self._menuId} .presets-panel-action[data-presets-panel-action=pdb-load]`
  )
  const clearInputsButton = $(
Severity: Major
Found in demo/src/scripts/ui/Menu.js - About 4 hrs to fix

    Function _renderScene has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _renderScene(camera, distortion, target) {
        distortion = distortion || false
        target = target || null
    
        const gfx = this._gfx
    Severity: Major
    Found in packages/miew/src/Miew.ts - About 4 hrs to fix

      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 _initToolbar has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Menu.prototype._initToolbar = function () {
          const self = this
        
          const frag = document.createDocumentFragment()
          let newItem
        Severity: Major
        Found in demo/src/scripts/ui/Menu.js - About 3 hrs to fix

          Function init has 97 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            init() {
              const container = this._container
              const elem = utils.createElement('div', { class: 'miew-canvas' })
              _setContainerContents(container, elem)
              this._container = elem
          Severity: Major
          Found in packages/miew/src/Miew.ts - About 3 hrs to fix

            File UberMaterial.js has 325 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable no-magic-numbers */
            /* eslint-disable guard-for-in */
            
            import vertexShader from './Uber.vert'
            import fragmentShader from './Uber.frag'
            Severity: Minor
            Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 3 hrs to fix

              File SDFParser.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import Parser from './Parser'
              import chem from '../../chem'
              import SDFStream from './SDFStream'
              import Assembly from '../../chem/Assembly'
              import { Matrix4, Vector3 } from 'three'
              Severity: Minor
              Found in packages/miew/src/io/parsers/SDFParser.js - About 3 hrs to fix

                Function _init has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                Menu.prototype._init = function () {
                  const self = this
                  let selectorHide = null
                  let selectorShow = null
                  let newPanelId = null
                Severity: Minor
                Found in demo/src/scripts/ui/Menu.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 _initToolsPanel has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Menu.prototype._initToolsPanel = function () {
                  const self = this
                  $(
                    `${self._menuId} .miew-menu-modals [data-modal-type=miew-menu-modal-url]`
                  ).on('shown.bs.modal', () => {
                Severity: Major
                Found in demo/src/scripts/ui/Menu.js - About 3 hrs to fix

                  Function _initializeTerminal has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Menu.prototype._initializeTerminal = function () {
                    const self = this
                    let res = null
                    let urlSubString = ''
                    const element = $(
                  Severity: Major
                  Found in demo/src/scripts/ui/Menu.js - About 3 hrs to fix

                    Function _initReprPanel has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function AVHash has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function AVHash(posRad, min, max, maxDistance) {
                        const itemSize = 4
                        const nAtoms = posRad.length / itemSize
                      
                        const minX = min[0]
                      Severity: Major
                      Found in packages/miew/src/gfx/geometries/ContactSurface.js - About 3 hrs to fix

                        Function _extractSGroups has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _extractSGroups(molecule, atoms) {
                            const moleculeArr = this._extractSGroup(molecule)
                        
                            const count = atoms.length
                            let i
                        Severity: Minor
                        Found in packages/miew/src/io/parsers/CMLParser.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 _onLoad has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _onLoad(dataSource, opts) {
                            const gfx = this._gfx
                            let visualName = null
                        
                            if (opts.animation) {
                        Severity: Minor
                        Found in packages/miew/src/Miew.ts - 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 ComplexVisualEdit.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import logger from './utils/logger'
                        import gfxutils from './gfx/gfxutils'
                        import './gfx/modes'
                        import { Group, Matrix4, Object3D, Vector3 } from 'three'
                        
                        
                        Severity: Minor
                        Found in packages/miew/src/ComplexVisualEdit.js - About 3 hrs to fix

                          Function updateSelectionMask has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            updateSelectionMask(pickedObj) {
                              const self = this
                              const { atom } = pickedObj
                              let { residue, chain, molecule } = pickedObj
                              const setMask = 1 << this._selectionBit
                          Severity: Major
                          Found in packages/miew/src/ComplexVisual.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language