Showing 179 of 179 total issues

Avoid too many return statements within this function.
Open

    return False
Severity: Major
Found in noma/node.py - About 30 mins to fix

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

    def usb_devs():
        """list usb devices"""
        devices = []
        for device in glob.glob("/sys/block/*"):
            for pattern in USB_DEV_PATTERN:
    Severity: Minor
    Found in noma/usb.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

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

    def lnd_fn(args):
        """
        lnd related functionality
        """
        if args["create"]:
    Severity: Minor
    Found in noma/noma.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

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

    def check():
        """Check bitcoind filesystem structure"""
        bitcoind_dir = "/media/archive/archive/bitcoin"
        bitcoind_dir_exists = pathlib.Path(bitcoind_dir).is_dir()
    
    
    Severity: Minor
    Found in noma/bitcoind.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

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

    def check():
        """Check lnd filesystem structure"""
        if cfg.LND_PATH.is_dir():
            print("✅ lnd directory exists")
        else:
    Severity: Minor
    Found in noma/lnd.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

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

    def check_to_fetch(file_path, url):
        """Check and fetch if necessary"""
        filename = file_path.split("/")[-1]
        path_list = file_path.split("/")[:-1]
        dir_path = "/".join(path_list)
    Severity: Minor
    Found in noma/install.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

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

    def sd_devs():
        """list sd devices"""
        devices = []
        for device in glob.glob("/sys/block/*"):
            for pattern in SD_DEV_PATTERN:
    Severity: Minor
    Found in noma/usb.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

    Line too long (82 > 79 characters)
    Open

        """Attempt to mount partition at path using ext4 first and falling back to any
    Severity: Minor
    Found in noma/install.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (127 > 79 characters)
    Open

            "https://raw.githubusercontent.com/lncm/pi-factory/b12c6f43d11be58dac03a2513cfd2abbb16f6526/etc/init.d/docker-compose",
    Severity: Minor
    Found in noma/install.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (82 > 79 characters)
    Open

        :device str: arm, core, h264, isp, v3d, uart, pwm, emmc, pixel, vec, hdmi, dpi
    Severity: Minor
    Found in noma/node.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (84 > 79 characters)
    Open

            "https://raw.githubusercontent.com/lncm/invoicer-ui/master/dist/index.html",
    Severity: Minor
    Found in noma/install.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (84 > 79 characters)
    Open

            success = call(["docker", "exec", cfg.LND_MODE + "_lnd_1", "lncli", "stop"])
    Severity: Minor
    Found in noma/node.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (83 > 79 characters)
    Open

                            "{d} formatted with ext4 successfully and mounted.".format(
    Severity: Minor
    Found in noma/install.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (95 > 79 characters)
    Open

            help='leave empty to generate a random password or specify "-" to prompt for password',
    Severity: Minor
    Found in noma/rpcauth.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (81 > 79 characters)
    Open

        """Either load the wallet password from PASSWORD_FILE_PATH, or generate a new
    Severity: Minor
    Found in noma/lnd.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Starting a process with a partial executable path
    Open

            call(["docker", "start", "compose_bitcoind_1"])
    Severity: Info
    Found in noma/bitcoind.py by bandit

    Consider possible security implications associated with run module.
    Open

    from subprocess import run, call, Popen, PIPE, DEVNULL, STDOUT
    Severity: Info
    Found in noma/install.py by bandit

    subprocess call - check for execution of untrusted input.
    Open

        add_boot = run(["rc-update", "add", "swap", "boot"])
    Severity: Info
    Found in noma/install.py by bandit

    subprocess call - check for execution of untrusted input.
    Open

                unmounted = call(["umount", "-f", "/dev/" + device])
    Severity: Info
    Found in noma/install.py by bandit

    subprocess call - check for execution of untrusted input.
    Open

            swapon = run(
                ["swapon", "/media/volatile/volatile/swap", "-p 100"],
                stdout=PIPE,
                stderr=STDOUT,
    Severity: Info
    Found in noma/install.py by bandit
    Severity
    Category
    Status
    Source
    Language