AngellusMortis/game_server_manager

View on GitHub
gs_manager/servers/base.py

Summary

Maintainability
D
2 days
Test Coverage

File base.py has 787 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import getpass
import logging
import os
import signal
import tarfile
Severity: Major
Found in gs_manager/servers/base.py - About 1 day to fix

    Cyclomatic complexity is too high in method restore. (14)
    Open

        @require("backup_directory")
        @require("backup_location")
        @single_instance
        @click.command(cls=ServerCommandClass)
        @click.option(
    Severity: Minor
    Found in gs_manager/servers/base.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method start. (11)
    Open

        @require("start_command")
        @multi_instance
        @click.command(cls=ServerCommandClass)
        @click.option(
            "--no-verify",
    Severity: Minor
    Found in gs_manager/servers/base.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method stop. (9)
    Open

        @multi_instance
        @click.command(cls=ServerCommandClass)
        @click.option(
            "-f",
            "--force",
    Severity: Minor
    Found in gs_manager/servers/base.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method backup. (9)
    Open

        @require("backup_directory")
        @require("backup_location")
        @single_instance
        @click.command(cls=ServerCommandClass)
        @click.option(
    Severity: Minor
    Found in gs_manager/servers/base.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method _find_pid. (7)
    Open

        def _find_pid(self, require: bool = True) -> None:
            command = (
                self.config.start_command.replace('"', '\\"')
                .replace("?", "\\?")
                .replace("+", "\\+")
    Severity: Minor
    Found in gs_manager/servers/base.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method _stop. (7)
    Open

        def _stop(self, pid: Optional[int] = None) -> None:
            stopped = False
            if self._command_exists("stop_command"):
                if self._command_exists("save_command"):
                    self.invoke(
    Severity: Minor
    Found in gs_manager/servers/base.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function restart has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def restart(
    Severity: Minor
    Found in gs_manager/servers/base.py - About 45 mins to fix

      Function stop has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def stop(
      Severity: Minor
      Found in gs_manager/servers/base.py - About 45 mins to fix

        Function restore has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def restore(
        Severity: Minor
        Found in gs_manager/servers/base.py - About 45 mins to fix

          Function start has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def start(
          Severity: Minor
          Found in gs_manager/servers/base.py - About 45 mins to fix

            Function _wait has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _wait(
            Severity: Minor
            Found in gs_manager/servers/base.py - About 45 mins to fix

              Function edit has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def edit(self, force: bool, edit_path: str, *args, **kwargs) -> int:
              Severity: Minor
              Found in gs_manager/servers/base.py - About 35 mins to fix

                Function tail has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def tail(self, follow: bool, num: int, *args, **kwargs) -> int:
                Severity: Minor
                Found in gs_manager/servers/base.py - About 35 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status