KarrLab/bpforms

View on GitHub

Showing 397 of 397 total issues

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

        row_dict['l_displaced_atoms'] = [atom.strip() for atom in row['left_displace_atoms'].split(',')]
Severity: Major
Found in bpforms/xlink/xlink_xlsx2yml.py and 3 other locations - About 45 mins to fix
bpforms/xlink/xlink_xlsx2yml.py on lines 33..33
bpforms/xlink/xlink_xlsx2yml.py on lines 37..37
bpforms/xlink/xlink_xlsx2yml.py on lines 38..38

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

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

            if monomer is not None:
                merge_with_new = True
                same_structures.append((pdb_monomer.id, monomer_to_codes[monomer]))
Severity: Minor
Found in bpforms/alphabet/dna.py and 1 other location - About 45 mins to fix
bpforms/alphabet/rna.py on lines 795..797

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

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

Avoid deeply nested control flow statements.
Open

                    if atom is None:
                        continue

Severity: Major
Found in bpforms/util.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if atom_md.element == 'H' and atom.GetAtomicNum() != 1:
                            atom = core.get_hydrogen_atom(atom, selected_hydrogens, i_monomer)
                            if atom is None:
                                continue
    
    
    Severity: Major
    Found in bpforms/util.py - About 45 mins to fix

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

              row_dict['r_bond_atoms'] = [atom.strip() for atom in row['right_bond_atoms'].split(',')]
      Severity: Major
      Found in bpforms/xlink/xlink_xlsx2yml.py and 3 other locations - About 45 mins to fix
      bpforms/xlink/xlink_xlsx2yml.py on lines 33..33
      bpforms/xlink/xlink_xlsx2yml.py on lines 34..34
      bpforms/xlink/xlink_xlsx2yml.py on lines 38..38

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

      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

              for atom_n in atom_ns:
                  for atom_c in atom_cs:
                      if self.is_terminus(atom_n, atom_c):
                          termini.append((atom_n, atom_c))
      Severity: Minor
      Found in bpforms/alphabet/protein.py and 1 other location - About 45 mins to fix
      bpforms/alphabet/rna.py on lines 897..900

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

      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

              for atom_b in atom_bs:
                  for atom_r in atom_rs:
                      if self.is_terminus(atom_b, atom_r):
                          termini.append((atom_b, atom_r))
      Severity: Minor
      Found in bpforms/alphabet/rna.py and 1 other location - About 45 mins to fix
      bpforms/alphabet/protein.py on lines 642..645

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

      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

      for monomer in can_monomer_freq.keys():
          can_monomer_freq[monomer] *= (1. + doubling_time / half_life)
      Severity: Minor
      Found in examples/modomics_analysis.py and 1 other location - About 45 mins to fix
      examples/modomics_analysis.py on lines 44..45

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

      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

      Avoid deeply nested control flow statements.
      Open

                          if atom_md.position < 1 or atom_md.position > monomer.structure.NumAtoms():
                              errors.append('Invalid position {} for monomeric form:{} {}'.format(atom_md.position, monomer.id, atom_type))
                              continue
      
      
      Severity: Major
      Found in bpforms/util.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if atom_el[-2] == 'H':
                                    type_atoms[i_atom_el] = (
                                        get_hydrogen_atom(atom_el[0], bonding_hydrogens, i_monomer),
                                        i_monomer + 1, atom_el[1], atom_el[2], atom_el[4])
                                else:
        Severity: Major
        Found in bpforms/core.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if element_table.GetSymbol(atom.GetAtomicNum()) != atom_md.element:
                                  errors.append('Invalid element {} != {} at position {} for monomeric form:{} {}'.format(
                                      element_table.GetSymbol(atom.GetAtomicNum()), atom_md.element,
                                      atom_md.position, monomer.id, atom_type))
          
          
          Severity: Major
          Found in bpforms/util.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                for position in feature['positions'].get(i_polymer, []):
                                    if pos >= position[0] and pos <= position[1]:
                                        track_monomer['color'] = feature['color']
                                        break
            
            
            Severity: Major
            Found in bpforms/util.py - About 45 mins to fix

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

                      row_dict['r_displaced_atoms'] = [atom.strip() for atom in row['right_displace_atoms'].split(',')]
              Severity: Major
              Found in bpforms/xlink/xlink_xlsx2yml.py and 3 other locations - About 45 mins to fix
              bpforms/xlink/xlink_xlsx2yml.py on lines 33..33
              bpforms/xlink/xlink_xlsx2yml.py on lines 34..34
              bpforms/xlink/xlink_xlsx2yml.py on lines 37..37

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

              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

                              for o_monomer in alphabet.monomers.values():
                                  if monomer in o_monomer.base_monomers:
                                      o_monomer.base_monomers.remove(monomer)
              Severity: Minor
              Found in bpforms/alphabet/protein.py and 1 other location - About 45 mins to fix
              bpforms/alphabet/protein.py on lines 131..133

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

              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

              Avoid deeply nested control flow statements.
              Open

                                  if monomer.id:
                                      non_canonical_label = monomer.id
                                  elif monomer.name:
                                      non_canonical_label = monomer.name
                                  elif monomer.synonyms:
              Severity: Major
              Found in bpforms/util.py - About 45 mins to fix

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

                            if monomer is not None:
                                merge_with_new = True
                                same_structures.append((pdb_monomer.id, monomer_to_codes[monomer]))
                Severity: Minor
                Found in bpforms/alphabet/rna.py and 1 other location - About 45 mins to fix
                bpforms/alphabet/dna.py on lines 645..647

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

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

                    def is_equal(self, other):
                        """ Determine if two bonds are semantically equal
                
                        Args:
                            other (:obj:`Bond`): other bond
                Severity: Minor
                Found in bpforms/core.py - About 45 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

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

                        row_dict['l_bond_atoms'] = [atom.strip() for atom in row['left_bond_atoms'].split(',')]
                Severity: Major
                Found in bpforms/xlink/xlink_xlsx2yml.py and 3 other locations - About 45 mins to fix
                bpforms/xlink/xlink_xlsx2yml.py on lines 34..34
                bpforms/xlink/xlink_xlsx2yml.py on lines 37..37
                bpforms/xlink/xlink_xlsx2yml.py on lines 38..38

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

                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

                Avoid deeply nested control flow statements.
                Open

                                        if atom.molecule != Monomer or not atom.monomer or not atom.element or not atom.position:
                                            errors.append("'{}[{}]' of crosslink {} must have a defined monomer, element, and position".format(
                                                atom_type, i_atom, i_crosslink + 1))
                                        else:
                                            check_atom('Crosslink {} - monomer {}'.format(i_crosslink, atom.monomer), atom_type, atom.monomer - 1, i_atom,
                Severity: Major
                Found in bpforms/core.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if atom_md.molecule == Monomer:
                                              atom = mol.GetAtom(n_atom + atom_md.position)
                                          else:
                                              atom = mol.GetAtom(n_atom + atom_md.position + monomer_structure.NumAtoms())
                                          subunit_atoms[type][attr[0]].append([atom, atom_md.molecule, atom_md.position, atom_md.element, atom_md.charge])
                  Severity: Major
                  Found in bpforms/core.py - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language