justaddcoffee/kg-emerging-viruses

View on GitHub

Showing 237 of 237 total issues

Avoid deeply nested control flow statements.
Open

                    if ( conv && s.throws ) {
                        response = conv( response );
                    } else {
                        try {
                            response = conv( response );
Severity: Major
Found in docs/_static/jquery-3.5.1.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
                                    setMatched[ i ] = pop.call( results );
                                }
    Severity: Major
    Found in docs/_static/jquery-3.5.1.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
                                  cur += clazz + " ";
                              }
      Severity: Major
      Found in docs/_static/jquery-3.5.1.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if ( nodeType === 9 ) {
                                if ( ( elem = context.getElementById( m ) ) ) {
        
                                    // Support: IE, Opera, Webkit
                                    // TODO: identify versions
        Severity: Major
        Found in docs/_static/jquery-3.5.1.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if ( !selector ) {
                                  push.apply( results, seed );
                                  return results;
                              }
          Severity: Major
          Found in docs/_static/jquery-3.5.1.js - About 45 mins to fix

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

                def gpa_to_edge_data(self, rec: dict) -> list:
                    """Return an edge with annotations given a parsed gpa entry.
            
                    :param rec: record from gpa iterator
                    :return:

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

            def elastic_search_query(
            Severity: Minor
            Found in kg_covid_19/utils/download_utils.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if remap and k2 in remap.keys():
                                          update_properties(remap[k2], v2)
                                      else:
                                          update_properties(k2, v2)
                              else:
              Severity: Major
              Found in kg_covid_19/transform_utils/chembl/chembl_transform.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for x in v:
                                            r = self.parse_doc_fields(x, allowed_properties, remap)
                                            for k2, v2 in r.items():
                                                update_properties(k2, v2)
                            else:
                Severity: Major
                Found in kg_covid_19/transform_utils/chembl/chembl_transform.py - About 45 mins to fix

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

                  def result_dict_to_tsv(result_dict: dict, outfile: str) -> None:
                      """Convert a result_dict to a TSV for output."""
                      with open(outfile, "wt") as f:
                          # header
                          f.write("\t".join(result_dict["head"]["vars"]) + "\n")
                  Severity: Minor
                  Found in kg_covid_19/query.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

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

                            case 39: // right
                              var nextHref = $('link[rel="next"]').prop('href');
                              if (nextHref) {
                                window.location.href = nextHref;
                                return false;
                  Severity: Minor
                  Found in docs/_static/doctools.js and 1 other location - About 45 mins to fix
                  docs/_static/doctools.js on lines 292..297

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

                  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

                  Avoid deeply nested control flow statements.
                  Open

                                          if protein in string_to_uniprot_id_map:
                                              uniprot_curie = (
                                                  f"UniProtKB:{string_to_uniprot_id_map[protein]}"
                                              )
                                              uniprot_curie = collapse_uniprot_curie(uniprot_curie)
                  Severity: Major
                  Found in kg_covid_19/transform_utils/string_ppi/string_ppi.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if gene not in seen_genes:
                                                seen_genes.add(gene)
                                                ensemble_gene = f"ENSEMBL:{gene}"
                                                gene_informations = self.gene_info_map[
                                                    self.ensembl2ncbi_map[gene]
                    Severity: Major
                    Found in kg_covid_19/transform_utils/string_ppi/string_ppi.py - About 45 mins to fix

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

                      def make_holdouts(
                      Severity: Minor
                      Found in kg_covid_19/make_holdouts.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        if cur_gene_name in linec_split:
                                            #print("found")
                                            found = 1
                                            countORFs = countORFs + 1
                        
                        
                        Severity: Major
                        Found in curated/ORFs/merge_KGCOVID_COVIDscholar_syns.py - About 45 mins to fix

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

                              def make_id_mapping_file(
                          Severity: Minor
                          Found in kg_covid_19/transform_utils/pharmgkb/pharmgkb.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if entity_type == "Gene":
                                                        self.make_pharmgkb_gene_node(
                                                            fh=node,
                                                            this_id=entity_id,
                                                            name=entity_name,
                            Severity: Major
                            Found in kg_covid_19/transform_utils/pharmgkb/pharmgkb.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if not item:
                                                          continue  # not xrefs, skip
                                                      item = item.strip('"')  # remove quotes around each item
                              Severity: Major
                              Found in kg_covid_19/transform_utils/pharmgkb/pharmgkb.py - About 45 mins to fix

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

                                def transform(
                                    input_dir: str, output_dir: str, sources: Optional[List[str]] = None
                                ) -> None:
                                    """Call scripts in kg_covid_19/transform/[source name]/ to transform data.
                                
                                
                                Severity: Minor
                                Found in kg_covid_19/transform.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 self.key_parsed_ids not in dat:
                                                            dat[self.key_parsed_ids] = dict()
                                                        dat[self.key_parsed_ids][key] = value
                                Severity: Major
                                Found in kg_covid_19/transform_utils/pharmgkb/pharmgkb.py - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language