Function parse_doc_fields
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
def parse_doc_fields(
self, record: dict, allowed_properties: set, remap: Optional[dict] = None
):
"""Parse a record from the API.
- 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
File chembl_transform.py
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Transform class for CHEMBL data."""
import json
from typing import Dict, List, Optional, Set
Function run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def run(
self, data_file: Optional[str] = None, chembl_data_files: Optional[dict] = None
) -> None:
"""Call method and perform needed transformations.
- 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_chembl_activity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_chembl_activity(self, data: List):
"""Parse ChEMBL Activity records.
An activity document links 4 entities,
- assay
- 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
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:
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:
Function parse_chembl_document
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_chembl_document(self, data: List):
"""Parse ChEMBL Document records.
Args:
data: A list of ChEMBL Document records
- 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"