File parse.py
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Standard Library
import copy
Function find_strings
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def find_strings(assertion_str, components):
"""Find str_args and unknown strings"""
str_spans: List[Span] = []
- 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 find_matching_parens
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_matching_parens(
assertion_str, matched_quotes, errors: List[ValidationError]
) -> Tuple[List[Pair], List[ValidationError]]:
"""Find and return the location of the matching parentheses pairs in s.
- 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 find_functions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_functions(
assertion_str: str,
matched_quotes: List[Pair],
matched_parens: List[Pair],
errors: List[ValidationError],
- 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 find_matching_quotes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_matching_quotes(
assertion_str: str, errors: List[ValidationError]
) -> Tuple[List[Pair], List[ValidationError]]:
"""Find matching quotes using BEL Assertion syntax"""
- 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 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
Function find_functions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_functions(
Function intersect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def intersect(pos: int, spans: List[Optional[Span]]) -> bool:
"""Check to see if pos intersects the provided spans - e.g. quotes"""
if spans:
for span in spans:
- 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"