KarrLab/bpforms

View on GitHub

Showing 397 of 397 total issues

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

    def get_formula(self):
        """ Get the chemical formula

        Returns:
            :obj:`EmpiricalFormula`: chemical formula
Severity: Minor
Found in bpforms/core.py - About 3 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 __str__ has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def __str__(self, alphabet=None):
        """ Get a string representation of the monomeric form

        Args:
            alphabet (:obj:`Alphabet`, optional): alphabet
Severity: Minor
Found in bpforms/core.py - About 3 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 is_equal has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def is_equal(self, other):
        """ Check if two monomeric forms are semantically equal

        Args:
            other (:obj:`Monomer`): another monomeric form
Severity: Minor
Found in bpforms/core.py - About 3 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

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

    def is_terminus(self, b_atom, r_atom):
        """ Determine if a pair of atoms is a valid pair of bonding sites

        Args:
            b_atom (:obj:`openbabel.OBAtom`): potential backbone atom
Severity: Major
Found in bpforms/alphabet/rna.py and 1 other location - About 3 hrs to fix
bpforms/alphabet/rna.py on lines 944..961

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

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

    def is_nucleotide_terminus(self, l_atom, r_atom):
        """ Determine if a pair of atoms is a valid pair of bonding sites

        Args:
            l_atom (:obj:`openbabel.OBAtom`): potential left atom
Severity: Major
Found in bpforms/alphabet/rna.py and 1 other location - About 3 hrs to fix
bpforms/alphabet/rna.py on lines 925..942

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

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

toggle_monomer_details = function(i_monomer) {
    details = $('#monomer_' + i_monomer + '_details')
    details.toggleClass('hide');

    if (details.hasClass('hide'))
Severity: Major
Found in bpforms/web/js/app_alphabet.js and 1 other location - About 3 hrs to fix
bpforms/web/js/app_crosslink.js on lines 79..87

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

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

toggle_monomer_details = function(i_monomer) {
    details = $('#monomer_' + i_monomer + '_details')
    details.toggleClass('hide');

    if (details.hasClass('hide'))
Severity: Major
Found in bpforms/web/js/app_crosslink.js and 1 other location - About 3 hrs to fix
bpforms/web/js/app_alphabet.js on lines 195..203

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

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

    def is_backbone_atom(self, b_atom):
        """ Determine if an atom is a valid backbone bonding site

        Args:
            b_atom (:obj:`openbabel.OBAtom`): potential backbone atom
Severity: Minor
Found in bpforms/alphabet/rna.py - About 3 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 load_full_pdb_hets_by_entry_from_ftp has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def load_full_pdb_hets_by_entry_from_ftp(max_entries):
    """ read the PDB database and get heterogen sets for all entries

    """
    # get amino acid set (canonical and non-canonical) from bpforms
Severity: Minor
Found in examples/pdb_analysis.py - About 3 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 plot_modifications has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def plot_modifications(proteins, organism='Homo sapiens', fig_filename=OUT_FIG_FILENAME):
        """ Plot a summary of the modifications in PRO
    
        Args:
            proteins (:obj:`list` of :obj:`dict`): entries in PRO ontology
    Severity: Minor
    Found in examples/pro.py - About 3 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

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

                if i_right_o is not None and "HO3'" in atoms:
                    pdb_monomer.r_bond_atoms = [Atom(Monomer, element='O', position=i_right_o)]
                    pdb_monomer.r_displaced_atoms = [Atom(Monomer, element='H', position=i_right_o)]
    Severity: Major
    Found in bpforms/alphabet/dna.py and 1 other location - About 2 hrs to fix
    bpforms/alphabet/rna.py on lines 741..743

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

    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 i_right_o is not None and "HO3'" in atoms:
                    pdb_monomer.r_bond_atoms = [Atom(Monomer, element='O', position=i_right_o)]
                    pdb_monomer.r_displaced_atoms = [Atom(Monomer, element='H', position=i_right_o)]
    Severity: Major
    Found in bpforms/alphabet/rna.py and 1 other location - About 2 hrs to fix
    bpforms/alphabet/dna.py on lines 591..593

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

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

        def is_valid_nucleoside(self, monomer):
            """ Determine if nucleoside should be included in alphabet
    
            Args:
                monomer (:obj:`Monomer`): monomeric form
    Severity: Minor
    Found in bpforms/alphabet/rna.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function build_repairtoire has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_repairtoire(self, alphabet, ph=None, major_tautomer=False, dearomatize=False):
            """ Build monomeric forms from DNAmod
    
            Args:
                alphabet (:obj:`Alphabet`): alphabet
    Severity: Minor
    Found in bpforms/alphabet/dna.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function post has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def post(self):
            """ Optionally, calculate the major protonation and tautomerization form a biopolymer form and calculate its properties """
            """
            Returns:
                :obj:`dict`
    Severity: Minor
    Found in bpforms/rest.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function to_dict has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_dict(self, alphabet=None):
            """ Get a dictionary representation of the monomeric form
    
            Args:
                alphabet (:obj:`Alphabet`, optional): alphabet
    Severity: Minor
    Found in bpforms/core.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File rest.py has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ REST JSON API
    
    :Author: Jonathan Karr <karr@mssm.edu>
    :Date: 2019-02-05
    :Copyright: 2019, Karr Lab
    Severity: Minor
    Found in bpforms/rest.py - About 2 hrs to fix

      Function build has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def build(alphabet_ids=None, build_modomics=True, pro_max_num_proteins=None):
          """ Install website
      
          * Clear REST cache
          * Cache REST queries
      Severity: Minor
      Found in install_webserver.py - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

              for old_monomer, new_monomer in replaced_monomers:
                  for o_monomer in alphabet.monomers.values():
                      if old_monomer in o_monomer.base_monomers:
                          o_monomer.base_monomers.remove(old_monomer)
                          o_monomer.base_monomers.add(new_monomer)
      Severity: Major
      Found in bpforms/alphabet/rna.py and 1 other location - About 2 hrs to fix
      bpforms/alphabet/dna.py on lines 708..712

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

      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

      Severity
      Category
      Status
      Source
      Language