daemonslayer/tests-airflow

View on GitHub

Showing 20 of 51 total issues

File hive_hooks.py has 664 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.py - About 1 day to fix

    Function test_hql has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_hql(self, hql):
            """
            Test an hql statement using the hive cli and EXPLAIN
    
            """
    Severity: Minor
    Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.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_cli_cmd has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def _prepare_cli_cmd(self):
            """
            This function creates the command list from available information
            """
            conn = self.conn
    Severity: Minor
    Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.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_cli has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_cli(self, hql, schema=None, verbose=True, hive_conf=None):
            """
            Run an hql statement using the hive cli. If hive_conf is specified
            it should be a dict and the entries will be set as key/value pairs
            in HiveConf
    Severity: Minor
    Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.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 __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in src/etl/examples/hive-example/dags/acme/operators/hive_operators.py - About 1 hr to fix

      Function load_df has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def load_df(
      Severity: Major
      Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.py - About 1 hr to fix

        Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in src/etl/examples/etl-example/dags/acme/operators/dwh_operators.py - About 1 hr to fix

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

              def load_file(
                      self,
                      filepath,
                      table,
                      delimiter=",",
          Severity: Minor
          Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.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

          Method gsob has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static TableSchema gsob() throws IOException {
                  List<TableFieldSchema> fields = new ArrayList<>();
                  fields.add(new TableFieldSchema().setName("partition_date").setType("DATE").setMode("NULLABLE"));
                  fields.add(new TableFieldSchema().setName("temperature_mean").setType("FLOAT").setMode("NULLABLE"));
                  fields.add(new TableFieldSchema().setName("temperature_min").setType("FLOAT").setMode("NULLABLE"));

            Function load_file has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def load_file(
            Severity: Major
            Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.py - About 1 hr to fix

              Function to_csv has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def to_csv(
              Severity: Major
              Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.py - About 50 mins to fix

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

                    def __init__(
                Severity: Minor
                Found in src/etl/examples/etl-example/dags/acme/operators/dwh_operators.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if not rows:
                                              break
                  
                  
                  Severity: Major
                  Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.py - About 45 mins to fix

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

                        def __init__(self,
                    Severity: Minor
                    Found in src/etl/examples/file-ingest/acme/operators/file_operators.py - About 35 mins to fix

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

                          def __init__(
                      Severity: Minor
                      Found in src/etl/examples/etl-example/dags/acme/operators/dwh_operators.py - About 35 mins to fix

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

                            def __init__(self,
                        Severity: Minor
                        Found in src/etl/examples/file-ingest/acme/operators/file_operators.py - About 35 mins to fix

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

                              def __init__(
                          Severity: Minor
                          Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.py - About 35 mins to fix

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

                                def transfer_data_file(self, filepath, verbose=True):
                                        filename = os.path.basename(filepath)
                                        destination_path = '/user/cloudera/{0}'.format(filename)
                            
                                        hdfs_cmd = ['hdfs','dfs','-put',filepath,destination_path]
                            Severity: Minor
                            Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.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

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

                                def get_results(self, hql, schema='default', arraysize=1000):
                                    from impala.error import ProgrammingError
                                    with self.get_conn(schema) as conn:
                                        if isinstance(hql, basestring):
                                            hql = [hql]
                            Severity: Minor
                            Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.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 get_metastore_client has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def get_metastore_client(self):
                                    """
                                    Returns a Hive thrift client.
                                    """
                                    from thrift.transport import TSocket, TTransport
                            Severity: Minor
                            Found in src/etl/examples/hive-example/dags/acme/hooks/hive_hooks.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