iterative/dvc

View on GitHub
dvc/remote/ssh/connection.py

Summary

Maintainability
B
6 hrs
Test Coverage

SSHConnection has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class SSHConnection:
    def __init__(self, host, *args, **kwargs):
        logger.debug(
            "Establishing ssh connection with '{host}' "
            "through port '{port}' as user '{username}'".format(
Severity: Minor
Found in dvc/remote/ssh/connection.py - About 2 hrs to fix

    Function execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(self, cmd):
            stdin, stdout, stderr = self._ssh.exec_command(cmd)
            channel = stdout.channel
    
            stdin.close()
    Severity: Minor
    Found in dvc/remote/ssh/connection.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 makedirs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Wontfix

        def makedirs(self, path):
            # Single stat call will say whether this is a dir, a file or a link
            st_mode = self.st_mode(path)
    
            if stat.S_ISDIR(st_mode):
    Severity: Minor
    Found in dvc/remote/ssh/connection.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 open_max_sftp_channels has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def open_max_sftp_channels(self):
            # If there are more than 1 it means we've already opened max amount
            if len(self._sftp_channels) <= 1:
                while True:
                    try:
    Severity: Minor
    Found in dvc/remote/ssh/connection.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 walk has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def walk(self, directory, topdown=True):
            # NOTE: original os.walk() implementation [1] with default options was
            # used as a template.
            #
            # [1] https://github.com/python/cpython/blob/master/Lib/os.py
    Severity: Minor
    Found in dvc/remote/ssh/connection.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