KarrLab/bcforms

View on GitHub

Showing 46 of 120 total issues

File core.py has 1842 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" BcForms

:Author: Mike Zheng <xzheng20@colby.edu>
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2019-06-25
Severity: Major
Found in bcforms/core.py - About 5 days to fix

    Function get_structure has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_structure(self):
            """ Get an Open Babel molecule of the structure
    
            Returns:
                :obj:`openbabel.OBMol`: Open Babel molecule of the structure
    Severity: Minor
    Found in bcforms/core.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 post has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
    Open

        def post(self):
            ret = {}
            warnings = []
    
            args = bcform_ns.payload
    Severity: Minor
    Found in bcforms/rest.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 from_str has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_str(self, string):
            """ Set a complex from a string representation
    
            Args:
                string (:obj:`str`): string representation of a complex
    Severity: Minor
    Found in bcforms/core.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 draw_xlink has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    def draw_xlink(xlink_name, include_all_hydrogens=False, remove_hydrogens=True, show_atom_nums=False,
                   l_color=0x00ea4e, r_color=0x00adef, bond_color=0xea4200,
                   width=300, height=200, atom_label_font_size=0.6,
                   image_format='png', include_xml_header=False):
        """ Generate an image of a crosslink
    Severity: Minor
    Found in bcforms/core.py - About 4 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 get_genomic_image has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_genomic_image(self, seq_features=None, width=1200, cols=2, nt_per_track=80, **kwargs):
            """ Get a genomic visualization of the :obj:`BpForm`
    
            Args:
                seq_features (:obj:`dict`): list of features each
    Severity: Minor
    Found in bcforms/core.py - About 4 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 get_mol_wt has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_mol_wt(self, subunit_mol_wts=None):
            """ Get the molecular weight
    
            * If user wants to calculate molecular weight of nested BcForm, where
              some subunits are BcForm objects, then the subunit BcForms must be able
    Severity: Minor
    Found in bcforms/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

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

        def get_formula(self, subunit_formulas=None):
            """ Get the empirical formula
    
            * If user wants to calculate formula of nested BcForm, where some subunits
              are BcForm objects, then the subunit BcForms must be able to calculate
    Severity: Minor
    Found in bcforms/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

    Function get_charge has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_charge(self, subunit_charges=None):
            """ Get the total charge
    
            * If user wants to calculate charge of nested BcForm, where
              some subunits are BcForm objects, then the subunit BcForms must be able
    Severity: Minor
    Found in bcforms/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

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

        def is_equal(self, other):
            """ Check if two complexes are semantically equal (same subunits and crosslinks)
    
            Args:
                other (:obj:`BcForm`): another complex
    Severity: Minor
    Found in bcforms/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

    OntologyCrosslink has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OntologyCrosslink(Crosslink):
        """ A pre-defined crosslink between subunits
    
        Attributes:
            type (:obj:`str`): type of the pre-defined crosslink
    Severity: Minor
    Found in bcforms/core.py - About 2 hrs to fix

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

          def validate(self):
              """ Check if the BcForm is valid
      
              * Check if the crosslinking subunit is in the subunit list and if the `subunit_idx` is valid
      
      
      Severity: Minor
      Found in bcforms/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

      InlineCrosslink has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class InlineCrosslink(Crosslink):
          """ A crosslink between subunits defined inline
      
          Attributes:
              l_bond_atoms (:obj:`list` of :obj:`Atom`): atoms from the left subunit that bond with the right subunit
      Severity: Minor
      Found in bcforms/core.py - About 2 hrs to fix

        Function get_structure has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_structure(self):
                """ Get an Open Babel molecule of the structure
        
                Returns:
                    :obj:`tuple`:
        Severity: Minor
        Found in bcforms/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

        Function add_subunit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function add_subunit() {
            tabs = $('#tabs_subunits_dynamic')
            num_subunits = tabs.children().length - 1
            
            $('#tab_add_title').before(' \
        Severity: Minor
        Found in bcforms/web/app.js - About 1 hr to fix

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

              def is_equal(self, other):
                  """ Check if two crosslinks are semantically equal (have the same bond atoms)
          
                  Args:
                      other (:obj:`Crosslink`): another crosslink
          Severity: Minor
          Found in bcforms/core.py - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function draw_xlink has 12 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def draw_xlink(xlink_name, include_all_hydrogens=False, remove_hydrogens=True, show_atom_nums=False,
          Severity: Major
          Found in bcforms/core.py - About 1 hr to fix

            Function draw_xlink has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def draw_xlink(xlink_name, include_all_hydrogens=False, remove_hydrogens=True, show_atom_nums=False,
                           l_color=0x00ea4e, r_color=0x00adef, bond_color=0xea4200,
                           width=300, height=200, atom_label_font_size=0.6,
                           image_format='png', include_xml_header=False):
                """ Generate an image of a crosslink
            Severity: Minor
            Found in bcforms/core.py - About 1 hr to fix

              Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, l_bond_atoms=None, r_bond_atoms=None, l_displaced_atoms=None, r_displaced_atoms=None,
              Severity: Major
              Found in bcforms/core.py - About 50 mins to fix

                Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, subunit, element, position, monomer, charge=0, subunit_idx=None, component_type=None):
                Severity: Major
                Found in bcforms/core.py - About 50 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language