avocado-framework/avocado

View on GitHub
avocado/core/tags.py

Summary

Maintainability
C
1 day
Test Coverage
A
100%

Function filter_tags_on_runnables has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

def filter_tags_on_runnables(
    resolutions, filter_by_tags, include_empty=False, include_empty_key=False
):
    """
    Filters out runnables that do not match the tags criteria given
Severity: Minor
Found in avocado/core/tags.py - About 5 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 _must_key_val_matches has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _must_key_val_matches(must_key_vals, test_tags, include_empty_key):
    """
    Checks if the required key:vals are fulfilled by the test_tags

    :rtype: bool
Severity: Minor
Found in avocado/core/tags.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

Avoid deeply nested control flow statements.
Open

                    if not must_flat.issubset(test_tags):
                        continue

Severity: Major
Found in avocado/core/tags.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if not _must_key_val_matches(
                            must_key_val, test_tags, include_empty_key
                        ):
                            continue
    
    
    Severity: Major
    Found in avocado/core/tags.py - About 45 mins to fix

      Function _parse_filter_by_tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _parse_filter_by_tags(filter_by_tags):
          """
          Parses the various filter by tags in "command line" format
      
          The filtering of tests usually happens my means of "--filter-by-tags"
      Severity: Minor
      Found in avocado/core/tags.py - About 35 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