abhioncbr/docker-airflow

View on GitHub
airflowPatch1.10/models.py

Summary

Maintainability
F
4 mos
Test Coverage

File models.py has 4431 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
Severity: Major
Found in airflowPatch1.10/models.py - About 1 wk to fix

    Function process_file has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_file(self, filepath, only_if_updated=True, safe_mode=True):
            """
            Given a path to a python module or zip file, this method imports
            the module and look for dag objects within it.
            """
    Severity: Minor
    Found in airflowPatch1.10/models.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

    DAG has 67 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DAG(BaseDag, LoggingMixin):
        """
        A dag (directed acyclic graph) is a collection of tasks with directional
        dependencies. A dag also has a schedule, a start end an end date
        (optional). For each schedule, (say daily or hourly), the DAG needs to run
    Severity: Major
    Found in airflowPatch1.10/models.py - About 1 day to fix

      BaseOperator has 47 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class BaseOperator(LoggingMixin):
          """
          Abstract base class for all operators. Since operators create objects that
          become nodes in the dag, BaseOperator contains many recursive methods for
          dag crawling behavior. To derive this class, you are expected to override
      Severity: Minor
      Found in airflowPatch1.10/models.py - About 6 hrs to fix

        TaskInstance has 42 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class TaskInstance(Base, LoggingMixin):
            """
            Task instances store the state of a task instance. This table is the
            authority and single source of truth around what tasks have run and the
            state they are in.
        Severity: Minor
        Found in airflowPatch1.10/models.py - About 5 hrs to fix

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

              def __init__(
          Severity: Major
          Found in airflowPatch1.10/models.py - About 4 hrs to fix

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

                def _run_raw_task(
                        self,
                        mark_success=False,
                        test_mode=False,
                        job_id=None,
            Severity: Minor
            Found in airflowPatch1.10/models.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 __init__ has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(
                        self,
                        task_id,
                        owner=configuration.conf.get('operators', 'DEFAULT_OWNER'),
                        email=None,
            Severity: Minor
            Found in airflowPatch1.10/models.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 get_hook has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_hook(self):
                    try:
                        if self.conn_type == 'mysql':
                            from airflow.hooks.mysql_hook import MySqlHook
                            return MySqlHook(mysql_conn_id=self.conn_id)
            Severity: Minor
            Found in airflowPatch1.10/models.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 update_state has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def update_state(self, session=None):
                    """
                    Determines the overall state of the DagRun based on the state
                    of its TaskInstances.
            
            
            Severity: Minor
            Found in airflowPatch1.10/models.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 __init__ has 20 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in airflowPatch1.10/models.py - About 2 hrs to fix

              Function clear_task_instances has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              def clear_task_instances(tis,
                                       session,
                                       activate_dag_runs=True,
                                       dag=None,
                                       ):
              Severity: Minor
              Found in airflowPatch1.10/models.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 handle_failure has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handle_failure(self, error, test_mode=False, context=None, session=None):
                      self.log.exception(error)
                      task = self.task
                      self.end_date = timezone.utcnow()
                      self.set_duration()
              Severity: Minor
              Found in airflowPatch1.10/models.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 __init__ has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def __init__(
                          self,
                          task_id,
                          owner=configuration.conf.get('operators', 'DEFAULT_OWNER'),
                          email=None,
              Severity: Minor
              Found in airflowPatch1.10/models.py - About 1 hr to fix

                Function clear has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def clear(
                            self, start_date=None, end_date=None,
                            only_failed=False,
                            only_running=False,
                            confirm_prompt=False,
                Severity: Minor
                Found in airflowPatch1.10/models.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(
                            self, dag_id,
                            description='',
                            schedule_interval=timedelta(days=1),
                            start_date=None, end_date=None,
                Severity: Minor
                Found in airflowPatch1.10/models.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 generate_command has 14 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def generate_command(dag_id,
                Severity: Major
                Found in airflowPatch1.10/models.py - About 1 hr to fix

                  Function topological_sort has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def topological_sort(self):
                          """
                          Sorts tasks in topographical order, such that a task comes after any of its
                          upstream dependencies.
                  
                  
                  Severity: Minor
                  Found in airflowPatch1.10/models.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 _set_relatives has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _set_relatives(self, task_or_task_list, upstream=False):
                          try:
                              task_list = list(task_or_task_list)
                          except TypeError:
                              task_list = [task_or_task_list]
                  Severity: Minor
                  Found in airflowPatch1.10/models.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 verify_integrity has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def verify_integrity(self, session=None):
                          """
                          Verifies the DagRun by checking for removed tasks or tasks that are not in the
                          database yet. It will set state to removed or add the task if required.
                          """
                  Severity: Minor
                  Found in airflowPatch1.10/models.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 has 13 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def run(
                  Severity: Major
                  Found in airflowPatch1.10/models.py - About 1 hr to fix

                    Function _check_and_change_state_before_execution has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _check_and_change_state_before_execution(
                                self,
                                verbose=True,
                                ignore_all_deps=False,
                                ignore_depends_on_past=False,
                    Severity: Minor
                    Found in airflowPatch1.10/models.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 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def __init__(
                                self, dag_id,
                                description='',
                                schedule_interval=timedelta(days=1),
                                start_date=None, end_date=None,
                    Severity: Minor
                    Found in airflowPatch1.10/models.py - About 1 hr to fix

                      Function get_one has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_one(cls,
                                      execution_date,
                                      key=None,
                                      task_id=None,
                                      dag_id=None,
                      Severity: Minor
                      Found in airflowPatch1.10/models.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 generate_command has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def generate_command(dag_id,
                                               task_id,
                                               execution_date,
                                               mark_success=False,
                                               ignore_all_deps=False,
                      Severity: Minor
                      Found in airflowPatch1.10/models.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 bag_dag has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def bag_dag(self, dag, parent_dag, root_dag):
                              """
                              Adds the DAG into the bag, recurses into sub dags.
                              Throws AirflowDagCycleException if a cycle is detected in this dag or its subdags
                              """
                      Severity: Minor
                      Found in airflowPatch1.10/models.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 command_as_list has 11 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def command_as_list(
                      Severity: Major
                      Found in airflowPatch1.10/models.py - About 1 hr to fix

                        Function command has 11 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def command(
                        Severity: Major
                        Found in airflowPatch1.10/models.py - About 1 hr to fix

                          Function run has 10 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def run(
                          Severity: Major
                          Found in airflowPatch1.10/models.py - About 1 hr to fix

                            Function _check_and_change_state_before_execution has 10 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def _check_and_change_state_before_execution(
                            Severity: Major
                            Found in airflowPatch1.10/models.py - About 1 hr to fix

                              Function previous_ti has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def previous_ti(self, session=None):
                                      """ The task instance for the task that ran before this task instance """
                              
                                      dag = self.task.dag
                                      if dag:
                              Severity: Minor
                              Found in airflowPatch1.10/models.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 get_template_context has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def get_template_context(self, session=None):
                                      task = self.task
                                      from airflow import macros
                                      tables = None
                                      if 'tables' in task.params:
                              Severity: Minor
                              Found in airflowPatch1.10/models.py - About 1 hr to fix

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

                                    def clear(
                                Severity: Major
                                Found in airflowPatch1.10/models.py - About 1 hr to fix

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

                                      def clear_dags(
                                  Severity: Major
                                  Found in airflowPatch1.10/models.py - About 1 hr to fix

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

                                        def __init__(
                                    Severity: Major
                                    Found in airflowPatch1.10/models.py - About 1 hr to fix

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

                                          def get_dag(self, dag_id):
                                              """
                                              Gets the DAG out of the dictionary, and refreshes it if expired
                                              """
                                              # If asking for a known subdag, we want to refresh the parent
                                      Severity: Minor
                                      Found in airflowPatch1.10/models.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 get_template_context has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def get_template_context(self, session=None):
                                              task = self.task
                                              from airflow import macros
                                              tables = None
                                              if 'tables' in task.params:
                                      Severity: Minor
                                      Found in airflowPatch1.10/models.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 get_task_instances has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def get_task_instances(self, state=None, session=None):
                                              """
                                              Returns the task instances for this dag run
                                              """
                                              TI = TaskInstance
                                      Severity: Minor
                                      Found in airflowPatch1.10/models.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_and_change_state_before_execution has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          def _check_and_change_state_before_execution(
                                                  self,
                                                  verbose=True,
                                                  ignore_all_deps=False,
                                                  ignore_depends_on_past=False,
                                      Severity: Minor
                                      Found in airflowPatch1.10/models.py - About 1 hr to fix

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

                                            def find(dag_id=None, run_id=None, execution_date=None,
                                                     state=None, external_trigger=None, no_backfills=False,
                                                     session=None):
                                                """
                                                Returns a set of dag runs for the given search criteria.
                                        Severity: Minor
                                        Found in airflowPatch1.10/models.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 get_many has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            def get_many(cls,
                                        Severity: Major
                                        Found in airflowPatch1.10/models.py - About 50 mins to fix

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

                                              def create_dagrun(self,
                                          Severity: Major
                                          Found in airflowPatch1.10/models.py - About 50 mins to fix

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

                                                def set(
                                            Severity: Minor
                                            Found in airflowPatch1.10/models.py - About 45 mins to fix

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

                                                  def find(dag_id=None, run_id=None, execution_date=None,
                                              Severity: Minor
                                              Found in airflowPatch1.10/models.py - About 45 mins to fix

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

                                                    def clear_dags(
                                                            cls, dags,
                                                            start_date=None,
                                                            end_date=None,
                                                            only_failed=False,
                                                Severity: Minor
                                                Found in airflowPatch1.10/models.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

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

                                                    def add_task(self, task):
                                                        """
                                                        Add a task to the DAG
                                                
                                                        :param task: the task you want to add
                                                Severity: Minor
                                                Found in airflowPatch1.10/models.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

                                                                        with zip_file.open(mod.filename) as zf:
                                                                            self.log.debug("Reading %s from %s", mod.filename, filepath)
                                                                            content = zf.read()
                                                                            if not all([s in content for s in (b'DAG', b'airflow')]):
                                                                                self.file_last_changed[filepath] = (
                                                Severity: Major
                                                Found in airflowPatch1.10/models.py - About 45 mins to fix

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

                                                      def get_one(cls,
                                                  Severity: Minor
                                                  Found in airflowPatch1.10/models.py - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            if dag.fileloc != filepath:
                                                                                dag.fileloc = filepath
                                                                        try:
                                                    Severity: Major
                                                    Found in airflowPatch1.10/models.py - About 45 mins to fix

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

                                                          def get(cls, key, default_var=None, deserialize_json=False, session=None):
                                                              obj = session.query(cls).filter(cls.key == key).first()
                                                              if obj is None:
                                                                  if default_var is not None:
                                                                      return default_var
                                                      Severity: Minor
                                                      Found in airflowPatch1.10/models.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 not self.has_logged:
                                                                                  self.has_logged = True
                                                                                  self.log.info(
                                                                                      "File %s assumed to contain no DAGs. Skipping.",
                                                                                      filepath)
                                                      Severity: Major
                                                      Found in airflowPatch1.10/models.py - About 45 mins to fix

                                                        Consider simplifying this complex logical expression.
                                                        Open

                                                                    if (not unfinished_tasks and
                                                                            any(r.state in (State.FAILED, State.UPSTREAM_FAILED) for r in roots)):
                                                                        self.log.info('Marking run %s failed', self)
                                                                        self.state = State.FAILED
                                                                        dag.handle_callback(self, success=False, reason='task_failure',
                                                        Severity: Major
                                                        Found in airflowPatch1.10/models.py - About 40 mins to fix

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

                                                              def clear(self,
                                                          Severity: Minor
                                                          Found in airflowPatch1.10/models.py - About 35 mins to fix

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

                                                                def _run_raw_task(
                                                            Severity: Minor
                                                            Found in airflowPatch1.10/models.py - About 35 mins to fix

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

                                                                  def xcom_pull(
                                                              Severity: Minor
                                                              Found in airflowPatch1.10/models.py - About 35 mins to fix

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

                                                                    def __init__(self, event, task_instance, owner=None, extra=None, **kwargs):
                                                                Severity: Minor
                                                                Found in airflowPatch1.10/models.py - About 35 mins to fix

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

                                                                      def run(
                                                                  Severity: Minor
                                                                  Found in airflowPatch1.10/models.py - About 35 mins to fix

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

                                                                        def xcom_pull(
                                                                    Severity: Minor
                                                                    Found in airflowPatch1.10/models.py - About 35 mins to fix

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

                                                                          def kill_zombies(self, session=None):
                                                                              """
                                                                              Fails tasks that haven't had a heartbeat in too long
                                                                              """
                                                                              from airflow.jobs import LocalTaskJob as LJ
                                                                      Severity: Minor
                                                                      Found in airflowPatch1.10/models.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 sub_dag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          def sub_dag(self, task_regex, include_downstream=False,
                                                                                      include_upstream=True):
                                                                              """
                                                                              Returns a subset of the current dag as a deep copy of the current dag
                                                                              based on a regex that should match one or many tasks, and includes
                                                                      Severity: Minor
                                                                      Found in airflowPatch1.10/models.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          def __init__(self, event, task_instance, owner=None, extra=None, **kwargs):
                                                                              self.dttm = timezone.utcnow()
                                                                              self.event = event
                                                                              self.extra = extra
                                                                      
                                                                      
                                                                      Severity: Minor
                                                                      Found in airflowPatch1.10/models.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          def update(dag_ids=None, dirty_only=True, session=None):
                                                                              """
                                                                              Updates the stats for dirty/out-of-sync dags
                                                                      
                                                                              :param dag_ids: dag_ids to be updated
                                                                      Severity: Minor
                                                                      Found in airflowPatch1.10/models.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 HiveServer2Hook(hiveserver2_conn_id=self.conn_id)
                                                                      Severity: Major
                                                                      Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                        return CassandraHook(cassandra_conn_id=self.conn_id)
                                                                        Severity: Major
                                                                        Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                          return JiraHook(jira_conn_id=self.conn_id)
                                                                          Severity: Major
                                                                          Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                    return found_dags
                                                                            Severity: Major
                                                                            Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                              return PrestoHook(presto_conn_id=self.conn_id)
                                                                              Severity: Major
                                                                              Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                                return AzureDataLakeHook(azure_data_lake_conn_id=self.conn_id)
                                                                                Severity: Major
                                                                                Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                                  return JdbcHook(jdbc_conn_id=self.conn_id)
                                                                                  Severity: Major
                                                                                  Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                    return MsSqlHook(mssql_conn_id=self.conn_id)
                                                                                    Severity: Major
                                                                                    Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                                      return OracleHook(oracle_conn_id=self.conn_id)
                                                                                      Severity: Major
                                                                                      Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                        return WasbHook(wasb_conn_id=self.conn_id)
                                                                                        Severity: Major
                                                                                        Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                          return SqliteHook(sqlite_conn_id=self.conn_id)
                                                                                          Severity: Major
                                                                                          Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                            return VerticaHook(vertica_conn_id=self.conn_id)
                                                                                            Severity: Major
                                                                                            Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                              return RedisHook(redis_conn_id=self.conn_id)
                                                                                              Severity: Major
                                                                                              Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                                return DockerHook(docker_conn_id=self.conn_id)
                                                                                                Severity: Major
                                                                                                Found in airflowPatch1.10/models.py - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                                  return CloudantHook(cloudant_conn_id=self.conn_id)
                                                                                                  Severity: Major
                                                                                                  Found in airflowPatch1.10/models.py - About 30 mins to fix

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

                                                                                                        def __hash__(self):
                                                                                                            hash_components = [type(self)]
                                                                                                            for c in self._comps:
                                                                                                                # task_ids returns a list and lists can't be hashed
                                                                                                                if c == 'task_ids':
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.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_val has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        def get_val(self):
                                                                                                            log = LoggingMixin().log
                                                                                                            if self._val and self.is_encrypted:
                                                                                                                try:
                                                                                                                    fernet = get_fernet()
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.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 __deepcopy__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        def __deepcopy__(self, memo):
                                                                                                            """
                                                                                                            Hack sorting double chained task lists by task_id to avoid hitting
                                                                                                            max_depth on deepcopy operations.
                                                                                                            """
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.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 render_templates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        def render_templates(self):
                                                                                                            task = self.task
                                                                                                            jinja_context = self.get_template_context()
                                                                                                            if hasattr(self, 'task') and hasattr(self.task, 'dag'):
                                                                                                                if self.task.dag.user_defined_macros:
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.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 resolve_template_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        def resolve_template_files(self):
                                                                                                            # Getting the content of files for template_field / template_ext
                                                                                                            for attr in self.template_fields:
                                                                                                                content = getattr(self, attr)
                                                                                                                if content is not None and \
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        def create(dag_id, session=None):
                                                                                                            """
                                                                                                            Creates the missing states the stats table for the dag specified
                                                                                                    
                                                                                                            :param dag_id: dag id of the dag to create stats for
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.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_failed_dep_statuses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        def get_failed_dep_statuses(
                                                                                                                self,
                                                                                                                dep_context=None,
                                                                                                                session=None):
                                                                                                            dep_context = dep_context or DepContext()
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.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

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

                                                                                                                elif self.conn_type == 'google_cloud_platform':
                                                                                                                    from airflow.contrib.hooks.bigquery_hook import BigQueryHook
                                                                                                                    return BigQueryHook(bigquery_conn_id=self.conn_id)
                                                                                                                elif self.conn_type == 'postgres':
                                                                                                                    from airflow.hooks.postgres_hook import PostgresHook
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 days to fix
                                                                                                    airflowPatch1.9/models.py on lines 654..702

                                                                                                    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 431.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def update(dag_ids=None, dirty_only=True, session=None):
                                                                                                            """
                                                                                                            Updates the stats for dirty/out-of-sync dags
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 days to fix
                                                                                                    airflowPatch1.9/models.py on lines 4290..4341

                                                                                                    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 336.

                                                                                                    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

                                                                                                    def clear_task_instances(tis,
                                                                                                                             session,
                                                                                                                             activate_dag_runs=True,
                                                                                                                             dag=None,
                                                                                                                             ):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 days to fix
                                                                                                    airflowPatch1.9/models.py on lines 119..157

                                                                                                    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 308.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @staticmethod
                                                                                                        def generate_command(dag_id,
                                                                                                                             task_id,
                                                                                                                             execution_date,
                                                                                                                             mark_success=False,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 days to fix
                                                                                                    airflowPatch1.8/models.py on lines 846..911
                                                                                                    airflowPatch1.9/models.py on lines 912..977

                                                                                                    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 290.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                    class Log(Base):
                                                                                                        """
                                                                                                        Used to actively log events to the database
                                                                                                        """
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 days to fix
                                                                                                    airflowPatch1.8/models.py on lines 1710..1747
                                                                                                    airflowPatch1.9/models.py on lines 1903..1940

                                                                                                    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 278.

                                                                                                    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

                                                                                                    class Pool(Base):
                                                                                                        __tablename__ = "slot_pool"
                                                                                                    
                                                                                                        id = Column(Integer, primary_key=True)
                                                                                                        pool = Column(String(50), unique=True)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 days to fix
                                                                                                    airflowPatch1.9/models.py on lines 4732..4785

                                                                                                    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 273.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def find(dag_id=None, run_id=None, execution_date=None,
                                                                                                                 state=None, external_trigger=None, no_backfills=False,
                                                                                                                 session=None):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 days to fix
                                                                                                    airflowPatch1.9/models.py on lines 4444..4491

                                                                                                    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 246.

                                                                                                    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

                                                                                                        @classmethod
                                                                                                        def clear_dags(
                                                                                                                cls, dags,
                                                                                                                start_date=None,
                                                                                                                end_date=None,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 days to fix
                                                                                                    airflowPatch1.9/models.py on lines 3449..3502

                                                                                                    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 231.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_task_instances(self, state=None, session=None):
                                                                                                            """
                                                                                                            Returns the task instances for this dag run
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 3934..3960
                                                                                                    airflowPatch1.9/models.py on lines 4493..4519

                                                                                                    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 201.

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def sync_to_db(self, owner=None, sync_time=None, session=None):
                                                                                                            """
                                                                                                            Save attributes about this DAG to the DB. Note that this method
                                                                                                            can be called for both DAGs and SubDAGs. A SubDag is actually a
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 3786..3819

                                                                                                    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 200.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def get_dag(self, dag_id):
                                                                                                            """
                                                                                                            Gets the DAG out of the dictionary, and refreshes it if expired
                                                                                                            """
                                                                                                            # If asking for a known subdag, we want to refresh the parent
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 188..217
                                                                                                    airflowPatch1.9/models.py on lines 210..239

                                                                                                    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 194.

                                                                                                    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

                                                                                                        def next_retry_datetime(self):
                                                                                                            """
                                                                                                            Get datetime of the next retry if the task instance fails. For exponential
                                                                                                            backoff, retry_delay is used as base and will be converted to seconds.
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 1227..1252

                                                                                                    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 185.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def command_as_list(
                                                                                                                self,
                                                                                                                mark_success=False,
                                                                                                                ignore_all_deps=False,
                                                                                                                ignore_task_deps=False,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 801..832
                                                                                                    airflowPatch1.9/models.py on lines 867..898

                                                                                                    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 166.

                                                                                                    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 dag_run:
                                                                                                                session.query(TaskInstance).filter(
                                                                                                                    TaskInstance.dag_id == dag_run.dag_id,
                                                                                                                    TaskInstance.execution_date == dag_run.execution_date,
                                                                                                                    TaskInstance.task_id.in_(task_ids)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 1959..1981

                                                                                                    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 163.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def pickle(self, session=None):
                                                                                                            dag = session.query(
                                                                                                                DagModel).filter(DagModel.dag_id == self.dag_id).first()
                                                                                                            dp = None
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 3222..3237
                                                                                                    airflowPatch1.9/models.py on lines 3576..3591

                                                                                                    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 160.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        @provide_session
                                                                                                        def previous_ti(self, session=None):
                                                                                                            """ The task instance for the task that ran before this task instance """
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 1063..1091
                                                                                                    airflowPatch1.9/models.py on lines 1132..1160

                                                                                                    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 149.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def create(dag_id, session=None):
                                                                                                            """
                                                                                                            Creates the missing states the stats table for the dag specified
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 4343..4365

                                                                                                    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 145.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                    class KnownEvent(Base):
                                                                                                        __tablename__ = "known_event"
                                                                                                    
                                                                                                        id = Column(Integer, primary_key=True)
                                                                                                        label = Column(String(200))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 3504..3522
                                                                                                    airflowPatch1.9/models.py on lines 3928..3946

                                                                                                    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 143.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def topological_sort(self):
                                                                                                            """
                                                                                                            Sorts tasks in topographical order, such that a task comes after any of its
                                                                                                            upstream dependencies.
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 3025..3073
                                                                                                    airflowPatch1.9/models.py on lines 3322..3371

                                                                                                    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 140.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def get_num_task_instances(dag_id, task_ids, states=None, session=None):
                                                                                                            """
                                                                                                            Returns the number of task instances in the given DAG.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 3864..3890

                                                                                                    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 139.

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def pickle_info(self, session=None):
                                                                                                            d = {}
                                                                                                            d['is_picklable'] = True
                                                                                                            try:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 3561..3574

                                                                                                    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 138.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def are_dependents_done(self, session=None):
                                                                                                            """
                                                                                                            Checks whether the dependents of this task instance have all succeeded.
                                                                                                            This is meant to be used by wait_for_downstream.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 1039..1061
                                                                                                    airflowPatch1.9/models.py on lines 1108..1130

                                                                                                    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 134.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                    class SlaMiss(Base):
                                                                                                        """
                                                                                                        Model that stores a history of the SLA that have been missed.
                                                                                                        It is used to keep track of SLA failures over time and to avoid double
                                                                                                        triggering alert emails.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 4213..4231
                                                                                                    airflowPatch1.9/models.py on lines 4788..4806

                                                                                                    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 130.

                                                                                                    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

                                                                                                        def resolve_template_files(self):
                                                                                                            # Getting the content of files for template_field / template_ext
                                                                                                            for attr in self.template_fields:
                                                                                                                content = getattr(self, attr)
                                                                                                                if content is not None and \
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 2495..2507

                                                                                                    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 129.

                                                                                                    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

                                                                                                        def get_run_dates(self, start_date, end_date=None):
                                                                                                            """
                                                                                                            Returns a list of dates between the interval received as parameter using this
                                                                                                            dag's schedule interval. Returned dates can be used for execution dates.
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 3014..3044

                                                                                                    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 129.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def set_dirty(dag_id, session=None):
                                                                                                            """
                                                                                                            :param dag_id: the dag_id to mark dirty
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 day to fix
                                                                                                    airflowPatch1.9/models.py on lines 4266..4288

                                                                                                    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 126.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if include_subdags:
                                                                                                                # Crafting the right filter for dag_id and task_ids combo
                                                                                                                conditions = []
                                                                                                                for dag in self.subdags + [self]:
                                                                                                                    conditions.append(
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 day to fix
                                                                                                    airflowPatch1.8/models.py on lines 3100..3110
                                                                                                    airflowPatch1.9/models.py on lines 3398..3409

                                                                                                    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 124.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def render_templates(self):
                                                                                                            task = self.task
                                                                                                            jinja_context = self.get_template_context()
                                                                                                            if hasattr(self, 'task') and hasattr(self.task, 'dag'):
                                                                                                                if self.task.dag.user_defined_macros:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 7 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 1567..1580
                                                                                                    airflowPatch1.9/models.py on lines 1749..1762

                                                                                                    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 121.

                                                                                                    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

                                                                                                        def __deepcopy__(self, memo):
                                                                                                            # Swiwtcharoo to go around deepcopying objects coming through the
                                                                                                            # backdoor
                                                                                                            cls = self.__class__
                                                                                                            result = cls.__new__(cls)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 7 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3504..3517

                                                                                                    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 119.

                                                                                                    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

                                                                                                            if not runnable and not mark_success:
                                                                                                                # FIXME: we might have hit concurrency limits, which means we probably
                                                                                                                # have been running prematurely. This should be handled in the
                                                                                                                # scheduling mechanism.
                                                                                                                self.state = State.NONE
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 7 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1381..1396

                                                                                                    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 119.

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def create_dagrun(self,
                                                                                                                          run_id,
                                                                                                                          state,
                                                                                                                          execution_date=None,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 7 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3735..3784

                                                                                                    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 115.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def render_template(self, attr, content, context):
                                                                                                            """
                                                                                                            Renders a template either from a file or directly in a field, and returns
                                                                                                            the rendered result.
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 7 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2232..2247
                                                                                                    airflowPatch1.9/models.py on lines 2469..2484

                                                                                                    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 113.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @dag.setter
                                                                                                        def dag(self, dag):
                                                                                                            """
                                                                                                            Operators can be assigned to one DAG, one time. Repeat assignments to
                                                                                                            that same DAG are ok.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 7 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2096..2111
                                                                                                    airflowPatch1.9/models.py on lines 2331..2346

                                                                                                    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 110.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def refresh_from_db(self, session=None):
                                                                                                            """
                                                                                                            Reloads the current dagrun from the database
                                                                                                            :param session: database session
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3875..3892
                                                                                                    airflowPatch1.9/models.py on lines 4425..4442

                                                                                                    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 109.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __hash__(self):
                                                                                                            hash_components = [type(self)]
                                                                                                            for c in self._comps:
                                                                                                                # task_ids returns a list and lists can't be hashed
                                                                                                                if c == 'task_ids':
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2716..2729
                                                                                                    airflowPatch1.9/models.py on lines 2964..2977

                                                                                                    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 109.

                                                                                                    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

                                                                                                        @classmethod
                                                                                                        @provide_session
                                                                                                        def get_latest_runs(cls, session):
                                                                                                            """Returns the latest DagRun for each DAG. """
                                                                                                            subquery = (
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 6 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 4709..4729

                                                                                                    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 107.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @classmethod
                                                                                                        @provide_session
                                                                                                        def get(cls, key, default_var=None, deserialize_json=False, session=None):
                                                                                                            obj = session.query(cls).filter(cls.key == key).first()
                                                                                                            if obj is None:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3590..3603
                                                                                                    airflowPatch1.9/models.py on lines 4022..4035

                                                                                                    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 105.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_last_dagrun(self, session=None, include_externally_triggered=False):
                                                                                                            """
                                                                                                            Returns the last dag run for this dag, None if there was none.
                                                                                                            Last dag run can be any type of run eg. scheduled or backfilled.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2781..2799
                                                                                                    airflowPatch1.9/models.py on lines 3061..3079

                                                                                                    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 104.

                                                                                                    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

                                                                                                        def get_template_env(self):
                                                                                                            """
                                                                                                            Returns a jinja2 Environment while taking into account the DAGs
                                                                                                            template_searchpath, user_defined_macros and user_defined_filters
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 6 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3272..3290

                                                                                                    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 101.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def run(
                                                                                                                self,
                                                                                                                start_date=None,
                                                                                                                end_date=None,
                                                                                                                ignore_first_depends_on_past=False,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2369..2386
                                                                                                    airflowPatch1.9/models.py on lines 2604..2621

                                                                                                    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 100.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def get_task_instances(self, session, start_date=None, end_date=None):
                                                                                                            """
                                                                                                            Get a set of task instance related to this task for a specific date
                                                                                                            range.
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2327..2339
                                                                                                    airflowPatch1.9/models.py on lines 2562..2574

                                                                                                    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 100.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def deactivate_stale_dags(expiration_date, session=None):
                                                                                                            """
                                                                                                            Deactivate any DAGs that were last touched by the scheduler before
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 6 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3840..3862

                                                                                                    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 99.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def current_state(self, session=None):
                                                                                                            """
                                                                                                            Get the very latest state from the database, if a session is passed,
                                                                                                            we use and looking up the state becomes part of the session, otherwise
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 945..962
                                                                                                    airflowPatch1.9/models.py on lines 1011..1028

                                                                                                    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 98.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def dagbag_report(self):
                                                                                                            """Prints a report around DagBag loading stats"""
                                                                                                            report = textwrap.dedent("""\n
                                                                                                            -------------------------------------------------------------------
                                                                                                            DagBag loading stats for {dag_folder}
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 6 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 438..455
                                                                                                    airflowPatch1.9/models.py on lines 454..471

                                                                                                    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 98.

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def run(
                                                                                                                self,
                                                                                                                verbose=True,
                                                                                                                ignore_all_deps=False,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 5 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1554..1579

                                                                                                    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 96.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __init__(
                                                                                                                self, conn_id=None, conn_type=None,
                                                                                                                host=None, login=None, password=None,
                                                                                                                schema=None, port=None, extra=None,
                                                                                                                uri=None):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 5 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 541..556
                                                                                                    airflowPatch1.9/models.py on lines 563..578

                                                                                                    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 95.

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def get_num_active_runs(self, external_trigger=None, session=None):
                                                                                                            """
                                                                                                            Returns the number of active "running" dag runs
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 5 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3199..3217

                                                                                                    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 95.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def pool_full(self, session):
                                                                                                            """
                                                                                                            Returns a boolean as to whether the slot pool has room for this
                                                                                                            task to run
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 5 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 1178..1197
                                                                                                    airflowPatch1.9/models.py on lines 1262..1281

                                                                                                    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 93.

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def get_failed_dep_statuses(
                                                                                                                self,
                                                                                                                dep_context=None,
                                                                                                                session=None):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 5 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1201..1219

                                                                                                    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 93.

                                                                                                    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

                                                                                                            try:
                                                                                                                if self.state == State.UP_FOR_RETRY and task.on_retry_callback:
                                                                                                                    task.on_retry_callback(context)
                                                                                                                if self.state == State.FAILED and task.on_failure_callback:
                                                                                                                    task.on_failure_callback(context)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 5 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1632..1639

                                                                                                    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 91.

                                                                                                    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

                                                                                                        @classmethod
                                                                                                        def setdefault(cls, key, default, deserialize_json=False):
                                                                                                            """
                                                                                                            Like a Python builtin dict object, setdefault returns the current value
                                                                                                            for a key, and if it isn't there, stores the default value and returns it.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 5 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3996..4020

                                                                                                    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 90.

                                                                                                    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

                                                                                                        def email_alert(self, exception, is_retry=False):
                                                                                                            task = self.task
                                                                                                            title = "Airflow alert: {self}".format(**locals())
                                                                                                            exception = str(exception).replace('\n', '<br>')
                                                                                                            # For reporting purposes, we report based on 1-indexed,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 5 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1764..1779

                                                                                                    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 87.

                                                                                                    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

                                                                                                            try:
                                                                                                                if not mark_success:
                                                                                                                    context = self.get_template_context()
                                                                                                    
                                                                                                                    task_copy = copy.copy(task)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 5 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1461..1534

                                                                                                    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 87.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def tree_view(self):
                                                                                                            """
                                                                                                            Shows an ascii tree representation of the DAG
                                                                                                            """
                                                                                                            def get_downstream(task, level=0):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3239..3250
                                                                                                    airflowPatch1.9/models.py on lines 3593..3604

                                                                                                    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 85.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __hash__(self):
                                                                                                            hash_components = [type(self)]
                                                                                                            for c in self._comps:
                                                                                                                val = getattr(self, c, None)
                                                                                                                try:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2024..2033
                                                                                                    airflowPatch1.9/models.py on lines 2259..2268

                                                                                                    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 83.

                                                                                                    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

                                                                                                                        try:
                                                                                                                            sys.path.insert(0, filepath)
                                                                                                                            m = importlib.import_module(mod_name)
                                                                                                                            mods.append(m)
                                                                                                                        except Exception as e:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 313..320

                                                                                                    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 83.

                                                                                                    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 unfinished_tasks and none_depends_on_past and none_task_concurrency:
                                                                                                                # todo: this can actually get pretty slow: one task costs between 0.01-015s
                                                                                                                no_dependencies_met = True
                                                                                                                for ut in unfinished_tasks:
                                                                                                                    # We need to flag upstream and check for changes because upstream
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 4603..4617

                                                                                                    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 82.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @classmethod
                                                                                                        @provide_session
                                                                                                        def delete(cls, xcoms, session=None):
                                                                                                            if isinstance(xcoms, XCom):
                                                                                                                xcoms = [xcoms]
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3749..3760
                                                                                                    airflowPatch1.9/models.py on lines 4238..4249

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def xcom_push(
                                                                                                                self,
                                                                                                                key,
                                                                                                                value,
                                                                                                                execution_date=None):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 1603..1633
                                                                                                    airflowPatch1.9/models.py on lines 1787..1817

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def deactivate_unknown_dags(active_dag_ids, session=None):
                                                                                                            """
                                                                                                            Given a list of known DAGs, deactivate any other DAGs that are
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3426..3443
                                                                                                    airflowPatch1.9/models.py on lines 3821..3838

                                                                                                    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 80.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def command(
                                                                                                                self,
                                                                                                                mark_success=False,
                                                                                                                ignore_all_deps=False,
                                                                                                                ignore_depends_on_past=False,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 770..788
                                                                                                    airflowPatch1.9/models.py on lines 836..854

                                                                                                    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 79.

                                                                                                    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

                                                                                                        @property
                                                                                                        def subdags(self):
                                                                                                            """
                                                                                                            Returns a list of the subdag objects associated to this DAG
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3251..3266

                                                                                                    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 78.

                                                                                                    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

                                                                                                        @property
                                                                                                        def mark_success_url(self):
                                                                                                            iso = quote(self.execution_date.isoformat())
                                                                                                            BASE_URL = configuration.conf.get('webserver', 'BASE_URL')
                                                                                                            if settings.RBAC:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 1104..1121

                                                                                                    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 78.

                                                                                                    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

                                                                                                        @property
                                                                                                        def log_url(self):
                                                                                                            iso = quote(self.execution_date.isoformat())
                                                                                                            BASE_URL = configuration.conf.get('webserver', 'BASE_URL')
                                                                                                            if settings.RBAC:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 1123..1144

                                                                                                    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 78.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            tis = (
                                                                                                                session.query(TI)
                                                                                                                    .join(LJ, TI.job_id == LJ.id)
                                                                                                                    .filter(TI.state == State.RUNNING)
                                                                                                                    .filter(
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 330..337
                                                                                                    airflowPatch1.9/models.py on lines 347..354

                                                                                                    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 77.

                                                                                                    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

                                                                                                        def get_extra(self):
                                                                                                            if self._extra and self.is_extra_encrypted:
                                                                                                                fernet = get_fernet()
                                                                                                                if not fernet.is_encrypted:
                                                                                                                    raise AirflowException(
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 696..705

                                                                                                    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 77.

                                                                                                    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

                                                                                                        def get_password(self):
                                                                                                            if self._password and self.is_encrypted:
                                                                                                                fernet = get_fernet()
                                                                                                                if not fernet.is_encrypted:
                                                                                                                    raise AirflowException(
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 718..727

                                                                                                    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 77.

                                                                                                    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

                                                                                                            try:
                                                                                                                # This failed before in what may have been a git sync
                                                                                                                # race condition
                                                                                                                file_last_changed_on_disk = datetime.fromtimestamp(os.path.getmtime(filepath))
                                                                                                                if only_if_updated \
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 252..263

                                                                                                    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 77.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_task_instance(self, task_id, session=None):
                                                                                                            """
                                                                                                            Returns the task instance specified by task_id for this dag run
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 4 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3962..3976
                                                                                                    airflowPatch1.9/models.py on lines 4521..4536

                                                                                                    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 74.

                                                                                                    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

                                                                                                        def dry_run(self):
                                                                                                            self.log.info('Dry run')
                                                                                                            for attr in self.template_fields:
                                                                                                                content = getattr(self, attr)
                                                                                                                if content and isinstance(content, six.string_types):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 4 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 2624..2630

                                                                                                    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 74.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def clear_xcom_data(self, session=None):
                                                                                                            """
                                                                                                            Clears all XCom data from the database for the task instance
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 1004..1014
                                                                                                    airflowPatch1.9/models.py on lines 1073..1083

                                                                                                    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 72.

                                                                                                    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

                                                                                                        @property
                                                                                                        def extra_dejson(self):
                                                                                                            """Returns the extra property by deserializing json."""
                                                                                                            obj = {}
                                                                                                            if self.extra:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 709..720

                                                                                                    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 72.

                                                                                                    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

                                                                                                                with timeout(configuration.conf.getint('core', "DAGBAG_IMPORT_TIMEOUT")):
                                                                                                                    try:
                                                                                                                        m = imp.load_source(mod_name, filepath)
                                                                                                                        mods.append(m)
                                                                                                                    except Exception as e:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 283..290

                                                                                                    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 72.

                                                                                                    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

                                                                                                                    try:
                                                                                                                        task_copy.post_execute(context=context, result=result)
                                                                                                                    except TypeError as e:
                                                                                                                        if 'unexpected keyword argument' in str(e):
                                                                                                                            warnings.warn(
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1500..1511

                                                                                                    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 71.

                                                                                                    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 not self.start_date and not task.start_date:
                                                                                                                raise AirflowException("Task is missing the start_date parameter")
                                                                                                            # if the task has no start date, assign it the same as the DAG
                                                                                                            elif not task.start_date:
                                                                                                                task.start_date = self.start_date
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 3613..3621

                                                                                                    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 71.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_previous_scheduled_dagrun(self, session=None):
                                                                                                            """The previous, SCHEDULED DagRun, if there is one"""
                                                                                                            dag = self.get_dag()
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 4001..4008
                                                                                                    airflowPatch1.9/models.py on lines 4561..4568

                                                                                                    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 69.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __eq__(self, other):
                                                                                                            return (
                                                                                                                    type(self) == type(other) and
                                                                                                                    all(self.__dict__.get(c, None) == other.__dict__.get(c, None)
                                                                                                                        for c in self._comps))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2012..2016
                                                                                                    airflowPatch1.9/models.py on lines 2247..2251

                                                                                                    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 67.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            tis = session.query(TI).filter(
                                                                                                                TI.dag_id == self.dag_id,
                                                                                                                TI.execution_date >= start_date,
                                                                                                                TI.execution_date <= end_date,
                                                                                                                TI.task_id.in_([t.task_id for t in self.tasks]),
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3010..3014
                                                                                                    airflowPatch1.9/models.py on lines 3307..3311

                                                                                                    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 66.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                                    if task_copy.execution_timeout:
                                                                                                                        try:
                                                                                                                            with timeout(int(
                                                                                                                                    task_copy.execution_timeout.total_seconds())):
                                                                                                                                result = task_copy.execute(context=context)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 1365..1374
                                                                                                    airflowPatch1.9/models.py on lines 1484..1493

                                                                                                    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 66.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_previous_dagrun(self, session=None):
                                                                                                            """The previous DagRun, if there is one"""
                                                                                                    
                                                                                                            return session.query(DagRun).filter(
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3990..3998
                                                                                                    airflowPatch1.9/models.py on lines 4550..4558

                                                                                                    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 66.

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def get_num_running_task_instances(self, session):
                                                                                                            TI = TaskInstance
                                                                                                            return session.query(TI).filter(
                                                                                                                TI.dag_id == self.dag_id,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1870..1876

                                                                                                    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 65.

                                                                                                    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 self.is_eligible_to_retry():
                                                                                                                    self.state = State.UP_FOR_RETRY
                                                                                                                    self.log.info('Marking task as UP_FOR_RETRY')
                                                                                                                    if task.email_on_retry and task.email:
                                                                                                                        self.email_alert(error, is_retry=True)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1614..1626

                                                                                                    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 65.

                                                                                                    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 6 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __rshift__(self, other):
                                                                                                            """
                                                                                                            Implements Self >> Other == self.set_downstream(other)
                                                                                                    
                                                                                                            If "Other" is a DAG, the DAG is assigned to the Operator.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 5 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 2540..2553
                                                                                                    airflowPatch1.8/models.py on lines 2037..2050
                                                                                                    airflowPatch1.8/models.py on lines 2052..2065
                                                                                                    airflowPatch1.9/models.py on lines 2272..2285
                                                                                                    airflowPatch1.9/models.py on lines 2287..2300

                                                                                                    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 64.

                                                                                                    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 6 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __lshift__(self, other):
                                                                                                            """
                                                                                                            Implements Self << Other == self.set_upstream(other)
                                                                                                    
                                                                                                            If "Other" is a DAG, the DAG is assigned to the Operator.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 5 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 2525..2538
                                                                                                    airflowPatch1.8/models.py on lines 2037..2050
                                                                                                    airflowPatch1.8/models.py on lines 2052..2065
                                                                                                    airflowPatch1.9/models.py on lines 2272..2285
                                                                                                    airflowPatch1.9/models.py on lines 2287..2300

                                                                                                    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 64.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @staticmethod
                                                                                                        def get_run(session, dag_id, execution_date):
                                                                                                            """
                                                                                                            :param dag_id: DAG ID
                                                                                                            :type dag_id: unicode
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 4139..4155
                                                                                                    airflowPatch1.9/models.py on lines 4686..4702

                                                                                                    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 63.

                                                                                                    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 verbose:
                                                                                                                if mark_success:
                                                                                                                    msg = "Marking success for {} on {}".format(self.task,
                                                                                                                                                                self.execution_date)
                                                                                                                    self.log.info(msg)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1422..1428

                                                                                                    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 63.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def filepath(self):
                                                                                                            """
                                                                                                            File location of where the dag object is instantiated
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 3 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2858..2865
                                                                                                    airflowPatch1.9/models.py on lines 3138..3145

                                                                                                    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 62.

                                                                                                    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

                                                                                                        def set_state(self, state):
                                                                                                            if self._state != state:
                                                                                                                self._state = state
                                                                                                                if self.dag_id is not None:
                                                                                                                    # FIXME: Due to the scoped_session factor we we don't get a clean
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 3 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 4407..4414

                                                                                                    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 62.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __eq__(self, other):
                                                                                                            return (
                                                                                                                    type(self) == type(other) and
                                                                                                                    # Use getattr() instead of __dict__ as __dict__ doesn't return
                                                                                                                    # correct values for properties.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2702..2708
                                                                                                    airflowPatch1.9/models.py on lines 2950..2956

                                                                                                    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 61.

                                                                                                    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 enable_pickling:
                                                                                                                value = pickle.dumps(value)
                                                                                                            else:
                                                                                                                try:
                                                                                                                    value = json.dumps(value).encode('UTF-8')
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 4102..4113

                                                                                                    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 59.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_active_runs(self, session=None):
                                                                                                            """
                                                                                                            Returns a list of dag run execution dates currently running
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2903..2916
                                                                                                    airflowPatch1.9/models.py on lines 3183..3197

                                                                                                    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 59.

                                                                                                    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

                                                                                                                if enable_pickling:
                                                                                                                    return pickle.loads(result.value)
                                                                                                                else:
                                                                                                                    try:
                                                                                                                        return json.loads(result.value.decode('UTF-8'))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 4174..4185

                                                                                                    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 59.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_dagrun(self, execution_date, session=None):
                                                                                                            """
                                                                                                            Returns the dag run for a given execution date if it exists, otherwise
                                                                                                            none.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2918..2934
                                                                                                    airflowPatch1.9/models.py on lines 3219..3236

                                                                                                    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 58.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @provide_session
                                                                                                        def get_dagrun(self, session):
                                                                                                            """
                                                                                                            Returns the DagRun for this TaskInstance
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 1199..1211
                                                                                                    airflowPatch1.9/models.py on lines 1283..1296

                                                                                                    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 57.

                                                                                                    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

                                                                                                            if isinstance(self._schedule_interval, six.string_types):
                                                                                                                dttm = timezone.make_naive(dttm, self.timezone)
                                                                                                                cron = croniter(self._schedule_interval, dttm)
                                                                                                                following = timezone.make_aware(cron.get_next(datetime), self.timezone)
                                                                                                                return timezone.convert_to_utc(following)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 3341..3345

                                                                                                    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 56.

                                                                                                    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

                                                                                                            if isinstance(self._schedule_interval, six.string_types):
                                                                                                                dttm = timezone.make_naive(dttm, self.timezone)
                                                                                                                cron = croniter(self._schedule_interval, dttm)
                                                                                                                prev = timezone.make_aware(cron.get_prev(datetime), self.timezone)
                                                                                                                return timezone.convert_to_utc(prev)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 hrs to fix
                                                                                                    airflowPatch1.10/models.py on lines 3326..3330

                                                                                                    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 56.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def normalize_schedule(self, dttm):
                                                                                                            """
                                                                                                            Returns dttm + interval unless dttm is first interval then it returns dttm
                                                                                                            """
                                                                                                            following = self.following_schedule(dttm)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2766..2779
                                                                                                    airflowPatch1.9/models.py on lines 3046..3059

                                                                                                    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 54.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            session.query(cls).filter(
                                                                                                                cls.key == key,
                                                                                                                cls.execution_date == execution_date,
                                                                                                                cls.task_id == task_id,
                                                                                                                cls.dag_id == dag_id).delete()
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3662..3666
                                                                                                    airflowPatch1.9/models.py on lines 4116..4120

                                                                                                    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 54.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if confirm_prompt:
                                                                                                                ti_list = "\n".join([str(t) for t in tis])
                                                                                                                question = (
                                                                                                                    "You are about to delete these {count} tasks:\n"
                                                                                                                    "{ti_list}\n\n"
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 3131..3137
                                                                                                    airflowPatch1.9/models.py on lines 3429..3435

                                                                                                    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 53.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                    class ImportError(Base):
                                                                                                        __tablename__ = "import_error"
                                                                                                        id = Column(Integer, primary_key=True)
                                                                                                        timestamp = Column(UtcDateTime)
                                                                                                        filename = Column(String(1024))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 4234..4239
                                                                                                    airflowPatch1.9/models.py on lines 4809..4814

                                                                                                    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 53.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        @provide_session
                                                                                                        def is_paused(self, session=None):
                                                                                                            """
                                                                                                            Returns a boolean indicating whether this DAG is paused
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 2 hrs to fix
                                                                                                    airflowPatch1.8/models.py on lines 2893..2901
                                                                                                    airflowPatch1.9/models.py on lines 3173..3181

                                                                                                    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

                                                                                                        @provide_session
                                                                                                        def error(self, session=None):
                                                                                                            """
                                                                                                            Forces the task instance's state to FAILED in the database.
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 2 hrs to fix
                                                                                                    airflowPatch1.9/models.py on lines 1030..1038

                                                                                                    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 50.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            qry = session.query(TI).filter(
                                                                                                                TI.dag_id == self.dag_id,
                                                                                                                TI.task_id == self.task_id,
                                                                                                                TI.execution_date == self.execution_date)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 985..988
                                                                                                    airflowPatch1.9/models.py on lines 1051..1054

                                                                                                    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 49.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if schedule_interval in cron_presets:
                                                                                                                self._schedule_interval = cron_presets.get(schedule_interval)
                                                                                                            elif schedule_interval == '@once':
                                                                                                                self._schedule_interval = None
                                                                                                            else:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 2668..2673
                                                                                                    airflowPatch1.9/models.py on lines 2914..2919

                                                                                                    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 49.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            for ti in list(tis):
                                                                                                                # skip in db?
                                                                                                                if ti.state == State.REMOVED:
                                                                                                                    tis.remove(ti)
                                                                                                                else:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 4026..4031
                                                                                                    airflowPatch1.9/models.py on lines 4586..4591

                                                                                                    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 49.

                                                                                                    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

                                                                                                        def set_val(self, value):
                                                                                                            if value:
                                                                                                                fernet = get_fernet()
                                                                                                                self._val = fernet.encrypt(bytes(value, 'utf-8')).decode()
                                                                                                                self.is_encrypted = fernet.is_encrypted
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 707..711

                                                                                                    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 49.

                                                                                                    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 not task.end_date:
                                                                                                                task.end_date = self.end_date
                                                                                                            # otherwise, the task will end on the earlier of its own end date and
                                                                                                            # the DAG's end date
                                                                                                            elif task.end_date and self.end_date:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.9/models.py on lines 3624..3629

                                                                                                    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 49.

                                                                                                    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

                                                                                                        def set_password(self, value):
                                                                                                            if value:
                                                                                                                fernet = get_fernet()
                                                                                                                self._password = fernet.encrypt(bytes(value, 'utf-8')).decode()
                                                                                                                self.is_encrypted = fernet.is_encrypted
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 4396..4400

                                                                                                    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 49.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def set_duration(self):
                                                                                                            if self.end_date and self.start_date:
                                                                                                                self.duration = (self.end_date - self.start_date).total_seconds()
                                                                                                            else:
                                                                                                                self.duration = None
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 1597..1601
                                                                                                    airflowPatch1.9/models.py on lines 1781..1785

                                                                                                    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 48.

                                                                                                    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

                                                                                                            if not WeightRule.is_valid(weight_rule):
                                                                                                                raise AirflowException(
                                                                                                                    "The weight_rule must be one of {all_weight_rules},"
                                                                                                                    "'{d}.{t}'; received '{tr}'."
                                                                                                                        .format(all_weight_rules=WeightRule.all_weight_rules,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 2394..2399

                                                                                                    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 48.

                                                                                                    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

                                                                                                            if not TriggerRule.is_valid(trigger_rule):
                                                                                                                raise AirflowException(
                                                                                                                    "The trigger_rule must be one of {all_triggers},"
                                                                                                                    "'{d}.{t}'; received '{tr}'."
                                                                                                                        .format(all_triggers=TriggerRule.all_triggers,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 2433..2438

                                                                                                    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 48.

                                                                                                    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

                                                                                                                    elif self.state is not State.RUNNING and not dag.partial:
                                                                                                                        self.log.warning("Failed to get task '{}' for dag '{}'. "
                                                                                                                                         "Marking it as removed.".format(ti, dag))
                                                                                                                        Stats.incr(
                                                                                                                            "task_removed_from_dag.{}".format(dag.dag_id), 1, 1)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 5094..5098

                                                                                                    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 47.

                                                                                                    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

                                                                                                                if should_restore_task:
                                                                                                                    self.log.info("Restoring task '{}' which was previously "
                                                                                                                                  "removed from DAG '{}'".format(ti, dag))
                                                                                                                    Stats.incr("task_restored_to_dag.{}".format(dag.dag_id), 1, 1)
                                                                                                                    ti.state = State.NONE
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 5085..5090

                                                                                                    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 47.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def cli(self):
                                                                                                            """
                                                                                                            Exposes a CLI specific to this DAG
                                                                                                            """
                                                                                                            from airflow.bin import cli
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 3332..3339
                                                                                                    airflowPatch1.9/models.py on lines 3726..3733

                                                                                                    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 46.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            query = (
                                                                                                                session.query(cls).filter(and_(*filters))
                                                                                                                    .order_by(cls.execution_date.desc(), cls.timestamp.desc())
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 3741..3744
                                                                                                    airflowPatch1.9/models.py on lines 4215..4218

                                                                                                    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 46.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                    class KnownEventType(Base):
                                                                                                        __tablename__ = "known_event_type"
                                                                                                    
                                                                                                        id = Column(Integer, primary_key=True)
                                                                                                        know_event_type = Column(String(200))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 3494..3501
                                                                                                    airflowPatch1.9/models.py on lines 3918..3925

                                                                                                    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 46.

                                                                                                    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 self.state == State.RUNNING:
                                                                                                                msg = "Task Instance already running {}".format(self)
                                                                                                                self.log.warning(msg)
                                                                                                                session.commit()
                                                                                                                return False
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.9/models.py on lines 1400..1404

                                                                                                    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 46.

                                                                                                    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

                                                                                                            try:
                                                                                                                if task.on_success_callback:
                                                                                                                    task.on_success_callback(context)
                                                                                                            except Exception as e3:
                                                                                                                self.log.error("Failed when executing success callback")
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.9/models.py on lines 1545..1550

                                                                                                    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 46.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def dry_run(self):
                                                                                                            task = self.task
                                                                                                            task_copy = copy.copy(task)
                                                                                                            self.task = task_copy
                                                                                                    
                                                                                                    
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 1408..1414
                                                                                                    airflowPatch1.9/models.py on lines 1586..1592

                                                                                                    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 45.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def get_task(self, task_id):
                                                                                                            if task_id in self.task_dict:
                                                                                                                return self.task_dict[task_id]
                                                                                                            raise AirflowException("Task {task_id} not found".format(**locals()))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 3202..3205
                                                                                                    airflowPatch1.9/models.py on lines 3556..3559

                                                                                                    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 45.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def date_range(self, start_date, num=None, end_date=timezone.utcnow()):
                                                                                                            if num:
                                                                                                                end_date = None
                                                                                                            return utils_date_range(
                                                                                                                start_date=start_date, end_date=end_date,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 2745..2750
                                                                                                    airflowPatch1.9/models.py on lines 2993..2998

                                                                                                    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 45.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def checkpoint_resource_version(resource_version, session=None):
                                                                                                            if resource_version:
                                                                                                                session.query(KubeResourceVersion).update({
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 5286..5293

                                                                                                    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 44.

                                                                                                    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

                                                                                                        @staticmethod
                                                                                                        @provide_session
                                                                                                        def checkpoint_kube_worker_uuid(worker_uuid, session=None):
                                                                                                            if worker_uuid:
                                                                                                                session.query(KubeWorkerIdentifier).update({
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 5253..5260

                                                                                                    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 44.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if 'params' in self.default_args:
                                                                                                                self.params.update(self.default_args['params'])
                                                                                                                del self.default_args['params']
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 2649..2651
                                                                                                    airflowPatch1.9/models.py on lines 2895..2897

                                                                                                    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 42.

                                                                                                    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

                                                                                                            query = (
                                                                                                                session.query(cls.value).filter(and_(*filters))
                                                                                                                    .order_by(cls.execution_date.desc(), cls.timestamp.desc()))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.9/models.py on lines 4164..4167

                                                                                                    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 42.

                                                                                                    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 isinstance(retry_delay, timedelta):
                                                                                                                self.retry_delay = retry_delay
                                                                                                            else:
                                                                                                                self.log.debug("Retry_delay isn't timedelta object, assuming secs")
                                                                                                                self.retry_delay = timedelta(seconds=retry_delay)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.9/models.py on lines 2202..2206

                                                                                                    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 41.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                                elif (unfinished_tasks and none_depends_on_past and
                                                                                                                      none_task_concurrency and no_dependencies_met):
                                                                                                                    self.log.info('Deadlock; marking run %s failed', self)
                                                                                                                    self.state = State.FAILED
                                                                                                                    dag.handle_callback(self, success=False, reason='all_tasks_deadlocked',
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 5034..5038
                                                                                                    airflowPatch1.10/models.py on lines 5042..5046

                                                                                                    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 41.

                                                                                                    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

                                                                                                        @property
                                                                                                        def try_number(self):
                                                                                                            """
                                                                                                            Return the try number that this task number will be when it is acutally
                                                                                                            run.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.9/models.py on lines 814..826

                                                                                                    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 41.

                                                                                                    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

                                                                                                        def __init__(self, dag_id, state, count=0, dirty=False):
                                                                                                            self.dag_id = dag_id
                                                                                                            self.state = state
                                                                                                            self.count = count
                                                                                                            self.dirty = dirty
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.9/models.py on lines 4260..4264

                                                                                                    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 41.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def ready_for_retry(self):
                                                                                                            """
                                                                                                            Checks on whether the task instance is in the right state and timeframe
                                                                                                            to be retried.
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 1170..1176
                                                                                                    airflowPatch1.9/models.py on lines 1254..1260

                                                                                                    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 41.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def active_task_ids(self):
                                                                                                            return list(k for k, v in self.task_dict.items() if not v.adhoc)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 2850..2852
                                                                                                    airflowPatch1.9/models.py on lines 3130..3132

                                                                                                    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 40.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if args or kwargs:
                                                                                                                # TODO remove *args and **kwargs in Airflow 2.0
                                                                                                                warnings.warn(
                                                                                                                    'Invalid arguments were passed to {c}. Support for '
                                                                                                                    'passing such arguments will be dropped in Airflow 2.0. '
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 1919..1926
                                                                                                    airflowPatch1.9/models.py on lines 2152..2159

                                                                                                    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 40.

                                                                                                    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 6 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if include_prior_dates:
                                                                                                                filters.append(cls.execution_date <= execution_date)
                                                                                                            else:
                                                                                                                filters.append(cls.execution_date == execution_date)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 5 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 4628..4631
                                                                                                    airflowPatch1.8/models.py on lines 3700..3703
                                                                                                    airflowPatch1.8/models.py on lines 3736..3739
                                                                                                    airflowPatch1.9/models.py on lines 4159..4162
                                                                                                    airflowPatch1.9/models.py on lines 4210..4213

                                                                                                    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 39.

                                                                                                    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 6 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if include_prior_dates:
                                                                                                                filters.append(cls.execution_date <= execution_date)
                                                                                                            else:
                                                                                                                filters.append(cls.execution_date == execution_date)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 5 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 4581..4584
                                                                                                    airflowPatch1.8/models.py on lines 3700..3703
                                                                                                    airflowPatch1.8/models.py on lines 3736..3739
                                                                                                    airflowPatch1.9/models.py on lines 4159..4162
                                                                                                    airflowPatch1.9/models.py on lines 4210..4213

                                                                                                    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 39.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                                mod_name = ('unusual_prefix_' +
                                                                                                                            hashlib.sha1(filepath.encode('utf-8')).hexdigest() +
                                                                                                                            '_' + org_mod_name)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 254..256
                                                                                                    airflowPatch1.9/models.py on lines 276..278

                                                                                                    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 39.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if not ignore_all_deps and not ignore_ti_state and self.state == State.SUCCESS:
                                                                                                                Stats.incr('previously_succeeded', 1, 1)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 1254..1255
                                                                                                    airflowPatch1.9/models.py on lines 1343..1344

                                                                                                    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 39.

                                                                                                    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

                                                                                                            if 'end_date' in self.default_args:
                                                                                                                self.default_args['end_date'] = (
                                                                                                                    timezone.convert_to_utc(self.default_args['end_date'])
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 3221..3223

                                                                                                    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 39.

                                                                                                    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

                                                                                                            if 'start_date' in self.default_args:
                                                                                                                self.default_args['start_date'] = (
                                                                                                                    timezone.convert_to_utc(self.default_args['start_date'])
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 1 hr to fix
                                                                                                    airflowPatch1.10/models.py on lines 3225..3227

                                                                                                    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 39.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def dag(self):
                                                                                                            """
                                                                                                            Returns the Operator's DAG if set, otherwise raises an error
                                                                                                            """
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 2085..2094
                                                                                                    airflowPatch1.9/models.py on lines 2320..2329

                                                                                                    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 38.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def xcom_push(
                                                                                                                self,
                                                                                                                context,
                                                                                                                key,
                                                                                                                value,
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 1 hr to fix
                                                                                                    airflowPatch1.8/models.py on lines 2480..2489
                                                                                                    airflowPatch1.9/models.py on lines 2715..2724

                                                                                                    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 38.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def is_premature(self):
                                                                                                            """
                                                                                                            Returns whether a task is in UP_FOR_RETRY state and its retry interval
                                                                                                            has elapsed.
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 55 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 1030..1037
                                                                                                    airflowPatch1.9/models.py on lines 1099..1106

                                                                                                    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 37.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def owner(self):
                                                                                                            return ", ".join(list(set([t.owner for t in self.tasks])))
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 55 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 2874..2876
                                                                                                    airflowPatch1.9/models.py on lines 3154..3156

                                                                                                    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 37.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def get_dag(self):
                                                                                                            """
                                                                                                            Returns the Dag associated with this DagRun.
                                                                                                    
                                                                                                            :return: DAG
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 55 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 3978..3988
                                                                                                    airflowPatch1.9/models.py on lines 4538..4548

                                                                                                    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 37.

                                                                                                    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 5 locations. Consider refactoring.
                                                                                                    Open

                                                                                                                elif not unfinished_tasks and all(r.state in (State.SUCCESS, State.SKIPPED)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 4 other locations - About 55 mins to fix
                                                                                                    airflowPatch1.10/models.py on lines 5034..5035
                                                                                                    airflowPatch1.8/models.py on lines 4062..4063
                                                                                                    airflowPatch1.9/models.py on lines 4629..4630
                                                                                                    airflowPatch1.9/models.py on lines 4635..4635

                                                                                                    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 37.

                                                                                                    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 5 locations. Consider refactoring.
                                                                                                    Open

                                                                                                                if (not unfinished_tasks and
                                                                                                                        any(r.state in (State.FAILED, State.UPSTREAM_FAILED) for r in roots)):
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 4 other locations - About 55 mins to fix
                                                                                                    airflowPatch1.10/models.py on lines 5042..5042
                                                                                                    airflowPatch1.8/models.py on lines 4062..4063
                                                                                                    airflowPatch1.9/models.py on lines 4629..4630
                                                                                                    airflowPatch1.9/models.py on lines 4635..4635

                                                                                                    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 37.

                                                                                                    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 not executor and local:
                                                                                                                executor = LocalExecutor()
                                                                                                            elif not executor:
                                                                                                                executor = GetDefaultExecutor()
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 50 mins to fix
                                                                                                    airflowPatch1.9/models.py on lines 3708..3711

                                                                                                    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 36.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def dag_id(self):
                                                                                                            if self.has_dag():
                                                                                                                return self.dag.dag_id
                                                                                                            else:
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 45 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 2119..2124
                                                                                                    airflowPatch1.9/models.py on lines 2354..2359

                                                                                                    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 35.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if include_examples:
                                                                                                                example_dag_folder = os.path.join(
                                                                                                                    os.path.dirname(__file__),
                                                                                                                    'example_dags')
                                                                                                                self.collect_dags(example_dag_folder)
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 45 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 175..179
                                                                                                    airflowPatch1.9/models.py on lines 197..201

                                                                                                    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 35.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def __repr__(self):
                                                                                                            return (
                                                                                                                '<DagRun {dag_id} @ {execution_date}: {run_id}, '
                                                                                                                'externally triggered: {external_trigger}>'
                                                                                                            ).format(
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 40 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 3845..3853
                                                                                                    airflowPatch1.9/models.py on lines 4394..4402

                                                                                                    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 34.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                            if not test_mode:
                                                                                                                session.add(Log(self.state, self))
                                                                                                                session.merge(self)
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 35 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 1393..1395
                                                                                                    airflowPatch1.9/models.py on lines 1539..1541

                                                                                                    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 33.

                                                                                                    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 6 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def upstream_list(self):
                                                                                                            """@property: list of tasks directly upstream"""
                                                                                                            return [self.dag.get_task(tid) for tid in self._upstream_task_ids]
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 5 other locations - About 30 mins to fix
                                                                                                    airflowPatch1.10/models.py on lines 2797..2800
                                                                                                    airflowPatch1.8/models.py on lines 2272..2275
                                                                                                    airflowPatch1.8/models.py on lines 2281..2284
                                                                                                    airflowPatch1.9/models.py on lines 2509..2512
                                                                                                    airflowPatch1.9/models.py on lines 2518..2521

                                                                                                    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 32.

                                                                                                    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 6 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def downstream_list(self):
                                                                                                            """@property: list of tasks directly downstream"""
                                                                                                            return [self.dag.get_task(tid) for tid in self._downstream_task_ids]
                                                                                                    Severity: Major
                                                                                                    Found in airflowPatch1.10/models.py and 5 other locations - About 30 mins to fix
                                                                                                    airflowPatch1.10/models.py on lines 2788..2791
                                                                                                    airflowPatch1.8/models.py on lines 2272..2275
                                                                                                    airflowPatch1.8/models.py on lines 2281..2284
                                                                                                    airflowPatch1.9/models.py on lines 2509..2512
                                                                                                    airflowPatch1.9/models.py on lines 2518..2521

                                                                                                    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 32.

                                                                                                    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 not self.are_dependencies_met(
                                                                                                                    dep_context=queue_dep_context,
                                                                                                                    session=session,
                                                                                                                    verbose=True):
                                                                                                                session.commit()
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.py and 1 other location - About 30 mins to fix
                                                                                                    airflowPatch1.9/models.py on lines 1352..1357

                                                                                                    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 32.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        def set_dependency(self, upstream_task_id, downstream_task_id):
                                                                                                            """
                                                                                                            Simple utility method to set dependency between two tasks that
                                                                                                            already have been added to the DAG using add_task()
                                                                                                            """
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 30 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 2995..3001
                                                                                                    airflowPatch1.9/models.py on lines 3292..3298

                                                                                                    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 32.

                                                                                                    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 3 locations. Consider refactoring.
                                                                                                    Open

                                                                                                        @property
                                                                                                        def schedule_interval(self):
                                                                                                            """
                                                                                                            The schedule interval of the DAG always wins over individual tasks so
                                                                                                            that tasks within a DAG always line up. The task still needs a
                                                                                                    Severity: Minor
                                                                                                    Found in airflowPatch1.10/models.py and 2 other locations - About 30 mins to fix
                                                                                                    airflowPatch1.8/models.py on lines 2139..2149
                                                                                                    airflowPatch1.9/models.py on lines 2374..2384

                                                                                                    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 32.

                                                                                                    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

                                                                                                    There are no issues that match your filters.

                                                                                                    Category
                                                                                                    Status