packages/miew/src/io/exporters/PDBResult.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function writeString has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  writeString(string, begin, end) {
    let curStr = this._resultArray[this._currentStr]
    let str

    const curStrLength = curStr ? curStr.length : 0
Severity: Minor
Found in packages/miew/src/io/exporters/PDBResult.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 writeString has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  writeString(string, begin, end) {
    let curStr = this._resultArray[this._currentStr]
    let str

    const curStrLength = curStr ? curStr.length : 0
Severity: Minor
Found in packages/miew/src/io/exporters/PDBResult.js - About 1 hr to fix

    Function writeEntireString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      writeEntireString(string, maxStrPos, concat) {
        if (!maxStrPos) {
          maxStrPos = 81
        }
        for (let j = 0; j < string.length; j++) {
    Severity: Minor
    Found in packages/miew/src/io/exporters/PDBResult.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 newTag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      newTag(tag, numeration) {
        if (!tag) {
          this._tag = null
        } else {
          this._tag = tag
    Severity: Minor
    Found in packages/miew/src/io/exporters/PDBResult.js - About 35 mins 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 newString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      newString(tag) {
        this.writeString('\n', 81, 81)
        this._currentStr++
        this._resultArray.push('')
    
    
    Severity: Minor
    Found in packages/miew/src/io/exporters/PDBResult.js - About 35 mins 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 writeBondsArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      writeBondsArray(bonds, atom) {
        const bondsArrays = this._getSubArrays(bonds, 4)
    
        for (let k = 0; k < bondsArrays.length; k++) {
          this.newString()
    Severity: Minor
    Found in packages/miew/src/io/exporters/PDBResult.js - About 25 mins 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

    There are no issues that match your filters.

    Category
    Status