avocado-framework/avocado

View on GitHub
selftests/check.py

Summary

Maintainability
F
3 days
Test Coverage

File check.py has 705 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3

import argparse
import copy
import glob
Severity: Major
Found in selftests/check.py - About 1 day to fix

    Function main has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(args):  # pylint: disable=W0621
    
        args.dict_tests = {
            "static-checks": False,
            "job-api": False,
    Severity: Minor
    Found in selftests/check.py - About 7 hrs 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 create_suites has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_suites(args):  # pylint: disable=W0621
        suites = []
        config_check = {"run.ignore_missing_references": True}
    
        if args.dict_tests["static-checks"]:
    Severity: Minor
    Found in selftests/check.py - About 2 hrs 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 file_has_content has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def file_has_content(file_path, content, regex):
            """Check if a file has `content`."""
            if os.path.isfile(file_path):
                with open(file_path, "r", encoding="utf-8") as f:
                    lines = f.readlines()
    Severity: Minor
    Found in selftests/check.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

    There are no issues that match your filters.

    Category
    Status