---
source: crates/ruff_linter/src/rules/airflow/mod.rs
---
AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:15:28
   |
13 | # Violations
14 |
15 | DAG(dag_id="a", start_date=datetime.now())
   |                            ^^^^^^^^^^^^^^
16 | DAG(dag_id="b", start_date=datetime.now() - timedelta(days=1))
17 | DAG(dag_id="c", default_args={"start_date": datetime.now()})
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:16:28
   |
15 | DAG(dag_id="a", start_date=datetime.now())
16 | DAG(dag_id="b", start_date=datetime.now() - timedelta(days=1))
   |                            ^^^^^^^^^^^^^^
17 | DAG(dag_id="c", default_args={"start_date": datetime.now()})
18 | DAG(dag_id="d", start_date=datetime.utcnow())
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:17:45
   |
15 | DAG(dag_id="a", start_date=datetime.now())
16 | DAG(dag_id="b", start_date=datetime.now() - timedelta(days=1))
17 | DAG(dag_id="c", default_args={"start_date": datetime.now()})
   |                                             ^^^^^^^^^^^^^^
18 | DAG(dag_id="d", start_date=datetime.utcnow())
19 | DAG(dag_id="e", start_date=datetime.today())
   |

AIR304 `datetime.utcnow()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:18:28
   |
16 | DAG(dag_id="b", start_date=datetime.now() - timedelta(days=1))
17 | DAG(dag_id="c", default_args={"start_date": datetime.now()})
18 | DAG(dag_id="d", start_date=datetime.utcnow())
   |                            ^^^^^^^^^^^^^^^^^
19 | DAG(dag_id="e", start_date=datetime.today())
20 | DAG(dag_id="f", start_date=date.today())
   |

AIR304 `datetime.today()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:19:28
   |
17 | DAG(dag_id="c", default_args={"start_date": datetime.now()})
18 | DAG(dag_id="d", start_date=datetime.utcnow())
19 | DAG(dag_id="e", start_date=datetime.today())
   |                            ^^^^^^^^^^^^^^^^
20 | DAG(dag_id="f", start_date=date.today())
21 | DAG(dag_id="g", tags=[f"v{random.randint(1, 9)}"])
   |

AIR304 `date.today()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:20:28
   |
18 | DAG(dag_id="d", start_date=datetime.utcnow())
19 | DAG(dag_id="e", start_date=datetime.today())
20 | DAG(dag_id="f", start_date=date.today())
   |                            ^^^^^^^^^^^^
21 | DAG(dag_id="g", tags=[f"v{random.randint(1, 9)}"])
22 | DAG(dag_id="h", start_date=pendulum.now())
   |

AIR304 `random.randint()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:21:27
   |
19 | DAG(dag_id="e", start_date=datetime.today())
20 | DAG(dag_id="f", start_date=date.today())
21 | DAG(dag_id="g", tags=[f"v{random.randint(1, 9)}"])
   |                           ^^^^^^^^^^^^^^^^^^^^
22 | DAG(dag_id="h", start_date=pendulum.now())
23 | DAG(dag_id="i", start_date=pendulum.yesterday())
   |

AIR304 `pendulum.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:22:28
   |
20 | DAG(dag_id="f", start_date=date.today())
21 | DAG(dag_id="g", tags=[f"v{random.randint(1, 9)}"])
22 | DAG(dag_id="h", start_date=pendulum.now())
   |                            ^^^^^^^^^^^^^^
23 | DAG(dag_id="i", start_date=pendulum.yesterday())
24 | DAG(dag_id="j", start_date=pendulum.tomorrow())
   |

AIR304 `pendulum.yesterday()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:23:28
   |
21 | DAG(dag_id="g", tags=[f"v{random.randint(1, 9)}"])
22 | DAG(dag_id="h", start_date=pendulum.now())
23 | DAG(dag_id="i", start_date=pendulum.yesterday())
   |                            ^^^^^^^^^^^^^^^^^^^^
24 | DAG(dag_id="j", start_date=pendulum.tomorrow())
25 | DAG(dag_id="k", start_date=pendulum.today())
   |

