Showing 1,553 of 1,553 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      showPosition: function () {
        var pre = this.pastInput()
        var c = new Array(pre.length + 1).join('-')
        return pre + this.upcomingInput() + '\n' + c + '^'
      },
Severity: Major
Found in packages/miew-cli/src/MiewCLIParser.js and 1 other location - About 2 hrs to fix
packages/miew/src/utils/SelectionParser.js on lines 601..605

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  unregister(entity) {
    EntityList.unregisterFromList(this._list, entity)
    this._indices.forEach((index) => {
      EntityList.unregisterFromDict(
        this._dict[index],
Severity: Major
Found in packages/miew/src/utils/EntityList.js and 1 other location - About 2 hrs to fix
packages/miew/src/utils/EntityList.js on lines 113..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      topState: function topState(n) {
        n = this.conditionStack.length - 1 - Math.abs(n || 0)
        if (n >= 0) {
          return this.conditionStack[n]
        } else {
Severity: Major
Found in packages/miew-cli/src/MiewCLIParser.js and 1 other location - About 2 hrs to fix
packages/miew/src/utils/SelectionParser.js on lines 785..792

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      topState: function topState(n) {
        n = this.conditionStack.length - 1 - Math.abs(n || 0)
        if (n >= 0) {
          return this.conditionStack[n]
        } else {
Severity: Major
Found in packages/miew/src/utils/SelectionParser.js and 1 other location - About 2 hrs to fix
packages/miew-cli/src/MiewCLIParser.js on lines 2782..2789

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      if (
        data.molecule &&
        data.molecule.atomArray &&
        data.molecule.atomArray.atom
      ) {
Severity: Major
Found in packages/miew/src/io/parsers/CMLParser.js and 1 other location - About 2 hrs to fix
packages/miew/src/io/parsers/CMLParser.js on lines 308..314

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        let scale =
          order % 2 === 0
            ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))
            : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2))
Severity: Major
Found in packages/miew/src/gfx/modes/groups/BondsLinesGroup.js and 1 other location - About 2 hrs to fix
packages/miew/src/gfx/modes/groups/BondsLinesGroup.js on lines 39..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      if (data.molecule.bondArray && data.molecule.bondArray.bond) {
        if (!Array.isArray(data.molecule.bondArray.bond)) {
          localBond.push(data.molecule.bondArray.bond)
        } else {
          localBond = data.molecule.bondArray.bond
Severity: Major
Found in packages/miew/src/io/parsers/CMLParser.js and 1 other location - About 2 hrs to fix
packages/miew/src/io/parsers/CMLParser.js on lines 279..294

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        let scale =
          order % 2 === 0
            ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))
            : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2))
Severity: Major
Found in packages/miew/src/gfx/modes/groups/BondsLinesGroup.js and 1 other location - About 2 hrs to fix
packages/miew/src/gfx/modes/groups/BondsLinesGroup.js on lines 104..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  register(entity) {
    EntityList.registerInList(this._list, entity)
    this._indices.forEach((index) => {
      EntityList.registerInDict(
        this._dict[index],
Severity: Major
Found in packages/miew/src/utils/EntityList.js and 1 other location - About 2 hrs to fix
packages/miew/src/utils/EntityList.js on lines 132..141

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File MOL2Parser.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Parser from './Parser'
import chem from '../../chem'
import { Vector3 } from 'three'

const { Complex, Element, Bond, Molecule } = chem
Severity: Minor
Found in packages/miew/src/io/parsers/MOL2Parser.js - About 2 hrs to fix

    File PDBExporter.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { invert } from 'lodash'
    import Complex from '../../chem/Complex'
    import Exporter from './Exporter'
    import PDBResult from './PDBResult'
    import Assembly from '../../chem/Assembly'
    Severity: Minor
    Found in packages/miew/src/io/exporters/PDBExporter.js - About 2 hrs to fix

      Function next has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            next: function () {
              if (this.done) {
                return this.EOF
              }
              if (!this._input) {
      Severity: Major
      Found in packages/miew-cli/src/MiewCLIParser.js - About 2 hrs to fix

        Function updateToFrame has 54 lines of code (exceeds 25 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: Major
        Found in packages/miew/src/gfx/modes/groups/BondsLinesGroup.js - About 2 hrs to fix

          Function _prepareBuffer has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _prepareBuffer(framesStart, framesEnd) {
              if (framesStart === undefined || framesStart === null) {
                framesStart = 0
              }
              if (framesEnd === undefined || framesEnd === null) {
          Severity: Major
          Found in packages/miew/src/gfx/FrameInfo.js - About 2 hrs to fix

            Function _buildVW has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _buildVW() {
                const self = this
                const residues = this._complex._residues
                let ri
                let preri
            Severity: Major
            Found in packages/miew/src/chem/HBondInfo.js - About 2 hrs to fix

              Function next has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    next: function () {
                      if (this.done) {
                        return this.EOF
                      }
                      if (!this._input) {
              Severity: Major
              Found in packages/miew/src/utils/SelectionParser.js - About 2 hrs to fix

                Function rebuild has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  rebuild() {
                    const self = this
                
                    // Destroy current geometry
                    gfxutils.clearTree(this)
                Severity: Major
                Found in packages/miew/src/ComplexVisual.js - About 2 hrs to fix

                  Function buildTiledTexture has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    buildTiledTexture() {
                      let tilesX = Math.ceil(Math.sqrt((this._dimZ * this._dimY) / this._dimX))
                  
                      let width = tilesX * (this._dimX + 2) - 1
                      width = pow2ceil(width)
                  Severity: Major
                  Found in packages/miew/src/chem/Volume.js - About 2 hrs to fix

                    Similar blocks of code found in 8 locations. Consider refactoring.
                    Open

                        it('keeps containing values from remaining ranges', () => {
                          expect(rangeList.includes(13)).to.equal(true)
                          rangeList.remove(rFrom18To20)
                          expect(rangeList.includes(13)).to.equal(true)
                        })
                    Severity: Major
                    Found in packages/miew/src/chem/selectors/selectArgs.test.js and 7 other locations - About 2 hrs to fix
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 101..105
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 106..110
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 123..127
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 133..137
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 138..142
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 243..247
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 280..284

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 8 locations. Consider refactoring.
                    Open

                        it('stops containing values from removing range', () => {
                          expect(rangeList.includes(19)).to.equal(true)
                          rangeList.remove(rFrom18To20)
                          expect(rangeList.includes(19)).to.equal(false)
                        })
                    Severity: Major
                    Found in packages/miew/src/chem/selectors/selectArgs.test.js and 7 other locations - About 2 hrs to fix
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 101..105
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 106..110
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 128..132
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 133..137
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 138..142
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 243..247
                    packages/miew/src/chem/selectors/selectArgs.test.js on lines 280..284

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language