KarrLab/bpforms

View on GitHub
bpforms/util.py

Summary

Maintainability
F
2 wks
Test Coverage
A
97%

Function gen_genomic_viz has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
Open

def gen_genomic_viz(polymers, inter_crosslinks=None, polymer_labels=None, seq_features=None,
                    width=800, cols=1, polymer_margin=25,
                    nt_per_track=100, track_sep=10,
                    polymer_label_font_size=15, seq_font_size=13, tick_label_font_size=10,
                    legend_font_size=13, tooltip_font_size=13,
Severity: Minor
Found in bpforms/util.py - About 1 day 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

File util.py has 778 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Utilities for BpForms

:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2019-02-05
:Copyright: 2019, Karr Lab
Severity: Major
Found in bpforms/util.py - About 1 day to fix

    Function validate_bpform_bonds has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
    Open

    def validate_bpform_bonds(form_type):
        """ Validate bonds in alphabet
    
        Args:
            form_type (:obj:`type`): type of BpForm
    Severity: Minor
    Found in bpforms/util.py - About 1 day 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 export_ontos_to_obo has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    def export_ontos_to_obo(alphabets=None, filename=None, _max_monomers=None, _max_xlinks=None):
        """ Exports alphabets of residues and ontology of crosslinks to OBO format
    
        Args:
            alphabets (:obj:`list` of :obj:`core.Alphabet`, optional): alphabets to export        
    Severity: Minor
    Found in bpforms/util.py - About 7 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 gen_genomic_viz has 25 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def gen_genomic_viz(polymers, inter_crosslinks=None, polymer_labels=None, seq_features=None,
    Severity: Major
    Found in bpforms/util.py - About 3 hrs to fix

      Function gen_genomic_viz has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def gen_genomic_viz(polymers, inter_crosslinks=None, polymer_labels=None, seq_features=None,
                          width=800, cols=1, polymer_margin=25,
                          nt_per_track=100, track_sep=10,
                          polymer_label_font_size=15, seq_font_size=13, tick_label_font_size=10,
                          legend_font_size=13, tooltip_font_size=13,
      Severity: Major
      Found in bpforms/util.py - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if prev_horz and x_link['l_polymer_row'] == x_link['r_polymer_row'] and \
                        x_link['l_track'] == x_link['r_track'] and \
                        x_link['l_polymer_row'] == prev_row and \
                        x_link['l_track'] == prev_track and \
                        (x_link['l_polymer_col'] < prev_col or
        Severity: Critical
        Found in bpforms/util.py - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if prev_vert and x_link['l_polymer_col'] == x_link['r_polymer_col'] and \
                          x_link['l_pos'] == x_link['r_pos'] and \
                          x_link['l_polymer_col'] == prev_col and \
                          x_link['l_pos'] == prev_pos and \
                          (x_link['l_polymer_row'] < prev_row or
          Severity: Critical
          Found in bpforms/util.py - About 1 hr to fix

            Function gen_html_viz_alphabet has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def gen_html_viz_alphabet(bpform_type, filename):
                """ Create and save an HTML document with images of the monomeric forms in an alphabet
            
                Args:
                    bpform_type (:obj:`type`): subclass of :obj:`core.BpForm`
            Severity: Minor
            Found in bpforms/util.py - About 1 hr to fix

              Function export_ontos_to_obo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def export_ontos_to_obo(alphabets=None, filename=None, _max_monomers=None, _max_xlinks=None):
                  """ Exports alphabets of residues and ontology of crosslinks to OBO format
              
                  Args:
                      alphabets (:obj:`list` of :obj:`core.Alphabet`, optional): alphabets to export        
              Severity: Minor
              Found in bpforms/util.py - About 1 hr 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

                  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

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

                          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

                            Function build_alphabets has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def build_alphabets(ph=None, major_tautomer=False, dearomatize=False, _max_monomers=float('inf'), alphabets=None):
                            Severity: Minor
                            Found in bpforms/util.py - About 35 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return protein.ProteinForm
                              Severity: Major
                              Found in bpforms/util.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return protein.CanonicalProteinForm
                                Severity: Major
                                Found in bpforms/util.py - About 30 mins to fix

                                  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

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

                                      for x_link in sorted_x_links:
                                          if prev_vert and x_link['l_polymer_col'] == x_link['r_polymer_col'] and \
                                                  x_link['l_pos'] == x_link['r_pos'] and \
                                                  x_link['l_polymer_col'] == prev_col and \
                                                  x_link['l_pos'] == prev_pos and \
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 2 days to fix
                                  bpforms/util.py on lines 590..606

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

                                  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 x_link in sorted_x_links:
                                          if prev_horz and x_link['l_polymer_row'] == x_link['r_polymer_row'] and \
                                                  x_link['l_track'] == x_link['r_track'] and \
                                                  x_link['l_polymer_row'] == prev_row and \
                                                  x_link['l_track'] == prev_track and \
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 2 days to fix
                                  bpforms/util.py on lines 620..636

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

                                  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

                                              try:
                                                  dimer_structure = dimer_form.get_structure()[0]
                                                  if dimer_form.get_formula() != OpenBabelUtils.get_formula(dimer_structure):
                                                      errors.append('Dimer of {} has incorrect formula: {} != {}'.format(
                                                          monomer.id, str(dimer_form.get_formula()), str(OpenBabelUtils.get_formula(dimer_structure))))
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 1 day to fix
                                  bpforms/util.py on lines 260..273

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

                                  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

                                          try:
                                              monomer_structure = monomer_form.get_structure()[0]
                                              if monomer_form.get_formula() != OpenBabelUtils.get_formula(monomer_structure):
                                                  errors.append('Monomeric form of {} has incorrect formula: {} != {}'.format(
                                                      monomer.id, str(monomer_form.get_formula()), str(OpenBabelUtils.get_formula(monomer_structure))))
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 1 day to fix
                                  bpforms/util.py on lines 277..290

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

                                  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

                                      sorted_x_links = sorted(all_x_links, key=lambda x: (
                                          x['l_polymer_col'] == x['r_polymer_col'] and x['l_pos'] == x['r_pos'],
                                          x['l_polymer_col'], x['r_polymer_col'],
                                          x['l_pos'], x['r_pos'],
                                          x['l_polymer_row'], x['l_track'],
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 7 hrs to fix
                                  bpforms/util.py on lines 578..583

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

                                  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

                                      sorted_x_links = sorted(all_x_links, key=lambda x: (
                                          x['l_polymer_row'] == x['r_polymer_row'] and x['l_track'] == x['r_track'],
                                          x['l_polymer_row'], x['r_polymer_row'],
                                          x['l_track'], x['r_track'],
                                          x['l_polymer_col'], x['l_pos'],
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 7 hrs to fix
                                  bpforms/util.py on lines 608..613

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

                                  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

                                                  if atom_md.element == 'H' and atom.GetAtomicNum() != 1:
                                                      atom = core.get_hydrogen_atom(atom, selected_hydrogens, None)
                                                      if atom is None:
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 2 hrs to fix
                                  bpforms/util.py on lines 247..249

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

                                  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

                                                      if atom_md.element == 'H' and atom.GetAtomicNum() != 1:
                                                          atom = core.get_hydrogen_atom(atom, selected_hydrogens, i_monomer)
                                                          if atom is None:
                                  Severity: Major
                                  Found in bpforms/util.py and 1 other location - About 2 hrs to fix
                                  bpforms/util.py on lines 218..220

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

                                  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 alphabets is None or 'dna' in alphabets:
                                          dna.DnaAlphabetBuilder(_max_monomers=_max_monomers).run(ph=ph, major_tautomer=major_tautomer, dearomatize=dearomatize)
                                  Severity: Major
                                  Found in bpforms/util.py and 2 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 101..102
                                  bpforms/util.py on lines 103..104

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

                                  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 alphabets is None or 'protein' in alphabets:
                                          protein.ProteinAlphabetBuilder(_max_monomers=_max_monomers).run(ph=ph, major_tautomer=major_tautomer, dearomatize=dearomatize)
                                  Severity: Major
                                  Found in bpforms/util.py and 2 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 99..100
                                  bpforms/util.py on lines 101..102

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

                                  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 alphabets is None or 'rna' in alphabets:
                                          rna.RnaAlphabetBuilder(_max_monomers=_max_monomers).run(ph=ph, major_tautomer=major_tautomer, dearomatize=dearomatize)
                                  Severity: Major
                                  Found in bpforms/util.py and 2 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 99..100
                                  bpforms/util.py on lines 103..104

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

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

                                          doc += '          <td>{}</td>\n'.format(', '.join('{}{}'.format(atom.element, atom.position) for atom in monomer.r_bond_atoms))
                                  Severity: Major
                                  Found in bpforms/util.py and 5 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 160..161
                                  bpforms/util.py on lines 162..163
                                  bpforms/util.py on lines 165..166
                                  bpforms/util.py on lines 167..167
                                  bpforms/util.py on lines 168..169

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

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

                                          doc += '          <td>{}</td>\n'.format(', '.join('{}{}'.format(atom.element, atom.position)
                                                                                            for atom in monomer.backbone_bond_atoms))
                                  Severity: Major
                                  Found in bpforms/util.py and 5 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 162..163
                                  bpforms/util.py on lines 164..164
                                  bpforms/util.py on lines 165..166
                                  bpforms/util.py on lines 167..167
                                  bpforms/util.py on lines 168..169

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

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

                                          doc += '          <td>{}</td>\n'.format(', '.join('{}{}'.format(atom.element, atom.position)
                                                                                            for atom in monomer.r_displaced_atoms))
                                  Severity: Major
                                  Found in bpforms/util.py and 5 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 160..161
                                  bpforms/util.py on lines 162..163
                                  bpforms/util.py on lines 164..164
                                  bpforms/util.py on lines 167..167
                                  bpforms/util.py on lines 168..169

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

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

                                          doc += '          <td>{}</td>\n'.format(', '.join('{}{}'.format(atom.element, atom.position)
                                                                                            for atom in monomer.backbone_displaced_atoms))
                                  Severity: Major
                                  Found in bpforms/util.py and 5 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 160..161
                                  bpforms/util.py on lines 164..164
                                  bpforms/util.py on lines 165..166
                                  bpforms/util.py on lines 167..167
                                  bpforms/util.py on lines 168..169

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

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

                                          doc += '          <td>{}</td>\n'.format(', '.join('{}{}'.format(atom.element, atom.position)
                                                                                            for atom in monomer.l_displaced_atoms))
                                  Severity: Major
                                  Found in bpforms/util.py and 5 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 160..161
                                  bpforms/util.py on lines 162..163
                                  bpforms/util.py on lines 164..164
                                  bpforms/util.py on lines 165..166
                                  bpforms/util.py on lines 167..167

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

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

                                          doc += '          <td>{}</td>\n'.format(', '.join('{}{}'.format(atom.element, atom.position) for atom in monomer.l_bond_atoms))
                                  Severity: Major
                                  Found in bpforms/util.py and 5 other locations - About 1 hr to fix
                                  bpforms/util.py on lines 160..161
                                  bpforms/util.py on lines 162..163
                                  bpforms/util.py on lines 164..164
                                  bpforms/util.py on lines 165..166
                                  bpforms/util.py on lines 168..169

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

                                  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

                                  There are no issues that match your filters.

                                  Category
                                  Status