SEIAROTg/autobean

View on GitHub
autobean/utils/plugin_test_utils.py

Summary

Maintainability
A
3 hrs
Test Coverage
B
87%

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('_'):
Severity: Minor
Found in autobean/utils/plugin_test_utils.py - About 1 hr to fix

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:
Severity: Minor
Found in autobean/utils/plugin_test_utils.py - About 55 mins to fix

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:
Severity: Minor
Found in autobean/utils/plugin_test_utils.py - About 55 mins to fix

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

There are no issues that match your filters.

Category
Status