nephila/djangocms-installer

View on GitHub

Showing 27 of 45 total issues

Function parse has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

def parse(args):
    """
    Define the available arguments
    """
    from tzlocal import get_localzone
Severity: Minor
Found in djangocms_installer/config/__init__.py - About 1 day 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 dump_config_file has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

def dump_config_file(filename, args, parser=None):
    """Dump args to config file."""
    config = ConfigParser()
    config.add_section(SECTION)
    if parser is None:
Severity: Minor
Found in djangocms_installer/config/ini.py - About 1 day 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

File __init__.py has 479 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import locale
import os.path
import sys
import warnings
Severity: Minor
Found in djangocms_installer/config/__init__.py - About 7 hrs to fix

    Function _manage_args has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    def _manage_args(parser, args):
        """
        Checks and validate provided input
        """
        for item in data.CONFIGURABLE_OPTIONS:
    Severity: Minor
    Found in djangocms_installer/config/__init__.py - About 7 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

    File __init__.py has 341 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import glob
    import os
    import re
    import shutil
    import subprocess
    Severity: Minor
    Found in djangocms_installer/django/__init__.py - About 4 hrs to fix

      Function _build_settings has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      def _build_settings(config_data):
          """
          Build the django CMS settings dictionary
      
          :param config_data: configuration data
      Severity: Minor
      Found in djangocms_installer/django/__init__.py - About 3 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 copy_files has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      def copy_files(config_data):
          """
          It's a little rude actually: it just overwrites the django-generated urls.py
          with a custom version and put other files in the project directory.
      
      
      Severity: Minor
      Found in djangocms_installer/django/__init__.py - About 3 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 parse has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def parse(args):
          """
          Define the available arguments
          """
          from tzlocal import get_localzone
      Severity: Major
      Found in djangocms_installer/config/__init__.py - About 2 hrs to fix

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

        def execute():
            # Log info and above to console
            logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
        
            config_data = config.parse(sys.argv[1:])
        Severity: Minor
        Found in djangocms_installer/main.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 _convert_config_to_stdin has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def _convert_config_to_stdin(config, parser):
            """Convert config options to stdin args.
        
            Especially boolean values, for more information
            @see https://docs.python.org/3.4/library/configparser.html#supported-datatypes
        Severity: Minor
        Found in djangocms_installer/config/ini.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 towncrier_check has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def towncrier_check(c):  # NOQA
            """ Check towncrier files. """
            output = io.StringIO()
            c.run("git branch --contains HEAD", out_stream=output)
            skipped_branch_prefix = ["pull/", "develop", "master", "HEAD"]
        Severity: Minor
        Found in tasks.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 supported_versions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def supported_versions(django, cms):
            """
            Convert numeric and literal version information to numeric format
            """
            cms_version = None
        Severity: Minor
        Found in djangocms_installer/utils.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 check_install has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def check_install(config_data):
            """
            Here we do some **really** basic environment sanity checks.
        
            Basically we test for the more delicate and failing-prone dependencies:
        Severity: Minor
        Found in djangocms_installer/install/__init__.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_database has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def setup_database(config_data):
            """
            Run the migrate command to create the database schema
        
            :param config_data: configuration data
        Severity: Minor
        Found in djangocms_installer/django/__init__.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 _build_settings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def _build_settings(config_data):
            """
            Build the django CMS settings dictionary
        
            :param config_data: configuration data
        Severity: Minor
        Found in djangocms_installer/django/__init__.py - About 1 hr to fix

          Function patch_settings has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def patch_settings(config_data):
              """
              Modify the settings file created by Django injecting the django CMS
              configuration
          
          
          Severity: Minor
          Found in djangocms_installer/django/__init__.py - About 1 hr to fix

            Function query_yes_no has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def query_yes_no(question, default=None):  # pragma: no cover
                """
                Ask a yes/no question via `raw_input()` and return their answer.
            
                :param question: A string that is presented to the user.
            Severity: Minor
            Found in djangocms_installer/utils.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 patch_settings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def patch_settings(config_data):
                """
                Modify the settings file created by Django injecting the django CMS
                configuration
            
            
            Severity: Minor
            Found in djangocms_installer/django/__init__.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

            Function create_project has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def create_project(config_data):
                """
                Call django-admin to create the project structure
            
                :param config_data: configuration data
            Severity: Minor
            Found in djangocms_installer/django/__init__.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

            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

            Severity
            Category
            Status
            Source
            Language