Showing 1,553 of 1,553 total issues

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

  {
    id: 'TN',
    name: 'Toon',
    shortName: 'Toon',
    uberOptions: {
Severity: Major
Found in packages/miew/src/gfx/materials.js and 7 other locations - About 2 hrs to fix
packages/miew/src/gfx/materials.js on lines 9..26
packages/miew/src/gfx/materials.js on lines 27..44
packages/miew/src/gfx/materials.js on lines 45..62
packages/miew/src/gfx/materials.js on lines 63..80
packages/miew/src/gfx/materials.js on lines 81..98
packages/miew/src/gfx/materials.js on lines 99..116
packages/miew/src/gfx/materials.js on lines 117..134

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 82.

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

      const onLogMessage = function (e) {
        const msg = e.message.replaceAll('[', '(').replaceAll(']', ')') // temp workaround for https://github.com/jcubic/jquery.terminal/issues/470
        term.echo(`[[b;${colors[e.level] || '#666'};]${msg}]`)
      }
Severity: Major
Found in packages/miew-app/src/components/menu/terminal/Terminal.jsx and 1 other location - About 2 hrs to fix
demo/src/scripts/ui/Menu.js on lines 207..210

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 82.

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

Function addVertexToGeo has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addVertexToGeo(geoOut, vAdd) {
    let entry
    const oneHynberes = 0.01
    const n815851 = 815851
    const n37633 = 37633
Severity: Major
Found in packages/miew/src/gfx/geometries/SSIsosurfaceGeometry.js - About 2 hrs to fix

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

        beforeEach(() => {
          paletteStub = sinon.stub(palettes, 'first').value(palette)
          residueTypeStub = sinon
            .stub(ResidueType, 'Flags')
            .value({ DNA: dnaFlag, RNA: rnaFlag })
    packages/miew/src/gfx/colorers/SecondaryStructureColorer.test.js on lines 84..90

    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 81.

    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

        beforeEach(() => {
          paletteStub = sinon.stub(palettes, 'first').value(palette)
          residueTypeStub = sinon
            .stub(ResidueType, 'Flags')
            .value({ DNA: dnaFlag, RNA: rnaFlag })
    packages/miew/src/gfx/colorers/SecondaryStructureColorer.test.js on lines 60..66

    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 81.

    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

    Function buildNormals has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      buildNormals(numVertices, vertices, normals) {
        const self = this
        let numCloseAtoms = 0
        let vx = 0
        let vy = 0
    Severity: Major
    Found in packages/miew/src/gfx/geometries/IsosurfaceBuildNormals.js - About 2 hrs to fix

      Function _parseAtom has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _parseAtom(line) {
          this._residueNumber = line.readInt(1, 5)
          this._residueName = line.readString(6, 10).trim()
          this._atomName = line.readString(11, 15).trim()
          this._atomNumber = line.readInt(16, 20)
      Severity: Major
      Found in packages/miew/src/io/parsers/GROParser.js - About 2 hrs to fix

        Function getMiewWithCli has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        var getMiewWithCli = function getMiewWithCli(miewInstance) {
          var obj = Object.create(miewInstance);
          obj.script = function (script, _printCallback, _errorCallback) {
            MiewCLIParser.parser.yy.miew = obj;
            MiewCLIParser.parser.yy.echo = _printCallback;
        Severity: Minor
        Found in packages/miew-cli/dist/index.modern.js - About 2 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 getMiewWithCli has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        var getMiewWithCli = function getMiewWithCli(miewInstance) {
          var obj = Object.create(miewInstance);
          obj.script = function (script, _printCallback, _errorCallback) {
            MiewCLIParser.parser.yy.miew = obj;
            MiewCLIParser.parser.yy.echo = _printCallback;
        Severity: Minor
        Found in packages/miew-cli/dist/index.js - About 2 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 getMiewWithCli has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getMiewWithCli = (miewInstance) => {
          const obj = Object.create(miewInstance)
        
          obj.script = function (script, _printCallback, _errorCallback) {
            parsercli.yy.miew = obj
        Severity: Minor
        Found in packages/miew-cli/src/Miew-cli.js - About 2 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 computeBoundaries has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          computeBoundaries() {
            const atoms = this._complex._atoms
            const n = atoms.length
            const selector = this._selector
        
        
        Severity: Minor
        Found in packages/miew/src/chem/BiologicalUnit.js - About 2 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

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

                if ((path.endsWith('.color') || path.endsWith('.baseColor') || path.endsWith('.EL.carbon')) && typeof arg !== 'number') {
                  arg = palettes.get(settings.now.palette).getNamedColor(arg);
                }
        Severity: Major
        Found in packages/miew-cli/dist/index.modern.js and 2 other locations - About 2 hrs to fix
        packages/miew-cli/src/Miew-cli.js on lines 248..255
        packages/miew-cli/dist/index.js on lines 3920..3922

        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 80.

        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 3 locations. Consider refactoring.
        Open

              if (
                (path.endsWith('.color') ||
                  path.endsWith('.baseColor') ||
                  path.endsWith('.EL.carbon')) &&
                typeof arg !== 'number'
        Severity: Major
        Found in packages/miew-cli/src/Miew-cli.js and 2 other locations - About 2 hrs to fix
        packages/miew-cli/dist/index.js on lines 3920..3922
        packages/miew-cli/dist/index.modern.js on lines 3916..3918

        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 80.

        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 3 locations. Consider refactoring.
        Open

                if ((path.endsWith('.color') || path.endsWith('.baseColor') || path.endsWith('.EL.carbon')) && typeof arg !== 'number') {
                  arg = palettes.get(settings.now.palette).getNamedColor(arg);
                }
        Severity: Major
        Found in packages/miew-cli/dist/index.js and 2 other locations - About 2 hrs to fix
        packages/miew-cli/src/Miew-cli.js on lines 248..255
        packages/miew-cli/dist/index.modern.js on lines 3916..3918

        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 80.

        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

        Function _updateInfoPanel has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _updateInfoPanel() {
            const info = this._msgAtomInfo.getElementsByTagName('p')[0]
            let atom
            let residue
        
        
        Severity: Major
        Found in packages/miew/src/Miew.ts - About 2 hrs to fix

          Function show has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Menu.prototype.show = function (panelID, menuItem) {
            const self = this
          
            this.setBlur(true)
            this._titlebar.hide()
          Severity: Major
          Found in demo/src/scripts/ui/Menu.js - About 2 hrs to fix

            Function _copyCurReprListItem has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Menu.prototype._copyCurReprListItem = function (index) {
              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 2 hrs to fix

              Function _initPresetsPanelActions has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Menu.prototype._initPresetsPanelActions = function () {
                const self = this
              
                self.presetsPanel.actions.pdb.inputs.refresh =
                  self._presetsPanelActionsPdbInputsRefresh // check input box?
              Severity: Major
              Found in demo/src/scripts/ui/Menu.js - About 2 hrs to fix

                Function _parseValue has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function _parseValue() {
                    let val
                    if (
                      (code === 46 || code === 63) &&
                      (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))
                Severity: Major
                Found in packages/miew/src/io/parsers/readCIF.js - About 2 hrs to fix

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language