File migrations.py
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
from copy import deepcopy
from typing import NamedTuple, Dict
from .prism.core import _ENCRYPTED_FIELD_LEN, _encrypt
Function upgrade
has a Cognitive Complexity of 28 (exceeds 10 allowed). Consider refactoring. Open
def upgrade(cls, metadata: dict, *args, **kwargs) -> MigrationResult:
# these are removal, so cannot downgrade later
metadata.pop("collection_event_list", None)
for partic in metadata.get("participants", []):
- 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 downgrade
has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring. Open
def downgrade(cls, metadata: dict, *args, **kwargs) -> MigrationResult:
if "cytof" in metadata.get("assays", {}):
for batch in metadata["assays"]["cytof"]:
for record in batch["records"]:
if "concatenation_version" in record["input_files"]:
- 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 upgrade
has a Cognitive Complexity of 23 (exceeds 10 allowed). Consider refactoring. Open
def upgrade(cls, metadata: dict, *args, **kwargs) -> MigrationResult:
not_reported = _encrypt("Not reported")
for p in metadata.get("participants", []):
- 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"