KarrLab/bpforms

View on GitHub

Showing 397 of 397 total issues

Avoid too many return statements within this function.
Open

            return False
Severity: Major
Found in bpforms/core.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return True
    Severity: Major
    Found in bpforms/core.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in bpforms/core.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return True
        Severity: Major
        Found in bpforms/core.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return False
          Severity: Major
          Found in bpforms/core.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return True
            Severity: Major
            Found in bpforms/core.py - About 30 mins to fix

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

                          for other_other_atom in openbabel.OBAtomAtomIter(other_atom):
                              if other_other_atom.GetAtomicNum() == 6:
                                  c_1 = other_other_atom
                                  break
              Severity: Minor
              Found in bpforms/alphabet/rna.py and 2 other locations - About 30 mins to fix
              bpforms/alphabet/protein.py on lines 794..797
              bpforms/alphabet/rna.py on lines 128..131

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

              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

                          for other_atom in openbabel.OBAtomAtomIter(atom):
                              if other_atom.GetAtomicNum() == 1:
                                  h_atom = other_atom
                                  break
              Severity: Minor
              Found in bpforms/alphabet/protein.py and 2 other locations - About 30 mins to fix
              bpforms/alphabet/rna.py on lines 128..131
              bpforms/alphabet/rna.py on lines 1063..1066

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

              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

                          for other_atom in openbabel.OBAtomAtomIter(monomer_backbone_o):
                              if other_atom.GetAtomicNum() == 1:
                                  monomer_backbone_h = other_atom
                                  break
              Severity: Minor
              Found in bpforms/alphabet/rna.py and 2 other locations - About 30 mins to fix
              bpforms/alphabet/protein.py on lines 794..797
              bpforms/alphabet/rna.py on lines 1063..1066

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

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

              def read_pdb_yaml():
                  """ Read amino acid pdb-ccd from bpforms to a set
              
                  """
                  print('reading amino acid set from bpforms')
              Severity: Minor
              Found in examples/pdb_analysis.py - 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

              Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def run():
                  # create dict of MODOMICS single character monomer codes
                  modomics_short_code_to_monomer = {}
                  for monomer in bpforms.rna_alphabet.monomers.values():
                      for identifier in monomer.identifiers:
              Severity: Minor
              Found in examples/modomics.py - 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

              Function get_form has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_form(alphabet):
                  """ Get a subclass of BpFrom
              
                  Args:
                      alphabet (:obj:`str`): alphabet
              Severity: Minor
              Found in bpforms/util.py - 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

              Function is_equal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def is_equal(self, other):
                      """ Determine if two lists of atoms are semantically equal
              
                      Args:
                          other (:obj:`AtomList`): other list of atoms
              Severity: Minor
              Found in bpforms/core.py - 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

              Function get_formula has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_formula(self, none_position=True):
                      """ Get the formula
              
                      Args:
                          none_position (:obj:`bool`, optional): include atoms whose position is :obj:`None`
              Severity: Minor
              Found in bpforms/core.py - 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

              Function is_equal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def is_equal(self, other):
                      """ Determine if two sequences of monomeric forms are semantically equal
              
                      Args:
                          other (:obj:`MonomerSequence`): other sequence
              Severity: Minor
              Found in bpforms/core.py - 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

              Function get_hydrogen_atom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_hydrogen_atom(parent_atom, bonding_hydrogens, i_monomer):
                  """ Get a hydrogen atom attached to a parent atom
              
                  Args:
                      parent_atom (:obj:`openbabel.OBAtom`): parent atom
              Severity: Minor
              Found in bpforms/core.py - 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

              Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __init__(self, seq=None, alphabet=None, backbone=None, bond=None, circular=False,
                               crosslinks=None, nicks=None):
                      """
                      Args:
                          seq (:obj:`MonomerSequence`, optional): sequence of monomeric forms of the biopolymer
              Severity: Minor
              Found in bpforms/core.py - 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

              Severity
              Category
              Status
              Source
              Language