Showing 111 of 113 total issues
Function get_term_completions
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_term_completions(
Avoid deeply nested control flow statements. Open
if arg["type"] in ["Function", "Modifier"]:
req_args.append(arg.get("values", []))
elif arg["type"] in ["StrArgNSArg", "NSArg", "StrArg"]:
req_args.append(arg["type"])
Function get_term_search
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_term_search(search_term, size, entity_types, annotation_types, species, namespaces):
Avoid deeply nested control flow statements. Open
if re.match("\s*\(", assertion["object"]):
counts["assertions"]["nested"] += 1
Function ordered_pairs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ordered_pairs(left: List[int], right: List[int]) -> List[Union[int, None]]:
"""Return ordered pairs such that every left, right pair has left < right"""
alt = {"left": "right", "right": "left"}
- 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 arg.get("optional", False) and arg.get("multiple", False) is False:
args_summary += "?"
text = f'Zero or one of each function(s): {", ".join([val for val in arg["values"]])}'
elif arg.get("optional", False):
args_summary += "*"
Function subcomponents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def subcomponents(self, subcomponents=None):
"""Generate subcomponents of the BEL subject or object
Args:
AST
- 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 set_single_line
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_single_line(lines):
flag = False
hold = ""
- 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 collect_orthologs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collect_orthologs(self, species_keys: List[Key] = settings.BEL_ORTHOLOGIZE_TARGETS):
"""Get orthologs for BelEntity is orthologizable"""
self.add_entity_types()
self.normalize()
- 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_resource
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_resource(resource_url: str = None, force: bool = False):
"""Load BEL Resource file
Forceupdate will create a new index in Elasticsearch regardless of whether
an index with the resource version already exists.
- 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 not assertion.get("relation") in counts["assertions"]["relations"]:
counts["assertions"]["relations"][assertion.get("relation")] = 1
else:
counts["assertions"]["relations"][assertion.get("relation")] += 1
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid deeply nested control flow statements. Open
if arg["type"] in ["Function", "Modifier"]:
pos_args.append(arg.get("values", []))
elif arg["type"] in ["StrArgNSArg", "NSArg", "StrArg"]:
pos_args.append(arg["type"])
Avoid deeply nested control flow statements. Open
if arg.get("optional", False) and arg.get("multiple", False) is False:
args_summary += "?"
if arg["type"] in ["NSArg"]:
text = f'Zero or one namespace argument of following type(s): {", ".join([val for val in arg["values"]])}'
elif arg["type"] == "StrArgNSArg":
Avoid deeply nested control flow statements. Open
if arg["type"] in ["Function", "Modifier"]:
opt_args.extend(arg.get("values", []))
elif arg["type"] in ["StrArgNSArg", "NSArg", "StrArg"]:
opt_args.append(arg["type"])
Avoid deeply nested control flow statements. Open
if arg["type"] in ["Function", "Modifier"]:
mult_args.extend(arg.get("values", []))
elif arg["type"] in ["NSArg"]:
# Complex and Composite signature has this
mult_args.extend(arg.get("values", []))
Function get_term_completions
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_term_completions(
Consider simplifying this complex logical expression. Open
if fn_arg.type == "Function" and fn_arg.name not in opt_and_mult_args:
errors.append(
ValidationError(
type="Assertion",
severity="Error",
Consider simplifying this complex logical expression. Open
if self.subject or self.relation or self.object:
if self.relation and not self.object:
msg = "Missing Assertion Object"
self.errors.append(ValidationError(type="Assertion", severity="Error", msg=msg))
elif self.object and (not self.subject or not self.relation):
Function find_functions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_functions(