KarrLab/datanator

View on GitHub

Showing 376 of 791 total issues

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

    def build_obs_peptide(self, data, i, description):
        """Build observation objects from obj.
        Go into observations collection.
        Args:
            data (:obj:`Obj`): source object.

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

                        if seqs:
                            subunit.sequence = next((seq['Sequence'] for seq in seqs if seq['Entry'] == xref.id), seqs[0]['Sequence'])
                            iupac_seq = re.sub(r'[^' + Bio.Alphabet.IUPAC.IUPACProtein.letters + r']', '', subunit.sequence)
                            subunit.molecular_weight = \
                                + Bio.SeqUtils.molecular_weight(iupac_seq, seq_type='protein') \
Severity: Major
Found in datanator/data_source/sabio_rk.py - About 45 mins to fix

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

        def load_content(self):
            '''Load kegg_reactions into MongoDB
            '''
            _, _, collection = self.con_db(self.collection)
    
    
    Severity: Minor
    Found in datanator/data_source/kegg_reaction_class.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

                            if doc is not None:
                                uniprot_id.append(doc)
                yield {'org_gene': org_gene_str,
    Severity: Major
    Found in datanator/data_source/gene_ortholog.py - About 45 mins to fix

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

          def __init__(self,

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

            def __init__(self, MongoDB, db, collection, username, password,
        Severity: Minor
        Found in datanator/data_source/protein_localization/justin_10.1038_msb.2011.38.py - About 45 mins to fix

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

              def filter_comments(self, comments, enz_id):
                  filtered_comments = []
                  for comment in comments:
                      has_comment = False
                      for enz_ref_id in comment['enz_ref_ids']:
          Severity: Minor
          Found in datanator/data_source/brenda/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 fill_ec_meta has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def fill_ec_meta(self, start=0):
                  """Fill sabio documents with ec meta information.
                  """
                  query = {}
                  docs = self.collection.find(filter=query)
          Severity: Minor
          Found in datanator/data_source/sabio_rk_json_mongo.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

                                  if "YMDB" in loc["reference"]:
                                      values_y.append({"type": "cellular_location",
                                                      "value": l})
                                  else:
                                      values_e.append({"type": "cellular_location",
          Severity: Major
          Found in datanator/schema_2/transform_metabolites_meta.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if re.search(pattern, k):
                                        value["value"] = v * 3600.0
                                        genotype["cellLine"] = k
                                        value["units"] = "s"
                                    elif k == "note":
            Severity: Major
            Found in datanator/schema_2/transform.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if rel_dirname == '.':
                                          rel_subdirname = subdirname
                                      else:
                                          rel_subdirname = os.path.join(rel_dirname, subdirname)
                                      os.makedirs(os.path.join(root_tmp_path, rel_subdirname))
              Severity: Major
              Found in datanator/core/data_source.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if isinstance(val, str):
                                            entity["identifiers"].append({"namespace": key,
                                                                        "value": val})
                                        elif isinstance(val, list):
                                            for _id in val:
                Severity: Major
                Found in datanator/schema_2/transform.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          for ref in val:
                                              source.append({"namespace": list(ref.keys())[0],
                                                          "value": list(ref.values())[0]})
                                      elif key == "gene_name":
                  Severity: Major
                  Found in datanator/schema_2/transform.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if rel_dirname == '.':
                                                rel_filename = filename
                                            else:
                                                rel_filename = os.path.join(rel_dirname, filename)
                                            os.symlink(os.path.join(root_cache_path, rel_filename),
                    Severity: Major
                    Found in datanator/core/data_source.py - About 45 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                          if other_part.specie.structure == part.specie.structure and \
                                                  other_part.specie.id == part.specie.id and \
                                                  ((other_part.compartment is None and part.compartment is None) or
                                                      other_part.compartment.id == part.compartment.id) and \
                                                  numpy.sign(other_part.coefficient) == numpy.sign(part.coefficient):
                      Severity: Major
                      Found in datanator/core/data_model.py - About 40 mins to fix

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

                            def fill_trna_primary(self, file_location, sheet_name='tRNA', start_row=[0],
                        Severity: Minor
                        Found in datanator/data_source/rna_modification/rna_modification.py - About 35 mins to fix

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

                              def fill_trna_collection(self, file_location, start_row=0,
                          Severity: Minor
                          Found in datanator/data_source/rna_modification/rna_modification.py - About 35 mins to fix

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

                                def create_kinetic_law_from_sbml(self, id, sbml, specie_properties, functions, units):
                            Severity: Minor
                            Found in datanator/data_source/sabio_rk.py - About 35 mins to fix

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

                                  def _flatten_conc_obj(self, obj, ncbi_id, species_name, _id, source='ECMDB'):

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

                                    def run(self, in_obo_filename=None, in_tsv_filename=None, in_monomers_filename=None, max_num_proteins=None,
                                Severity: Minor
                                Found in datanator/data_source/protein_modification/pro.py - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language