Showing 711 of 1,553 total issues

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

  updateToFrame(frameData) {
    // This method looks like a copy paste. However, it
    // was decided to postpone animation refactoring until GFX is fixed.
    const bondsIdc = this._selection.chunks
    const { bonds } = this._selection
Severity: Minor
Found in packages/miew/src/gfx/modes/groups/BondsLinesGroup.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 _findPairs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  _findPairs() {
    const vw = this._complex.getVoxelWorld()
    if (vw === null) {
      return
    }
Severity: Minor
Found in packages/miew/src/chem/AutoBond.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 toURL has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function toURL(opts) {
  const stringList = []
  let idx = 0

  function checkAndAdd(prefix, value) {
Severity: Minor
Found in packages/miew/src/options.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 writeString has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  writeString(string, begin, end) {
    let curStr = this._resultArray[this._currentStr]
    let str

    const curStrLength = curStr ? curStr.length : 0
Severity: Minor
Found in packages/miew/src/io/exporters/PDBResult.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 updateBinaryMode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function updateBinaryMode(opts) {
  let { binary } = opts

  // detect by format
  if (opts.fileType !== undefined) {
Severity: Minor
Found in packages/miew/src/Miew.ts - 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 _extractAtoms has a Cognitive Complexity of 15 (exceeds 5 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: Minor
Found in packages/miew/src/io/parsers/CIFParser.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 _buildInner has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _buildInner(radOffset, addChunk) {
    const chunksToIdx = this._selection.chunks

    const prevVector = new Vector3()
    const currVector = new Vector3()
Severity: Minor
Found in packages/miew/src/gfx/modes/groups/AromaticGroup.js - About 1 hr to fix

    Function _parseAtoms has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _parseAtoms(atomsNum, MOL2Data) {
        this._toHeaderString('ATOM', MOL2Data)
    
        for (let i = 0; i < atomsNum; i++) {
          const parsedStr = splitToFields(MOL2Data[++this._currPosIdx])
    Severity: Minor
    Found in packages/miew/src/io/parsers/MOL2Parser.js - About 1 hr to fix

      Function buildColors has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        buildColors(numVertices, vertices, colors, radiusColorSmoothness) {
          const self = this
          let vx = 0.0
          let vy = 0.0
          let vz = 0.0
      Severity: Minor
      Found in packages/miew/src/gfx/geometries/IsosurfaceBuildNormals.js - About 1 hr to fix

        Function equalOptions has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function equalOptions(original, generated) {
              function compareAllExceptReps(one, another) {
                const origKeys = Object.keys(one)
        
                let i
        Severity: Minor
        Found in packages/miew/src/options.test.js - About 1 hr to fix

          Function _finalize has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _finalize() {
              const self = this
              ;[this._firstAtom] = this._atoms
              this._lastAtom = this._atoms[this._atoms.length - 1]
          
          
          Severity: Minor
          Found in packages/miew/src/chem/Residue.js - About 1 hr to fix

            Function pickObject has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Picker.prototype.pickObject = function (screenPos) {
              if (!this.gfxObj) {
                this.picked = {}
                this.dispatchEvent({ type: 'newpick', obj: {} })
                return
            Severity: Minor
            Found in packages/miew/src/ui/Picker.js - About 1 hr to fix

              Function _forEachAtomWithinDistFromGroup has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) {
                  const self = this
                  const r2 = dist * dist
              
                  const voxels = []
              Severity: Minor
              Found in packages/miew/src/chem/VoxelWorld.js - About 1 hr to fix

                Function anonymous has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    performAction: function anonymous(
                      yytext,
                      yyleng,
                      yylineno,
                      yy,
                Severity: Minor
                Found in packages/miew/src/utils/SelectionParser.js - About 1 hr to fix

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

                    _extractAtoms(complex, complexData) {
                      let aids = complexData.atoms && complexData.atoms.aid
                      let elements = aids && complexData.atoms.element
                      if (!elements || aids.length !== elements.length) {
                        throw new Error('Unable to parse atom elements')
                  Severity: Minor
                  Found in packages/miew/src/io/parsers/PubChemParser.js - About 1 hr to fix

                    Function _onPick has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _onPick(event) {
                        if (!settings.now.picking) {
                          // picking is disabled
                          return
                        }
                    Severity: Minor
                    Found in packages/miew/src/Miew.ts - About 1 hr to fix

                      Function getState has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        getState(opts) {
                          const state = {}
                      
                          opts = defaults(opts, {
                            compact: true,
                      Severity: Minor
                      Found in packages/miew/src/Miew.ts - About 1 hr to fix

                        Function checkArg has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          checkArg(key, arg, modificate) {
                            if (key !== undefined && arg !== undefined) {
                              if (keyRemap(key) === 'selector') {
                                const res = selectors.parse(arg)
                        
                        
                        Severity: Minor
                        Found in packages/miew-cli/src/Miew-cli.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 deriveDeep has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function deriveDeep(obj, needZeroOwnProperties) {
                          var res = obj;
                          var i;
                          var n;
                          if (obj instanceof Array) {
                        Severity: Minor
                        Found in packages/miew-cli/dist/index.modern.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 deriveDeep has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function deriveDeep(obj, needZeroOwnProperties) {
                          var res = obj;
                          var i;
                          var n;
                          if (obj instanceof Array) {
                        Severity: Minor
                        Found in packages/miew-cli/dist/index.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

                        Severity
                        Category
                        Status
                        Source
                        Language