Showing 1,553 of 1,553 total issues

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

        for (let k = 0; k < bridge.i.length; ++k) {
          this._betaPartners[bridge.i[k]][betai] = {
            residue: bridge.j[j++],
            ladder: bridge.ladder,
            parallel: true
Severity: Major
Found in packages/miew/src/chem/SecondaryStructureMap.js and 3 other locations - About 2 hrs to fix
packages/miew/src/chem/SecondaryStructureMap.js on lines 447..453
packages/miew/src/chem/SecondaryStructureMap.js on lines 456..462
packages/miew/src/chem/SecondaryStructureMap.js on lines 465..471

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

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

        for (let k = 0; k < bridge.i.length; ++k) {
          this._betaPartners[bridge.i[k]][betai] = {
            residue: bridge.j[j--],
            ladder: bridge.ladder,
            parallel: false
Severity: Major
Found in packages/miew/src/chem/SecondaryStructureMap.js and 3 other locations - About 2 hrs to fix
packages/miew/src/chem/SecondaryStructureMap.js on lines 438..444
packages/miew/src/chem/SecondaryStructureMap.js on lines 447..453
packages/miew/src/chem/SecondaryStructureMap.js on lines 465..471

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

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

  reprList
    .find(`.panel:eq(${index}) .panel-heading .btn-invisible`)
    .on('click', () => {
      reprList.find(`.panel:eq(${index}) .panel-heading .btn-invisible`).hide()
      reprList.find(`.panel:eq(${index}) .panel-heading .btn-visible`).show()
Severity: Major
Found in demo/src/scripts/ui/Menu.js and 1 other location - About 2 hrs to fix
demo/src/scripts/ui/Menu.js on lines 414..419

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

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

        for (let k = 0; k < bridge.j.length; ++k) {
          this._betaPartners[bridge.j[k]][betaj] = {
            residue: bridge.i[j--],
            ladder: bridge.ladder,
            parallel: false
Severity: Major
Found in packages/miew/src/chem/SecondaryStructureMap.js and 3 other locations - About 2 hrs to fix
packages/miew/src/chem/SecondaryStructureMap.js on lines 438..444
packages/miew/src/chem/SecondaryStructureMap.js on lines 447..453
packages/miew/src/chem/SecondaryStructureMap.js on lines 456..462

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

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

        for (let k = 0; k < bridge.j.length; ++k) {
          this._betaPartners[bridge.j[k]][betaj] = {
            residue: bridge.i[j++],
            ladder: bridge.ladder,
            parallel: true
Severity: Major
Found in packages/miew/src/chem/SecondaryStructureMap.js and 3 other locations - About 2 hrs to fix
packages/miew/src/chem/SecondaryStructureMap.js on lines 438..444
packages/miew/src/chem/SecondaryStructureMap.js on lines 456..462
packages/miew/src/chem/SecondaryStructureMap.js on lines 465..471

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

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 parseBinaryData has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseBinaryData(arrayBuffer) {
    const dataView = new DataView(arrayBuffer)
    let offset = 0
    const atomsCount = dataView.getUint32(offset, true)
    offset += 4
Severity: Major
Found in packages/miew/src/gfx/FrameInfo.js - About 2 hrs to fix

    Function _onKeyDown has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _onKeyDown(event) {
        if (!this._running || !this._hotKeysEnabled) {
          return
        }
    
    
    Severity: Major
    Found in packages/miew/src/Miew.ts - About 2 hrs to fix

      Function screenshot has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        screenshot(width, height) {
          const gfx = this._gfx
          const deviceWidth = gfx.renderer.domElement.width
          const deviceHeight = gfx.renderer.domElement.height
      
      
      Severity: Major
      Found in packages/miew/src/Miew.ts - About 2 hrs to fix

        Function _fillSelectionColorCombo has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Menu.prototype._fillSelectionColorCombo = function (paletteID) {
          const self = this
          const frag = document.createDocumentFragment()
          const palette = palettes.get(paletteID) || palettes.first
          const colorList = palette.namedColorsArray
        Severity: Major
        Found in demo/src/scripts/ui/Menu.js - About 2 hrs to fix

          File readCIF.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { set } from 'lodash'
          import ParsingError from './ParsingError'
          
          // Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax
          
          
          Severity: Minor
          Found in packages/miew/src/io/parsers/readCIF.js - About 2 hrs to fix

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

                  performAction: function anonymous(
                    yy,
                    yy_,
                    $avoiding_name_collisions,
                    YY_START
            Severity: Major
            Found in packages/miew/src/utils/SelectionParser.js - About 2 hrs to fix

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

                parse() {
                  return new Promise((resolve, reject) => {
                    setTimeout(() => {
                      try {
                        if (this._abort) {
              Severity: Major
              Found in packages/miew/src/io/parsers/Parser.js and 1 other location - About 2 hrs to fix
              packages/miew/src/io/exporters/Exporter.js on lines 14..27

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

              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 _fetchData has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function _fetchData(source, opts, job) {
                return new Promise((resolve) => {
                  if (job.shouldCancel()) {
                    throw new Error('Operation cancelled')
                  }
              Severity: Major
              Found in packages/miew/src/Miew.ts - About 2 hrs to fix

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

                  export() {
                    return new Promise((resolve, reject) => {
                      setTimeout(() => {
                        try {
                          if (this._abort) {
                Severity: Major
                Found in packages/miew/src/io/exporters/Exporter.js and 1 other location - About 2 hrs to fix
                packages/miew/src/io/parsers/Parser.js on lines 14..27

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

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

                  _prepareBuffer(framesStart, framesEnd) {
                    if (framesStart === undefined || framesStart === null) {
                      framesStart = 0
                    }
                    if (framesEnd === undefined || framesEnd === null) {
                Severity: Minor
                Found in packages/miew/src/gfx/FrameInfo.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 dssp has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  dssp() {
                    const ssMap = new SecondaryStructureMap(this)
                
                    const structures = (this.structures = [])
                    const helices = (this._helices = [])
                Severity: Minor
                Found in packages/miew/src/chem/Complex.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 rep has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  rep(index, rep) {
                    // if index is missing then it is the current
                    if (!rep && (index === undefined || index instanceof Object)) {
                      rep = index
                      index = this.repCurrent()
                Severity: Minor
                Found in packages/miew/src/ComplexVisual.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 write_csv has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def write_csv():
                  # create subtotals
                  stats_total = defaultdict(int)
                  stats_props_total = defaultdict(set)
                  for filename, stats, stats_props in files:
                Severity: Minor
                Found in packages/miew/tools/pdbfreq.py - 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 _markHeteroAtoms has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  _markHeteroAtoms(mmtfData) {
                    const chainsInModel0 = mmtfData.chainsPerModel[0]
                    for (let i = 0; i < mmtfData.entityList.length; ++i) {
                      const entity = mmtfData.entityList[i]
                      if (entity.type !== 'polymer') {
                Severity: Minor
                Found in packages/miew/src/io/parsers/MMTFParser.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 write_csv has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def write_csv():
                  # create subtotals
                  stats_total = defaultdict(int)
                  stats_props_total = defaultdict(set)
                  for filename, stats, stats_props in files:
                Severity: Minor
                Found in demo/tools/pdbfreq.py - 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

                Severity
                Category
                Status
                Source
                Language