File validate.py
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Standard Library
import copy
import re
from typing import List, Tuple
Function validate_annotation
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def validate_annotation(annotation):
"""Check elasticsearch index for annotation term"""
if not annotation.get("hash", False):
annotation_str = get_annotation_str(annotation)
- 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 validate_sections
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate_sections(nanopub: NanopubR, validation_level: str = "complete") -> NanopubR:
"""Validate Nanopub sections"""
if not isinstance(nanopub, dict):
nanopub = nanopub.dict(exclude_unset=True, exclude_none=True)
- 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 validate_annotations
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def validate_annotations(annotations: List[dict], validation_level: str):
"""Validate annotations
Args:
annotations (List[dict]): List of annotation objects
- 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 validate_assertion
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_assertion(assertion_obj: AssertionStr, *, version: str = "latest"):
""" Validate single assertion """
bo = bel.lang.belobj.BEL(assertion_obj, version=version)
- 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 validate_assertions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_assertions(
assertions: List[dict], *, version: str = "latest", validation_level: str = "complete"
):
"""Validate assertions
- 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 get_cached_assertion_validations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_cached_assertion_validations(assertions, validation_level):
""" Collect cached validations for assertions"""
# Get hash keys for missing validations
hashes = []
- 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 get_cached_annotation_validations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_cached_annotation_validations(annotations):
""" Collect cached validations for annotations"""
# Get hash keys for missing validations
hashes = []
- 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"