avocado-framework/avocado

View on GitHub
avocado/core/varianter.py

Summary

Maintainability
C
7 hrs
Test Coverage
C
72%

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Open

        + hashlib.sha1(fingerprint.encode(astring.ENCODING)).hexdigest()[:4]
Severity: Minor
Found in avocado/core/varianter.py by bandit

File varianter.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Severity: Minor
Found in avocado/core/varianter.py - About 3 hrs to fix

    Function variant_to_str has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def variant_to_str(variant, verbosity, out_args=None, debug=False):
        """
        Reports human readable representation of a variant
    
        :param variant: Valid variant (list of TreeNode-like objects)
    Severity: Minor
    Found in avocado/core/varianter.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 generate_variant_id has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def generate_variant_id(variant):
        """
        Basic function to generate variant-id from a variant
    
        :param variant: Avocado test variant (list of TreeNode-like objects)
    Severity: Minor
    Found in avocado/core/varianter.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 to_str has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_str(self, summary=0, variants=0, **kwargs):  # pylint: disable=W0613
            if not self.variants:
                return ""
            out = []
            for variant in self.variants:
    Severity: Minor
    Found in avocado/core/varianter.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