Aiscalate/aiscalator

View on GitHub

Showing 36 of 55 total issues

File config.py has 651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Apache Software License 2.0
#
# Copyright (c) 2018, Christophe Duong
#
Severity: Major
Found in src/aiscalator/core/config.py - About 1 day to fix

    Function _validate_configs has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def _validate_configs(test, reference, path,
                          missing_exception=True,
                          type_mismatch_exception=True):
        """
        Recursively check two configs if they match
    Severity: Minor
    Found in src/aiscalator/core/config.py - About 4 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 command.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # Apache Software License 2.0
    #
    # Copyright (c) 2018, Christophe Duong
    #
    Severity: Minor
    Found in src/aiscalator/airflow/command.py - About 4 hrs to fix

      File utils.py has 317 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      # Apache Software License 2.0
      #
      # Copyright (c) 2018, Christophe Duong
      #
      Severity: Minor
      Found in src/aiscalator/core/utils.py - About 3 hrs to fix

        Function _split_workspace_string has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

        def _split_workspace_string(conf: AiscalatorConfig, workspace):
            """
            Interprets the workspace string and split into src and dst
            paths:
            - The src is a path on the host machine.
        Severity: Minor
        Found in src/aiscalator/airflow/command.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

        File command.py has 313 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        # Apache Software License 2.0
        #
        # Copyright (c) 2018, Christophe Duong
        #
        Severity: Minor
        Found in src/aiscalator/jupyter/command.py - About 3 hrs to fix

          AiscalatorConfig has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class AiscalatorConfig:
              """
              A configuration object for the Aiscalator application.
          
              This object stores:
          Severity: Minor
          Found in src/aiscalator/core/config.py - About 3 hrs to fix

            Function _prepare_build_dir has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            def _prepare_build_dir(conf, dst, input_docker_src):
                """
                Copies all necessary files for building docker images in a tmp folder,
                substituting some specific macros accordingly to handle customized
                images such as:
            Severity: Minor
            Found in src/aiscalator/jupyter/docker_image.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 _mount_path has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            def _mount_path(conf: AiscalatorConfig, field, target_path,
                            readonly=False, make_dirs=False):
                """
                Returu commands to mount path from list field into the
                docker image when running.
            Severity: Minor
            Found in src/aiscalator/jupyter/command.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

            File docker_image.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            # Apache Software License 2.0
            #
            # Copyright (c) 2018, Christophe Duong
            #
            Severity: Minor
            Found in src/aiscalator/jupyter/docker_image.py - About 2 hrs to fix

              Function copy_replace has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              def copy_replace(src, dst, pattern=None, replace_value=None):
                  """
                  Copies a file from src to dst replacing pattern by replace_value
              
                  Parameters
              Severity: Minor
              Found in src/aiscalator/core/utils.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 user_env_file has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def user_env_file(self, job=None) -> list:
                      """
                      Find a list of env files to pass to docker containers
              
                      Parameters
              Severity: Minor
              Found in src/aiscalator/core/config.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 _prepare_docker_image_env has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              def _prepare_docker_image_env(conf: AiscalatorConfig):
                  """
                  Assemble the list of volumes to mount specific to
                  building the docker image
              
              
              Severity: Minor
              Found in src/aiscalator/jupyter/command.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 run_auto_update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              def run_auto_update():
                  """
                  Checks and tries to update Aiscalator itself from Pypi if necessary
                  """
                  version = pip_list = grep = sed = pip_install = None
              Severity: Minor
              Found in src/aiscalator/jupyter/cli.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 _select_config has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              def _select_config(conf,
                                 root_node: str, child_node: str,
                                 selection: str):
                  """
                  Extract the list of step objects corresponding to
              Severity: Minor
              Found in src/aiscalator/core/config.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 _find_config_tree has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              def _find_config_tree(tree: pyhocon.ConfigTree, target_node, path="") -> list:
                  """
                  Find all target_node objects in the Configuration object and report
                  their paths.
              
              
              Severity: Minor
              Found in src/aiscalator/core/config.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 install_python has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def install_python(version, arch, home):
                  print("Installing Python", version, "for", arch, "bit architecture to", home)
                  if exists(home):
                      return
              
              
              Severity: Minor
              Found in ci/appveyor-bootstrap.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 jupyter_run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def jupyter_run(conf: AiscalatorConfig, prepare_only=False,
                              param=None, param_raw=None):
                  """
                  Executes the step in browserless mode using papermill
              
              
              Severity: Minor
              Found in src/aiscalator/jupyter/command.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 _prepare_docker_env has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def _prepare_docker_env(conf: AiscalatorConfig, program, reason):
                  """
                  Assembles the list of commands to execute a docker run call
              
                  When calling "docker run ...", this function also adds a set of
              Severity: Minor
              Found in src/aiscalator/jupyter/command.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 airflow_setup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def airflow_setup(conf: AiscalatorConfig,
                                config_home: str,
                                workspace: list,
                                append: bool = True):
                  """
              Severity: Minor
              Found in src/aiscalator/airflow/command.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

              Severity
              Category
              Status
              Source
              Language