Function load_test_suite
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def load_test_suite(tests_path: str, suite: str) -> tuple[list[str], list[Testcase]]:
full_path = os.path.join(tests_path, suite)
ids = list[str]()
testcases = list[Testcase]()
if not os.path.isdir(full_path) or suite.startswith('.') or suite.startswith('_'):
- 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 assert_same_errors
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def assert_same_errors(actuals: list[error_lib.Error], expecteds: ExpectedErrors) -> None:
actual_errors = ExpectedErrors()
matched_expected_errors = ExpectedErrors()
unmatched_expected_errors = copy.deepcopy(expecteds)
for actual in actuals:
- 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 generate_goldens
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def generate_goldens(path: str, suite: str, plugin: Plugin) -> None:
_, testcases = load_test_suite(path, suite)
if not testcases:
print(f'No testcases found for {suite}.')
for testcase in testcases:
- 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"