Showing 711 of 1,553 total issues

Function calcNormalDir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  calcNormalDir(posGetter) {
    const left = this._left
    const right = this._right
    let first = left
    let second = right
Severity: Minor
Found in packages/miew/src/chem/Bond.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 _fillCmpNoedit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  _fillCmpNoedit() {
    const comp = new Component(this)
    comp._index = 0

    const residues = this._residues
Severity: Minor
Found in packages/miew/src/chem/Complex.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 _compareReps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  _compareReps(complexVisual, compareWithDefaults) {
    const ans = {}
    let repCount = 0

    if (complexVisual) {
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 setOptions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  setOptions(opts) {
    if (typeof opts === 'string') {
      opts = Miew.options.fromAttr(opts)
    }
    if (opts.reps) {
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 wrapNativeSuper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var wrapNativeSuper = createCommonjsModule(function (module) {
function _wrapNativeSuper(Class) {
  var _cache = typeof Map === "function" ? new Map() : undefined;
  module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
    if (Class === null || !isNativeFunction(Class)) return Class;
Severity: Minor
Found in packages/miew-cli/dist/index.js - About 1 hr to fix

    Function wrapNativeSuper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var wrapNativeSuper = createCommonjsModule(function (module) {
    function _wrapNativeSuper(Class) {
      var _cache = typeof Map === "function" ? new Map() : undefined;
      module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
        if (Class === null || !isNativeFunction(Class)) return Class;
    Severity: Minor
    Found in packages/miew-cli/dist/index.modern.js - About 1 hr to fix

      Function _computeSurface has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _computeSurface(packedArrays, box, boundaries, params) {
          const contactSurface = new ContactSurface(packedArrays, boundaries, params)
          contactSurface.build()
      
          const surface = {
      Severity: Minor
      Found in packages/miew/src/gfx/geometries/ContactSurfaceGeometry.js - About 1 hr to fix

        Function processColFromPosMaterial has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const processColFromPosMaterial = (function () {
          const matValues = {
            colorFromPos: true,
            transparent: false,
            colorFromDepth: false,
        Severity: Minor
        Found in packages/miew/src/gfx/meshutils.js - About 1 hr to fix

          Function mousemove has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ObjectControls.prototype.mousemove = function (event) {
            if (this.enabled === false || this._state === STATE.NONE) {
              return
            }
          
          
          Severity: Minor
          Found in packages/miew/src/ui/ObjectControls.js - About 1 hr to fix

            Function setFrame has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              setFrame(frameIdx) {
                this.frameIsReady = false
                if (
                  frameIdx >= this._framesRange.start &&
                  frameIdx <= this._framesRange.end
            Severity: Minor
            Found in packages/miew/src/gfx/FrameInfo.js - About 1 hr to fix

              Function _collectSpheresInfo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _collectSpheresInfo(mesh) {
                  const {
                    geometry: {
                      attributes: { position, color },
                      index
              Severity: Minor
              Found in packages/miew/src/io/exporters/fbx/FBXInfoExtractor.js - About 1 hr to fix

                Function _findSuitableMolecule has 27 lines of code (exceeds 25 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 1 hr to fix

                  Function _compareReps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _compareReps(complexVisual, compareWithDefaults) {
                      const ans = {}
                      let repCount = 0
                  
                      if (complexVisual) {
                  Severity: Minor
                  Found in packages/miew/src/Miew.ts - About 1 hr to fix

                    Function center has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      center(selector) {
                        // no arguments - center on current selection;
                        if (selector === undefined) {
                          this.setPivotSubset()
                          this._needRender = true
                    Severity: Minor
                    Found in packages/miew/src/Miew.ts - About 1 hr to fix

                      Function _initReprList has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Menu.prototype._initReprList = function () {
                        this._fillReprList()
                        this._curReprIdx = this._viewer.repCurrent()
                        $(
                          `${this._menuId} .panel-menu[data-panel-type=miew-menu-panel-representation] .miew-repr-list .panel.valid:eq(${this._curReprIdx}) .panel-heading`
                      Severity: Minor
                      Found in demo/src/scripts/ui/Menu.js - About 1 hr to fix

                        Function _onUpdate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          obj._onUpdate = function () {
                            if (
                              obj.isScriptingCommandAvailable !== undefined &&
                              obj.isScriptingCommandAvailable() &&
                              !obj._building
                        Severity: Minor
                        Found in packages/miew-cli/src/Miew-cli.js - About 1 hr to fix

                          Function raycast has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            raycast(raycaster, intersects) {
                              const ray = TransformGroup._ray
                              const inverseMatrix = TransformGroup._inverseMatrix
                              const { children } = this
                              ray.copy(raycaster.ray)
                          Severity: Minor
                          Found in packages/miew/src/gfx/meshes/TransformGroup.js - About 1 hr to fix

                            Function _findNumVoxels has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _findNumVoxels(posRadArray, params) {
                                const { numVoxels } = this
                                const minMaxValues = this._findMinMax(posRadArray)
                                const minCoordRad = minMaxValues.minPosRad
                                const maxCoordRad = minMaxValues.maxPosRad
                            Severity: Minor
                            Found in packages/miew/src/gfx/geometries/VolumeSurfaceGeometry.js - About 1 hr to fix

                              Function _detectLeadWing has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                _detectLeadWing(dst, next, getAtomPosition) {
                                  const leadAtom = this._findFirstAtomInList(cNucleicControlNames)
                                  let wingStart = this._findFirstAtomInList(cNucleicWing1Names)
                                  let wingEnd = this._findFirstAtomInList(cNucleicWing2Names)
                              
                              
                              Severity: Minor
                              Found in packages/miew/src/chem/Residue.js - About 1 hr to fix

                                Function _createSecondary has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function _createSecondary(strArray, complex) {
                                  const residues = complex._residues
                                  const nRes = residues.length
                                  const resid = new Uint8Array(nRes)
                                
                                
                                Severity: Minor
                                Found in packages/miew/src/gfx/FrameInfo.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language