abhioncbr/docker-airflow

View on GitHub
airflowPatch1.8/models.py

Summary

Maintainability
F
3 mos
Test Coverage

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

# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in airflowPatch1.8/models.py - About 1 wk to fix

    DAG has 61 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.8/models.py - About 1 day to fix

      Function process_file has a Cognitive Complexity of 52 (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.8/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

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

      class BaseOperator(object):
          """
          Abstract base class for all operators. Since operators create objects that
          become node 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.8/models.py - About 6 hrs to fix

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

        class TaskInstance(Base):
            """
            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.8/models.py - About 4 hrs to fix

          Function collect_dags has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def collect_dags(
                      self,
                      dag_folder=None,
                      only_if_updated=True):
                  """
          Severity: Minor
          Found in airflowPatch1.8/models.py - About 4 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

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

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

                def run(
                        self,
                        verbose=True,
                        ignore_all_deps=False,
                        ignore_depends_on_past=False,
            Severity: Minor
            Found in airflowPatch1.8/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 handle_failure has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle_failure(self, error, test_mode=False, context=None):
                    logging.exception(error)
                    task = self.task
                    session = settings.Session()
                    self.end_date = datetime.now()
            Severity: Minor
            Found in airflowPatch1.8/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 16 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in airflowPatch1.8/models.py - About 2 hrs 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.8/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 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.8/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.8/models.py - About 1 hr to fix

                Function get_hook has a Cognitive Complexity of 14 (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.8/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.8/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 clear_task_instances has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def clear_task_instances(tis, session, activate_dag_runs=True):
                    """
                    Clears a set of task instances, but makes sure the running ones
                    get killed.
                    """
                Severity: Minor
                Found in airflowPatch1.8/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 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(
                            self,
                            task_id,
                            owner=configuration.get('operators', 'DEFAULT_OWNER'),
                            email=None,
                Severity: Minor
                Found in airflowPatch1.8/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 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  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.8/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 update_state has a Cognitive Complexity of 12 (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.
                          :returns State:
                  Severity: Minor
                  Found in airflowPatch1.8/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 has 11 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

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

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

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

                      Function run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Function verify_integrity has a Cognitive Complexity of 11 (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.8/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 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.8/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 10 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def run(
                        Severity: Major
                        Found in airflowPatch1.8/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.8/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.8/models.py - About 1 hr to fix

                              Function __init__ has 28 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.8/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.8/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.8/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 clear has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

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

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

                                      def get_many(
                                  Severity: Major
                                  Found in airflowPatch1.8/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.8/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.8/models.py - About 45 mins to fix

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

                                            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: Minor
                                        Found in airflowPatch1.8/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 find has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

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

                                            def get_one(
                                        Severity: Minor
                                        Found in airflowPatch1.8/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.8/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.logger.debug("Reading {} from {}".
                                                                                        format(mod.filename, filepath))
                                                                      content = zf.read()
                                                                      if not all([s in content for s in (b'DAG', b'airflow')]):
                                          Severity: Major
                                          Found in airflowPatch1.8/models.py - About 45 mins to fix

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

                                                def xcom_pull(
                                            Severity: Minor
                                            Found in airflowPatch1.8/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.8/models.py - About 35 mins to fix

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

                                                    def find(dag_id=None, run_id=None, execution_date=None,
                                                Severity: Minor
                                                Found in airflowPatch1.8/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.8/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.8/models.py - About 35 mins to fix

                                                      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.8/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 get_template_context has a Cognitive Complexity of 7 (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.8/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 render_templates has a Cognitive Complexity of 7 (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.8/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 = datetime.now()
                                                              self.event = event
                                                              self.extra = extra
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in airflowPatch1.8/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, dag_id,
                                                                  description='',
                                                                  schedule_interval=timedelta(days=1),
                                                                  start_date=None, end_date=None,
                                                      Severity: Minor
                                                      Found in airflowPatch1.8/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 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.8/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 JdbcHook(jdbc_conn_id=self.conn_id)
                                                      Severity: Major
                                                      Found in airflowPatch1.8/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.8/models.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

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

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                    return found_dags
                                                            Severity: Major
                                                            Found in airflowPatch1.8/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.8/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.8/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.8/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.8/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.8/models.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                        return HiveServer2Hook(hiveserver2_conn_id=self.conn_id)
                                                                        Severity: Major
                                                                        Found in airflowPatch1.8/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.8/models.py - About 30 mins to fix

                                                                            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.8/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 __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.8/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.8/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 are_dependencies_met has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                def are_dependencies_met(
                                                                                        self,
                                                                                        dep_context=None,
                                                                                        session=None,
                                                                                        verbose=False):
                                                                            Severity: Minor
                                                                            Found in airflowPatch1.8/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_one has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                def get_one(
                                                                                        cls,
                                                                                        execution_date,
                                                                                        key=None,
                                                                                        task_id=None,
                                                                            Severity: Minor
                                                                            Found in airflowPatch1.8/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

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

                                                                                @provide_session
                                                                                def get_template_context(self, session=None):
                                                                                    task = self.task
                                                                                    from airflow import macros
                                                                                    tables = None
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 5 days to fix
                                                                            airflowPatch1.9/models.py on lines 1646..1745

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

                                                                            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_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: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 days to fix
                                                                            airflowPatch1.9/models.py on lines 2658..2699

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

                                                                            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.8/models.py and 2 other locations - About 2 days to fix
                                                                            airflowPatch1.10/models.py on lines 1028..1095
                                                                            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.8/models.py and 2 other locations - About 2 days to fix
                                                                            airflowPatch1.10/models.py on lines 2085..2122
                                                                            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 Chart(Base):
                                                                                __tablename__ = "chart"
                                                                            
                                                                                id = Column(Integer, primary_key=True)
                                                                                label = Column(String(200))
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 days to fix
                                                                            airflowPatch1.9/models.py on lines 3893..3915

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

                                                                            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

                                                                                                try:
                                                                                                    filepath = os.path.join(root, f)
                                                                                                    if not os.path.isfile(filepath):
                                                                                                        continue
                                                                                                    mod_name, file_ext = os.path.splitext(
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 days to fix
                                                                            airflowPatch1.9/models.py on lines 419..441

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

                                                                            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 DagModel(Base):
                                                                            
                                                                                __tablename__ = "dag"
                                                                                """
                                                                                These items are stored in the database for state related information
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 days to fix
                                                                            airflowPatch1.9/models.py on lines 2746..2788

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

                                                                            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 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: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 days to fix
                                                                            airflowPatch1.9/models.py on lines 3519..3551

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

                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 4898..4924
                                                                            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 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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 280..309
                                                                            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 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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 983..1014
                                                                            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

                                                                                @provide_session
                                                                                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: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 day to fix
                                                                            airflowPatch1.9/models.py on lines 4656..4684

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

                                                                            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 render_template_from_field(self, attr, content, context, jinja_env):
                                                                                    """
                                                                                    Renders a template from a field. If the field is a string, it will
                                                                                    simply render the string and return the result. If it is a collection or
                                                                                    nested set of collections, it will traverse the structure and render
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 day to fix
                                                                            airflowPatch1.9/models.py on lines 2445..2467

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

                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 3951..3966
                                                                            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 2 locations. Consider refactoring.
                                                                            Open

                                                                            class TaskFail(Base):
                                                                                """
                                                                                TaskFail tracks the failed run durations of each task instance.
                                                                                """
                                                                            
                                                                            
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 day to fix
                                                                            airflowPatch1.9/models.py on lines 1880..1900

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

                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 1269..1297
                                                                            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

                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 4346..4364
                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 3678..3727
                                                                            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

                                                                                def parse_from_uri(self, uri):
                                                                                    temp_uri = urlparse(uri)
                                                                                    hostname = temp_uri.hostname or ''
                                                                                    if '%2f' in hostname:
                                                                                        hostname = hostname.replace('%2f', '/').replace('%2F', '/')
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 day to fix
                                                                            airflowPatch1.9/models.py on lines 580..593

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

                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 1245..1267
                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 5213..5231
                                                                            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

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

                                                                                def bag_dag(self, dag, parent_dag, root_dag):
                                                                                    """
                                                                                    Adds the DAG into the bag, recurses into sub dags.
                                                                                    """
                                                                                    self.dags[dag.dag_id] = dag
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 day to fix
                                                                            airflowPatch1.9/models.py on lines 370..386

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

                                                                            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.8/models.py and 2 other locations - About 1 day to fix
                                                                            airflowPatch1.10/models.py on lines 3767..3778
                                                                            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.8/models.py and 2 other locations - About 7 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 1915..1928
                                                                            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

                                                                            class DagPickle(Base):
                                                                                """
                                                                                Dags can originate from different places (user repos, master repo, ...)
                                                                                and also get executed in different places (different executors). This
                                                                                object represents a version of a DAG and becomes a source of truth for
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 7 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 723..746

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

                                                                            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.8/models.py and 2 other locations - About 7 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2748..2763
                                                                            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.8/models.py and 2 other locations - About 7 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2584..2599
                                                                            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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4830..4847
                                                                            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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3283..3296
                                                                            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 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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4434..4447
                                                                            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

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

                                                                                def deactivate_inactive_dags(self):
                                                                                    active_dag_ids = [dag.dag_id for dag in list(self.dags.values())]
                                                                                    session = settings.Session()
                                                                                    for dag in session.query(
                                                                                            DagModel).filter(~DagModel.dag_id.in_(active_dag_ids)).all():
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 6 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 474..482

                                                                            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

                                                                            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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3395..3413
                                                                            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

                                                                            class User(Base):
                                                                                __tablename__ = "users"
                                                                            
                                                                                id = Column(Integer, primary_key=True)
                                                                                username = Column(String(ID_LEN), unique=True)
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 6 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 493..508

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

                                                                            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 xcom_pull(
                                                                                        self,
                                                                                        task_ids,
                                                                                        dag_id=None,
                                                                                        key=XCOM_RETURN_KEY,
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 6 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 1819..1868

                                                                            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 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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2845..2857
                                                                            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

                                                                            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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2884..2901
                                                                            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

                                                                            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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 1146..1163
                                                                            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.8/models.py and 2 other locations - About 6 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 551..568
                                                                            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 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.8/models.py and 2 other locations - About 5 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 662..677
                                                                            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 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.8/models.py and 2 other locations - About 5 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 1402..1421
                                                                            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

                                                                                @property
                                                                                @provide_session
                                                                                def concurrency_reached(self, session=None):
                                                                                    """
                                                                                    Returns a boolean indicating whether the concurrency limit for this DAG
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 5 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 3158..3171

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

                                                                            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

                                                                                    for m in mods:
                                                                                        for dag in list(m.__dict__.values()):
                                                                                            if isinstance(dag, DAG):
                                                                                                if not dag.full_filepath:
                                                                                                    dag.full_filepath = filepath
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 5 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 322..330

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

                                                                            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 db_merge(self):
                                                                                    BO = BaseOperator
                                                                                    session = settings.Session()
                                                                                    tasks = session.query(BO).filter(BO.dag_id == self.dag_id).all()
                                                                                    for t in tasks:
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 5 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 3656..3664

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

                                                                            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 set(cls, key, value, serialize_json=False, session=None):
                                                                            
                                                                                    if serialize_json:
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 5 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 4037..4048

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

                                                                            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.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3968..3979
                                                                            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.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2512..2521
                                                                            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

                                                                                        if safe_mode and os.path.isfile(filepath):
                                                                                            with open(filepath, 'rb') as f:
                                                                                                content = f.read()
                                                                                                if not all([s in content for s in (b'DAG', b'airflow')]):
                                                                                                    self.file_last_changed[filepath] = file_last_changed_on_disk
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 4 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 267..272

                                                                            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

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

                                                                                @provide_session
                                                                                def set_dag_runs_state(
                                                                                        self, state=State.RUNNING, session=None):
                                                                                    drs = session.query(DagModel).filter_by(dag_id=self.dag_id).all()
                                                                                    dirty_ids = []
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 4 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 3373..3381

                                                                            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.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4640..4651
                                                                            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.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 1953..1983
                                                                            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.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4203..4220
                                                                            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.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 952..970
                                                                            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

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

                                                                                def detect_downstream_cycle(self, task=None):
                                                                                    """
                                                                                    When invoked, this routine will raise an exception if a cycle is
                                                                                    detected downstream from self. It is invoked when tasks are added to
                                                                                    the DAG to detect cycles.
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 4 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 2588..2602

                                                                            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.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 438..445
                                                                            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

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

                                                                                @property
                                                                                def latest_execution_date(self):
                                                                                    """
                                                                                    Returns the latest date for which at least one dag run exists
                                                                                    """
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 4 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 3238..3249

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

                                                                            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
                                                                                    :param task_id: the task id
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 4 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4926..4941
                                                                            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 get_flat_relatives(self, upstream=False, l=None):
                                                                                    """
                                                                                    Get a flat list of relatives, either upstream or downstream.
                                                                                    """
                                                                                    if not l:
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 4 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 2576..2586

                                                                            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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 1209..1219
                                                                            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 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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4966..4973
                                                                            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 2 locations. Consider refactoring.
                                                                            Open

                                                                                    if task.task_id in self.task_dict:
                                                                                        # TODO: raise an error in Airflow 2.0
                                                                                        warnings.warn(
                                                                                            'The requested task could not be added to the DAG because a '
                                                                                            'task with task_id {} is already in the DAG. Starting in '
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 3 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 3631..3642

                                                                            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

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

                                                                                def get_extra(self):
                                                                                    if self._extra and self.is_extra_encrypted:
                                                                                        if not ENCRYPTION_ON:
                                                                                            raise AirflowException(
                                                                                                "Can't decrypt `extra` params for login={},\
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 573..581
                                                                            airflowPatch1.8/models.py on lines 3537..3545

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

                                                                            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_password(self):
                                                                                    if self._password and self.is_encrypted:
                                                                                        if not ENCRYPTION_ON:
                                                                                            raise AirflowException(
                                                                                                "Can't decrypt encrypted password for login={}, \
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 597..605
                                                                            airflowPatch1.8/models.py on lines 3537..3545

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

                                                                            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_val(self):
                                                                                    if self._val and self.is_encrypted:
                                                                                        if not ENCRYPTION_ON:
                                                                                            raise AirflowException(
                                                                                                "Can't decrypt _val for key={}, FERNET_KEY configuration \
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 573..581
                                                                            airflowPatch1.8/models.py on lines 597..605

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

                                                                            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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2500..2504
                                                                            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

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

                                                                                def paused_dags(self):
                                                                                    session = settings.Session()
                                                                                    dag_ids = [dp.dag_id for dp in session.query(DagModel).filter(
                                                                                        DagModel.is_paused.is_(True))]
                                                                                    session.commit()
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 3 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 484..490

                                                                            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

                                                                                @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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4955..4963
                                                                            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 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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3663..3667
                                                                            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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 1624..1633
                                                                            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

                                                                            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.8/models.py and 5 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2525..2538
                                                                            airflowPatch1.10/models.py on lines 2540..2553
                                                                            airflowPatch1.8/models.py on lines 2037..2050
                                                                            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 __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.8/models.py and 5 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 2525..2538
                                                                            airflowPatch1.10/models.py on lines 2540..2553
                                                                            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 2 locations. Consider refactoring.
                                                                            Open

                                                                                def previous_schedule(self, dttm):
                                                                                    if isinstance(self._schedule_interval, six.string_types):
                                                                                        cron = croniter(self._schedule_interval, dttm)
                                                                                        return cron.get_prev(datetime)
                                                                                    elif isinstance(self._schedule_interval, timedelta):
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 3 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 3007..3012

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

                                                                                def following_schedule(self, dttm):
                                                                                    if isinstance(self._schedule_interval, six.string_types):
                                                                                        cron = croniter(self._schedule_interval, dttm)
                                                                                        return cron.get_next(datetime)
                                                                                    elif isinstance(self._schedule_interval, timedelta):
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 3 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 3000..3005

                                                                            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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 5111..5127
                                                                            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 ignore_file:
                                                                                                f = open(os.path.join(root, ignore_file[0]), 'r')
                                                                                                patterns += [p for p in f.read().split('\n') if p]
                                                                                                f.close()
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 3 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 414..417

                                                                            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.8/models.py and 2 other locations - About 3 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3472..3479
                                                                            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 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.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3269..3275
                                                                            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

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

                                                                                def set_password(self, value):
                                                                                    if value:
                                                                                        try:
                                                                                            self._password = FERNET.encrypt(bytes(value, 'utf-8')).decode()
                                                                                            self.is_encrypted = True
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 607..614
                                                                            airflowPatch1.8/models.py on lines 3547..3554

                                                                            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

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

                                                                                def set_extra(self, value):
                                                                                    if value:
                                                                                        try:
                                                                                            self._extra = FERNET.encrypt(bytes(value, 'utf-8')).decode()
                                                                                            self.is_extra_encrypted = True
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 583..590
                                                                            airflowPatch1.8/models.py on lines 3547..3554

                                                                            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

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

                                                                                def set_val(self, value):
                                                                                    if value:
                                                                                        try:
                                                                                            self._val = FERNET.encrypt(bytes(value, 'utf-8')).decode()
                                                                                            self.is_encrypted = True
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 583..590
                                                                            airflowPatch1.8/models.py on lines 607..614

                                                                            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

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

                                                                                @provide_session
                                                                                def get_active_runs(self, session=None):
                                                                                    """
                                                                                    Returns a list of "running" tasks
                                                                                    :param session:
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3540..3554
                                                                            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 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.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3576..3593
                                                                            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
                                                                                    :param session:
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 1423..1436
                                                                            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

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

                                                                                def append_only_new(self, l, item):
                                                                                    if any([item is t for t in l]):
                                                                                        raise AirflowException(
                                                                                            'Dependency {self}, {item} already registered'
                                                                                            ''.format(**locals()))
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 2650..2656

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

                                                                            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.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3381..3393
                                                                            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.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 4541..4545
                                                                            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.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3798..3804
                                                                            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

                                                                            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.8/models.py and 1 other location - About 2 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 262..268

                                                                            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(DateTime)
                                                                                filename = Column(String(1024))
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 5234..5239
                                                                            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 2 locations. Consider refactoring.
                                                                            Open

                                                                                            try:
                                                                                                m = imp.load_source(mod_name, filepath)
                                                                                                mods.append(m)
                                                                                            except Exception as e:
                                                                                                self.logger.exception("Failed to import: " + filepath)
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 hrs to fix
                                                                            airflowPatch1.8/models.py on lines 294..301

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

                                                                                def set_state(self, state, session):
                                                                                    self.state = state
                                                                                    self.start_date = datetime.now()
                                                                                    self.end_date = datetime.now()
                                                                                    session.merge(self)
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 1092..1097

                                                                            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.8/models.py and 2 other locations - About 2 hrs to fix
                                                                            airflowPatch1.10/models.py on lines 3506..3514
                                                                            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

                                                                                @property
                                                                                def log_filepath(self):
                                                                                    iso = self.execution_date.isoformat()
                                                                                    log = os.path.expanduser(configuration.get('core', 'BASE_LOG_FOLDER'))
                                                                                    return (
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 2 hrs to fix
                                                                            airflowPatch1.9/models.py on lines 979..984

                                                                            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

                                                                                    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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 3231..3236
                                                                            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

                                                                                    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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 1186..1189
                                                                            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

                                                                                    for ti in list(tis):
                                                                                        # skip in db?
                                                                                        if ti.state == State.REMOVED:
                                                                                            tis.remove(ti)
                                                                                        else:
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 4991..4996
                                                                            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

                                                                                    if not start_date:
                                                                                        start_date = (datetime.today() - timedelta(30)).date()
                                                                                        start_date = datetime.combine(start_date, datetime.min.time())
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.9/models.py on lines 3303..3305

                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 1947..1951
                                                                            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 4 locations. Consider refactoring.
                                                                            Open

                                                                                @property
                                                                                def mark_success_url(self):
                                                                                    iso = self.execution_date.isoformat()
                                                                                    BASE_URL = configuration.get('webserver', 'BASE_URL')
                                                                                    return BASE_URL + (
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 3 other locations - About 1 hr to fix
                                                                            airflowPatch1.8/models.py on lines 920..929
                                                                            airflowPatch1.9/models.py on lines 986..995
                                                                            airflowPatch1.9/models.py on lines 997..1009

                                                                            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

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

                                                                                    for k, v in list(self.__dict__.items()):
                                                                                        if k not in ('user_defined_macros', 'params'):
                                                                                            setattr(result, k, copy.deepcopy(v, memo))
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.8/models.py on lines 2200..2202

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

                                                                                @property
                                                                                def log_url(self):
                                                                                    iso = self.execution_date.isoformat()
                                                                                    BASE_URL = configuration.get('webserver', 'BASE_URL')
                                                                                    return BASE_URL + (
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 3 other locations - About 1 hr to fix
                                                                            airflowPatch1.8/models.py on lines 931..943
                                                                            airflowPatch1.9/models.py on lines 986..995
                                                                            airflowPatch1.9/models.py on lines 997..1009

                                                                            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

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

                                                                                    for k, v in list(self.__dict__.items()):
                                                                                        if k not in ('user_defined_macros', 'params'):
                                                                                            setattr(result, k, copy.deepcopy(v, memo))
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.8/models.py on lines 3157..3159

                                                                            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

                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 4108..4115
                                                                            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

                                                                            class KnownEventType(Base):
                                                                                __tablename__ = "known_event_type"
                                                                            
                                                                                id = Column(Integer, primary_key=True)
                                                                                know_event_type = Column(String(200))
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 4336..4343
                                                                            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 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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 4633..4635
                                                                            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

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

                                                                                    msg = "Starting attempt {attempt} of {total}".format(
                                                                                        attempt=self.try_number % (task.retries + 1) + 1,
                                                                                        total=task.retries + 1)
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.8/models.py on lines 1296..1299

                                                                            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

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

                                                                                        msg = ("FIXME: Rescheduling due to concurrency limits reached at task "
                                                                                               "runtime. Attempt {attempt} of {total}. State set to NONE.").format(
                                                                                            attempt=self.try_number % (task.retries + 1) + 1,
                                                                                            total=task.retries + 1)
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.8/models.py on lines 1275..1277

                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 1726..1732
                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 3931..3934
                                                                            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=datetime.now()):
                                                                                    if num:
                                                                                        end_date = None
                                                                                    return utils_date_range(
                                                                                        start_date=start_date, end_date=end_date,
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 3312..3317
                                                                            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

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

                                                                                def xcom_pull(
                                                                                        self,
                                                                                        context,
                                                                                        task_ids,
                                                                                        dag_id=None,
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.9/models.py on lines 2729..2739

                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 3188..3190
                                                                            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

                                                                                    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.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.9/models.py on lines 2173..2178

                                                                            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

                                                                                @property
                                                                                def priority_weight_total(self):
                                                                                    return sum([
                                                                                        t.priority_weight
                                                                                        for t in self.get_flat_relatives(upstream=False)
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 1 hr to fix
                                                                            airflowPatch1.9/models.py on lines 2386..2391

                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 1394..1400
                                                                            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

                                                                                    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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 2373..2380
                                                                            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 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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 3464..3466
                                                                            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 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.8/models.py and 5 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 4581..4584
                                                                            airflowPatch1.10/models.py on lines 4628..4631
                                                                            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.8/models.py and 5 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 4581..4584
                                                                            airflowPatch1.10/models.py on lines 4628..4631
                                                                            airflowPatch1.8/models.py on lines 3700..3703
                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 354..356
                                                                            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.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 1483..1484
                                                                            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

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

                                                                                def xcom_push(
                                                                                        self,
                                                                                        context,
                                                                                        key,
                                                                                        value,
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 3003..3012
                                                                            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 dag(self):
                                                                                    """
                                                                                    Returns the Operator's DAG if set, otherwise raises an error
                                                                                    """
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 1 hr to fix
                                                                            airflowPatch1.10/models.py on lines 2573..2582
                                                                            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

                                                                                @property
                                                                                def owner(self):
                                                                                    return ", ".join(list(set([t.owner for t in self.tasks])))
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 55 mins to fix
                                                                            airflowPatch1.10/models.py on lines 3488..3490
                                                                            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

                                                                                @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.8/models.py and 2 other locations - About 55 mins to fix
                                                                            airflowPatch1.10/models.py on lines 1236..1243
                                                                            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

                                                                                def get_dag(self):
                                                                                    """
                                                                                    Returns the Dag associated with this DagRun.
                                                                            
                                                                                    :return: DAG
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 55 mins to fix
                                                                            airflowPatch1.10/models.py on lines 4943..4953
                                                                            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

                                                                                        if (not unfinished_tasks and
                                                                                                any(r.state in (State.FAILED, State.UPSTREAM_FAILED) for r in roots)):
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 4 other locations - About 55 mins to fix
                                                                            airflowPatch1.10/models.py on lines 5034..5035
                                                                            airflowPatch1.10/models.py on lines 5042..5042
                                                                            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

                                                                                __table_args__ = (
                                                                                    Index('ti_dag_state', dag_id, state),
                                                                                    Index('ti_state', state),
                                                                                    Index('ti_state_lkp', dag_id, task_id, execution_date, state),
                                                                                    Index('ti_pool', pool, state, priority_weight),
                                                                            Severity: Minor
                                                                            Found in airflowPatch1.8/models.py and 1 other location - About 50 mins to fix
                                                                            airflowPatch1.9/models.py on lines 784..788

                                                                            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

                                                                                    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.8/models.py and 2 other locations - About 45 mins to fix
                                                                            airflowPatch1.10/models.py on lines 267..271
                                                                            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

                                                                                @property
                                                                                def dag_id(self):
                                                                                    if self.has_dag():
                                                                                        return self.dag.dag_id
                                                                                    else:
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 45 mins to fix
                                                                            airflowPatch1.10/models.py on lines 2607..2612
                                                                            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

                                                                                def __repr__(self):
                                                                                    return (
                                                                                        '<DagRun {dag_id} @ {execution_date}: {run_id}, '
                                                                                        'externally triggered: {external_trigger}>'
                                                                                    ).format(
                                                                            Severity: Major
                                                                            Found in airflowPatch1.8/models.py and 2 other locations - About 40 mins to fix
                                                                            airflowPatch1.10/models.py on lines 4798..4806
                                                                            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.8/models.py and 2 other locations - About 35 mins to fix
                                                                            airflowPatch1.10/models.py on lines 1679..1681
                                                                            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

                                                                            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.8/models.py and 2 other locations - About 30 mins to fix
                                                                            airflowPatch1.10/models.py on lines 3647..3653
                                                                            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.8/models.py and 2 other locations - About 30 mins to fix
                                                                            airflowPatch1.10/models.py on lines 2627..2637
                                                                            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

                                                                            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.8/models.py and 5 other locations - About 30 mins to fix
                                                                            airflowPatch1.10/models.py on lines 2788..2791
                                                                            airflowPatch1.10/models.py on lines 2797..2800
                                                                            airflowPatch1.8/models.py on lines 2272..2275
                                                                            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 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.8/models.py and 5 other locations - About 30 mins to fix
                                                                            airflowPatch1.10/models.py on lines 2788..2791
                                                                            airflowPatch1.10/models.py on lines 2797..2800
                                                                            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

                                                                            There are no issues that match your filters.

                                                                            Category
                                                                            Status