nephila/djangocms-installer

View on GitHub

Showing 27 of 45 total issues

Avoid deeply nested control flow statements.
Open

                    if len(option_value) == 1 and option_value[0] == "en":
                        config.set(SECTION, option_name, "")
                    else:
                        config.set(SECTION, option_name, ",".join(option_value))
                else:
Severity: Major
Found in djangocms_installer/config/ini.py - About 45 mins to fix

    Function cleanup_directory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def cleanup_directory(config_data):
        """
        Asks user for removal of project directory and eventually removes it
        """
        if os.path.exists(config_data.project_directory):
    Severity: Minor
    Found in djangocms_installer/install/__init__.py - About 45 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.
    Open

                        if new_val != "no" and not os.path.isdir(new_val):
                            sys.stdout.write("Given directory does not exists, retry\n")
                            new_val = False
                    if new_val and action.dest == "db":
    Severity: Major
    Found in djangocms_installer/config/__init__.py - About 45 mins to fix

      Function f has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def f(*popenargs, **kwargs):
              if "stdout" in kwargs:
                  raise ValueError("stdout argument not allowed, it will be overridden.")
              process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
              output, unused_err = process.communicate()
      Severity: Minor
      Found in djangocms_installer/compat.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

      Avoid too many return statements within this function.
      Open

              return project_name
      Severity: Major
      Found in djangocms_installer/config/internal.py - About 30 mins to fix

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

        def requirements(req_file, pip_options="", is_file=False, verbose=False):
            args = ["install", "--disable-pip-version-check"]
            if not verbose:
                args.append("-q")
            if pip_options:
        Severity: Minor
        Found in djangocms_installer/install/__init__.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 parse_config_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def parse_config_file(parser, stdin_args):
            """Parse config file.
        
            Returns a list of additional args.
            """
        Severity: Minor
        Found in djangocms_installer/config/ini.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

        Severity
        Category
        Status
        Source
        Language