Showing 711 of 1,553 total issues

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

  change(repSettings, complex, mode, color) {
    const diff = {}

    // modify selector
    if (repSettings.selector) {
Severity: Minor
Found in packages/miew/src/gfx/Representation.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 _extractAtoms has a Cognitive Complexity of 12 (exceeds 5 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

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 _finalize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  _finalize(serialAtomMap, residueHash, complex) {
    if (this.init instanceof Residue && this.term instanceof Residue) {
      return
    }

Severity: Minor
Found in packages/miew/src/chem/StructuralElement.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 _updateSecStructure has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  _updateSecStructure(complex, residue, groupData) {
    const helixClasses = [3, -1, 1, -1, 5]

    if (!isUndefined(groupData) && groupData.secStruct === this._ssType) {
      residue._secondary = this._ssStruct
Severity: Minor
Found in packages/miew/src/io/parsers/MMTFParser.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 _updateInfoPanel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  _updateInfoPanel() {
    const info = this._msgAtomInfo.getElementsByTagName('p')[0]
    let atom
    let residue

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 _getAltObj has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  _getAltObj() {
    if (this._editors) {
      let altObj = null
      for (let i = 0; i < this._editors.length; ++i) {
        const nextAltObj = this._editors[i].getAltObj()
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 _fillSourceList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Menu.prototype._fillSourceList = function () {
  const self = this
  const names = this._viewer.getVisuals()
  $('#miew-source-dropdown').toggle(names.length > 1)

Severity: Minor
Found in demo/src/scripts/ui/Menu.js - About 1 hr to fix

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

      constructor(params) {
        super()
        // add fog
        this.fog = true
        // used for instanced geometry
    Severity: Minor
    Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 1 hr to fix

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

        constructor(
          BondsGroup,
          geoParams,
          complex,
          colorer,
      Severity: Minor
      Found in packages/miew/src/gfx/modes/processors/BondsProcessor.js - About 1 hr to fix

        Function _writeRelations has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _writeRelations() {
            let modelsList = ''
            for (let i = 0; i < this._info.models.length; ++i) {
              modelsList += `
          Model: "Model::${this._info.name}_${i}", "Mesh" {
        Severity: Minor
        Found in packages/miew/src/io/exporters/fbx/FBXResult.js - About 1 hr to fix

          Function _continueAnimation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _continueAnimation() {
              this._isAnimating = true
              let minFrameTime = 1000 / settings.now.maxfps
              minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime
              const self = this
          Severity: Minor
          Found in packages/miew/src/Miew.ts - About 1 hr to fix

            Function checkArg has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                value: function checkArg(key, arg, modificate) {
                  if (key !== undefined && arg !== undefined) {
                    if (keyRemap(key) === 'selector') {
                      var res = selectors.parse(arg);
                      if (res.error !== undefined) {
            Severity: Minor
            Found in packages/miew-cli/dist/index.js - About 1 hr to fix

              Function checkArg has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  value: function checkArg(key, arg, modificate) {
                    if (key !== undefined && arg !== undefined) {
                      if (keyRemap(key) === 'selector') {
                        var res = selectors.parse(arg);
                        if (res.error !== undefined) {
              Severity: Minor
              Found in packages/miew-cli/dist/index.modern.js - About 1 hr to fix

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

                  constructor(
                    AtomsGroup,
                    geoParams,
                    complex,
                    colorer,
                Severity: Minor
                Found in packages/miew/src/gfx/modes/processors/AtomsProcessor.js - About 1 hr to fix

                  Function getBoundingBox has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    getBoundingBox(atoms, vBoxMin, vBoxMax) {
                      const bigNum = 10000000.0
                  
                      vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum
                      vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum
                  Severity: Minor
                  Found in packages/miew/src/gfx/geometries/SSIsosurfaceGeometry.js - About 1 hr to fix

                    Function _countNormalsInRing has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) {
                        const tmpShape = this._tmpShape
                        const normals = this._normals
                    
                        tmpShape[0].fromArray(this._positions, vtxIdx)
                    Severity: Minor
                    Found in packages/miew/src/gfx/geometries/ExtrudedObjectsGeometry.js - About 1 hr to fix

                      Function update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      ObjectHandler.prototype.update = (function () {
                        const axis = new Vector3()
                      
                        return function (timeSinceLastUpdate, timeSinceMove) {
                          if (settings.now.autoRotation !== 0.0) {
                      Severity: Minor
                      Found in packages/miew/src/ui/ObjectControls.js - About 1 hr to fix

                        Function _build has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _build() {
                            const self = this
                        
                            for (let i = 0; i < this._complex._residues.length - 1; ++i) {
                              const ri = this._complex._residues[i]
                        Severity: Minor
                        Found in packages/miew/src/chem/HBondInfo.js - About 1 hr to fix

                          Function _fixDir has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            _fixDir(refPoint, currDir, posGetter) {
                              // count atoms to the right and to the left of the current plane
                              let rightCount = 0
                              let leftCount = 0
                              const tmpVec = refPoint.clone()
                          Severity: Minor
                          Found in packages/miew/src/chem/Bond.js - About 1 hr to fix

                            Function _flattenModels has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _flattenModels() {
                                let overallVertsCount = 0
                                function shift(x) {
                                  return x + overallVertsCount
                                }
                            Severity: Minor
                            Found in packages/miew/src/io/exporters/fbx/FBXInfoExtractor.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language