Back to all reviewers

Use proper access patterns

apache/airflow
Based on 2 comments
Other

Access configurations through documented abstraction layers rather than bypassing them with direct database or low-level access. For example, in Airflow, XCom operations should be performed through the Task Context using `get_current_context()` rather than directly accessing the database model:

Configurations Other

Reviewer Prompt

Access configurations through documented abstraction layers rather than bypassing them with direct database or low-level access. For example, in Airflow, XCom operations should be performed through the Task Context using get_current_context() rather than directly accessing the database model:

# Good practice
from airflow.sdk import get_current_context

def my_task(**context):
    # Alternatively: context = get_current_context()
    # Pull XCom value
    value = context["ti"].xcom_pull(task_ids="previous_task")
    # Push XCom value
    context["ti"].xcom_push(key="my_key", value="my_value")

For version-dependent configurations, use explicit version comparison functions (like semverCompare in Helm) rather than hard-coding version assumptions:

# Good practice (Helm example)
{{- if and (semverCompare "<3.0.0" .Values.airflowVersion) (or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName) }}
# Version-specific configuration here
{{- end }}
2
Comments Analyzed
Other
Primary Language
Configurations
Category

Source Discussions