avocado-framework/avocado

View on GitHub
avocado/utils/archive.py

Summary

Maintainability
B
6 hrs
Test Coverage
A
90%

subprocess call - check for execution of untrusted input.
Open

        proc = subprocess.run(
            [zstd_cmd, "-d"],
            input=ZSTD_AVOCADO,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
Severity: Info
Found in avocado/utils/archive.py by bandit

subprocess call - check for execution of untrusted input.
Open

    proc = subprocess.run(
        [zstd_cmd, "-d", path, "-o", output_path],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        check=False,
Severity: Info
Found in avocado/utils/archive.py by bandit

Consider possible security implications associated with subprocess module.
Open

import subprocess
Severity: Info
Found in avocado/utils/archive.py by bandit

File archive.py has 288 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/utils/archive.py - About 2 hrs to fix

    Function _update_zip_extra_attrs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def _update_zip_extra_attrs(self, dst_dir):
            if platform.system() != "Linux":
                LOG.warning("Attr handling in zip files only supported on Linux.")
                return
            # Walk all files and re-create files as symlinks
    Severity: Minor
    Found in avocado/utils/archive.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 compress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def compress(filename, path):
        """
        Compress files in an archive.
    
        :param filename: archive file name.
    Severity: Minor
    Found in avocado/utils/archive.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

    Function gzip_uncompress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def gzip_uncompress(path, output_path):
        """
        Uncompress a gzipped file at path, to either a file or dir at output_path
        """
        with gzip.GzipFile(filename=path, mode="rb") as input_file:
    Severity: Minor
    Found in avocado/utils/archive.py - About 25 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