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
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.
- Read upRead up
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.
- Read upRead up
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.
- Read upRead up
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(
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:
- Read upRead up
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,
- Read upRead up
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.
- Read upRead up
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).
- Read upRead up
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"