KarrLab/bcforms

View on GitHub

Showing 46 of 120 total issues

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 get_genomic_image has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def get_genomic_image(self, seq_features=None, width=1200, cols=2, nt_per_track=80, **kwargs):
    Severity: Minor
    Found in bcforms/core.py - About 45 mins to fix

      Function get_details has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_details(self):
              """ Get the full details of the crosslink in a dictionary
      
              Returns:
                  :obj:`dict`: detailed information of the crosslink
      Severity: Minor
      Found in bcforms/core.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def __init__(self, l_bond_atoms=None, r_bond_atoms=None, l_displaced_atoms=None, r_displaced_atoms=None,
                       order=BondOrder.single, stereo=None,
                       comments=None):
              """
      
      
      Severity: Minor
      Found in bcforms/core.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function update_tab_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function update_tab_name() {
          for (var i=0; i<num_subunits; i++) {
              if ($('#panel'+i).length) {
                  name = $('#name'+i+'').val()
                  if (name != null && name != '') {
      Severity: Minor
      Found in bcforms/web/app.js - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def __init__(self, id, stoichiometry, structure=None, formula=None, mol_wt=None, charge=None):
      Severity: Minor
      Found in bcforms/core.py - About 45 mins to fix

        Function clean has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def clean(self):
                """ Clean up the subunits and the crosslinks
        
                For example, convert `1 * a + 1 * a` to `2 * a`
        
        
        Severity: Minor
        Found in bcforms/core.py - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Avoid deeply nested control flow statements.
        Open

                                for i_atom, atom in atom_type.items():
                                    atom_type[i_atom] = mol.GetAtom(atom)
        
                # mol.AddHydrogens()
        
        
        Severity: Major
        Found in bcforms/core.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if encoding == 'bpforms.ProteinForm':
                                      try:
                                          subunit_structure = bpforms.ProteinForm().from_str(subunit['structure'])
                                          sum_length += len(subunit_structure) * bc_form.get_subunit_attribute(subunit_id, 'stoichiometry')
                                          bc_form.set_subunit_attribute(subunit_id, 'structure', subunit_structure)
          Severity: Major
          Found in bcforms/rest.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if 'formula' in subunit:
                                        try:
                                            bc_form.set_subunit_attribute(subunit_id, 'formula', subunit['formula'])
                                        except Exception as error:
                                            flask_restplus.abort(400, 'Unable to parse formula', errors={'formula': str(error)})
            Severity: Major
            Found in bcforms/rest.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if next(subunit for subunit in self_subunits_subunits if subunit.id == atom.subunit).stoichiometry > 1:
                                          errors.append("crosslink {} contains multiple subunit '{}', so the subunit_idx of atom '{}[{}]' cannot be None".format(
                                              i_crosslink + 1, atom.subunit, atom_type, i_atom))
                                  elif atom.subunit_idx > next(subunit for subunit in self_subunits_subunits if subunit.id == atom.subunit).stoichiometry:
              Severity: Major
              Found in bcforms/core.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for i_atom, atom in atom_type.items():
                                            atom_type[i_atom] = atom+n_atoms[i_subunit]
                            atom_maps.append(atom_map)
                Severity: Major
                Found in bcforms/core.py - About 45 mins to fix

                  Function structure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def structure(self, value):
                          """ Set the structure of the subunit
                  
                          * setting structure will automaticall set formula, mol_wt, charge
                  
                  
                  Severity: Minor
                  Found in bcforms/core.py - About 45 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

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

                      def is_equal(self, other):
                          """ Check if two atoms are semantically equal (belong to the same subunit/monomer and
                          have the same element, position, and charge)
                  
                          Args:
                  Severity: Minor
                  Found in bcforms/core.py - About 45 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Avoid deeply nested control flow statements.
                  Open

                                          for i_atom, atom in atom_type.items():
                                              if atom is not None:
                                                  atom_type[i_atom] = atom.GetIdx()
                  
                  
                  Severity: Major
                  Found in bcforms/core.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if 'charge' in subunit:
                                                try:
                                                    bc_form.set_subunit_attribute(subunit_id, 'charge', subunit['charge'])
                                                except Exception as error:
                                                    flask_restplus.abort(400, 'Unable to parse charge', errors={'charge': str(error)})
                    Severity: Major
                    Found in bcforms/rest.py - About 45 mins to fix

                      Function from_set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def from_set(self, subunits):
                              """ Set the subunits from a list of subunits
                      
                              Note: this method does not support crosslinks
                      
                      
                      Severity: Minor
                      Found in bcforms/core.py - About 35 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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

                                      return False
                          Severity: Major
                          Found in bcforms/core.py - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language