Aiscalate/aiscalator

View on GitHub

Showing 55 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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      @jupyter.command()
      @click.argument('conf', type=click.Path(exists=True))
      @click.argument('notebook', nargs=-1)
      @click.option('-p', '--param', type=(str, str), multiple=True)
      @click.option('-r', '--param_raw', type=(str, str), multiple=True)
      Severity: Major
      Found in src/aiscalator/jupyter/cli.py and 1 other location - About 4 hrs to fix
      src/aiscalator/jupyter/cli.py on lines 117..122

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 81.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      @jupyter.command()
      @click.argument('conf', type=click.Path(exists=True))
      @click.argument('notebook', nargs=-1)
      @click.option('-p', '--param', type=(str, str), multiple=True)
      @click.option('-r', '--param_raw', type=(str, str), multiple=True)
      Severity: Major
      Found in src/aiscalator/jupyter/cli.py and 1 other location - About 4 hrs to fix
      src/aiscalator/jupyter/cli.py on lines 137..142

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 81.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      @jupyter.command()
      @click.option('--name', prompt='What is the name of your step?',
                    help="Name of the new step to create",
                    metavar='<STEP>')
      @click.option('-f', '--format', 'output_format',
      Severity: Major
      Found in src/aiscalator/jupyter/cli.py and 1 other location - About 4 hrs to fix
      src/aiscalator/airflow/cli.py on lines 105..114

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 75.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      @airflow.command()
      @click.option('--name', prompt='What is the name of your dag?',
                    help="Name of the new dag to create",
                    metavar='<DAG>')
      @click.option('-f', '--format', 'output_format',
      Severity: Major
      Found in src/aiscalator/airflow/cli.py and 1 other location - About 4 hrs to fix
      src/aiscalator/jupyter/cli.py on lines 69..79

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 75.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  if os.path.exists(file):
                      print("Loading " + file)
                      new = pd.read_csv(file)
                      if data is not None:
                          data = pd.concat([data, new])
              Severity: Major
              Found in resources/example/adv_steps/papermill_step3.py and 1 other location - About 2 hrs to fix
              resources/example/adv_steps/papermill_step2.py on lines 58..64

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 51.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  if os.path.exists(file):
                      print("Loading " + file)
                      new = pd.read_csv(file)
                      if data is not None:
                          data = pd.concat([data, new])
              Severity: Major
              Found in resources/example/adv_steps/papermill_step2.py and 1 other location - About 2 hrs to fix
              resources/example/adv_steps/papermill_step3.py on lines 54..60

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 51.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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 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 _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

              Severity
              Category
              Status
              Source
              Language