dangeroustech/StreamDL

View on GitHub
streamdl.py

Summary

Maintainability
A
0 mins
Test Coverage

File streamdl.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Invalid

#!/usr/bin/env python3

# TODO: Figure out what to do with pids/processes as you probably don't need both

import logging
Severity: Minor
Found in streamdl.py - About 2 hrs to fix

    Function mass_downloader has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def mass_downloader(config, outdir):
        """
        Handles the process spawning to download multiple things at once
        """
        global pids
    Severity: Minor
    Found in streamdl.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 process_cleanup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def process_cleanup():
        """
        Cleans up processes to prevent zombies and max recursion depth issues
        """
        global pids
    Severity: Minor
    Found in streamdl.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 setup_logging has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def setup_logging(args):
        global logger
    
        log_format = '%(asctime)s %(levelname)s: %(message)s'
        # check if log path is specified
    Severity: Minor
    Found in streamdl.py - About 55 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

    Avoid deeply nested control flow statements.
    Invalid

                        if twitch_validate(url + "/" + user):
                            p.start()
                            pids[user] = p.pid
                            processes.append(p)
                            logger.debug("Process {} Started with PID {}".format(p.name, p.pid))
    Severity: Major
    Found in streamdl.py - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status