avocado-framework/avocado

View on GitHub
avocado/core/tapparser.py

Summary

Maintainability
D
1 day
Test Coverage
A
99%

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

            assert state == self._MAIN
Severity: Info
Found in avocado/core/tapparser.py by bandit

Function parse has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(self):
        found_late_test = False
        bailed_out = False
        plan = None
        lineno = 0
Severity: Minor
Found in avocado/core/tapparser.py - About 1 day 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 parse_test has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_test(self, ok, num, name, directive, explanation):
        name = name.strip()
        explanation = explanation.strip() if explanation else None
        if directive is not None:
            directive = directive.upper()
Severity: Minor
Found in avocado/core/tapparser.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

Avoid deeply nested control flow statements.
Open

                        if m.group(2).upper().startswith('SKIP'):
                            if count > 0:
                                yield self.Error('invalid SKIP directive for plan')
                            skipped = True
                        else:
Severity: Major
Found in avocado/core/tapparser.py - About 45 mins to fix

    Function parse_test has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def parse_test(self, ok, num, name, directive, explanation):
    Severity: Minor
    Found in avocado/core/tapparser.py - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status