justaddcoffee/kg-emerging-viruses

View on GitHub
kg_covid_19/transform_utils/scibite_cord/scibite_cord.py

Summary

Maintainability
D
2 days
Test Coverage
F
24%

File scibite_cord.py has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""The SciBite CORD transform."""

import gzip
import json
import os
Severity: Minor
Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.py - About 6 hrs to fix

    Function parse_cooccurrence_record has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_cooccurrence_record(
            self, node_handle: Any, edge_handle: Any, record: Dict
        ) -> None:
            """Parse term-cooccurrences.
    
    
    Severity: Minor
    Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.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 parse_annotation_doc has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_annotation_doc(self, node_handle, edge_handle, doc: Dict) -> None:
            """Parse a JSON document corresponding to a publication.
    
            Args:
                node_handle: File handle for nodes.csv.
    Severity: Minor
    Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.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 contract_uri has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def contract_uri(self, iri) -> str:
            """Contract a given IRI.
    
            Contract a given IRI, with special parsing and transformations
            depending on the nature of the IRI.
    Severity: Minor
    Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.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 parse_annotations has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def parse_annotations(
    Severity: Minor
    Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.py - About 35 mins to fix

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

          def load_country_code(self, input_dir: str, output_dir: str) -> None:
              """Load Wikidata country codes."""
              file_path = os.path.join(input_dir, "wikidata_country_codes.tsv")
              if os.path.exists(file_path):
                  with open(file_path, "r") as filehandler:
      Severity: Minor
      Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.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

      Function parse_annotations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_annotations(
              self,
              node_handle: IO,
              edge_handle: IO,
              data_file1: str,
      Severity: Minor
      Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.py - About 25 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 extract_termite_hits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_termite_hits(self, data: Dict) -> Set:
              """Parse termite hits.
      
              Args:
                  node_handle: File handle for nodes.csv.
      Severity: Minor
      Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.py - About 25 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 load_gene_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def load_gene_info(
              self, input_dir: str, output_dir: str, species_id: Optional[List] = None
          ) -> None:
              """Load mappings from NCBI gene_info (gene_info.gz).
      
      
      Severity: Minor
      Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.py - About 25 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

      There are no issues that match your filters.

      Category
      Status