AIR304 `pendulum.tomorrow()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:24:28
   |
22 | DAG(dag_id="h", start_date=pendulum.now())
23 | DAG(dag_id="i", start_date=pendulum.yesterday())
24 | DAG(dag_id="j", start_date=pendulum.tomorrow())
   |                            ^^^^^^^^^^^^^^^^^^^
25 | DAG(dag_id="k", start_date=pendulum.today())
26 | DAG(dag_id="l", owner=f"team-{uuid.uuid4()}")
   |

AIR304 `pendulum.today()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:25:28
   |
23 | DAG(dag_id="i", start_date=pendulum.yesterday())
24 | DAG(dag_id="j", start_date=pendulum.tomorrow())
25 | DAG(dag_id="k", start_date=pendulum.today())
   |                            ^^^^^^^^^^^^^^^^
26 | DAG(dag_id="l", owner=f"team-{uuid.uuid4()}")
27 | DAG(dag_id="m", description=f"built at {time.time()}")
   |

AIR304 `uuid.uuid4()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:26:31
   |
24 | DAG(dag_id="j", start_date=pendulum.tomorrow())
25 | DAG(dag_id="k", start_date=pendulum.today())
26 | DAG(dag_id="l", owner=f"team-{uuid.uuid4()}")
   |                               ^^^^^^^^^^^^
27 | DAG(dag_id="m", description=f"built at {time.time()}")
   |

AIR304 `time.time()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:27:41
   |
25 | DAG(dag_id="k", start_date=pendulum.today())
26 | DAG(dag_id="l", owner=f"team-{uuid.uuid4()}")
27 | DAG(dag_id="m", description=f"built at {time.time()}")
   |                                         ^^^^^^^^^^^
28 |
29 | # Wrapped calls
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:30:32
   |
29 | # Wrapped calls
30 | DAG(dag_id="n", start_date=str(datetime.now()))
   |                                ^^^^^^^^^^^^^^
31 | DAG(dag_id="o", start_date=int(time.time()))
   |

AIR304 `time.time()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:31:32
   |
29 | # Wrapped calls
30 | DAG(dag_id="n", start_date=str(datetime.now()))
31 | DAG(dag_id="o", start_date=int(time.time()))
   |                                ^^^^^^^^^^^
32 |
33 | # Method chain
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:34:28
   |
33 | # Method chain
34 | DAG(dag_id="p", start_date=datetime.now().isoformat())
   |                            ^^^^^^^^^^^^^^
35 |
36 | # Ternary
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:37:28
   |
36 | # Ternary
37 | DAG(dag_id="q", start_date=datetime.now() if True else None)
   |                            ^^^^^^^^^^^^^^
38 |
39 | # BoolOp
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:40:36
   |
39 | # BoolOp
40 | DAG(dag_id="r", start_date=None or datetime.now())
   |                                    ^^^^^^^^^^^^^^
41 |
42 | # Walrus operator
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:43:34
   |
42 | # Walrus operator
43 | DAG(dag_id="s", start_date=(x := datetime.now()))
   |                                  ^^^^^^^^^^^^^^
   |

AIR304 `pendulum.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:46:17
   |
46 | @dag(start_date=pendulum.now())
   |                 ^^^^^^^^^^^^^^
47 | def my_dag():
48 |     pass
   |

AIR304 `datetime.today()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:51:62
   |
51 | BashOperator(task_id="t", bash_command="echo hi", start_date=datetime.today())
   |                                                              ^^^^^^^^^^^^^^^^
52 |
53 | PythonSensor(task_id="s", start_date=datetime.now())
   |

AIR304 `datetime.now()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:53:38
   |
51 | BashOperator(task_id="t", bash_command="echo hi", start_date=datetime.today())
52 |
53 | PythonSensor(task_id="s", start_date=datetime.now())
   |                                      ^^^^^^^^^^^^^^
   |

AIR304 `datetime.utcnow()` produces a value that changes at runtime; using it in a Dag or task argument causes infinite Dag version creation
  --> AIR304.py:56:18
   |
56 | @task(start_date=datetime.utcnow())
   |                  ^^^^^^^^^^^^^^^^^
57 | def my_task():
58 |     pass
   |
