Back to all reviewers

Use system configuration defaults

apache/airflow
Based on 5 comments
Python

Always use the configuration system's default values instead of hardcoding defaults in the code. This ensures consistency across the application and makes configuration management more maintainable.

Configurations Python

Reviewer Prompt

Always use the configuration system’s default values instead of hardcoding defaults in the code. This ensures consistency across the application and makes configuration management more maintainable.

Bad:

DEFAULT_QUEUE: str = conf.get("operators", "default_queue", "default")

Good:

DEFAULT_QUEUE: str = conf.get_mandatory_value("operators", "default_queue")

For provider-specific configurations:

  1. Ensure provider configurations are properly loaded using @providers_configuration_loaded decorator
  2. Run pre-commits to generate provider configuration files
  3. Use conf.get() without fallback when the default is already defined in the configuration system
  4. When deprecating configuration options, properly version them in the deprecated_options dictionary

This approach centralizes configuration management, improves maintainability, and ensures consistent behavior across the application.

5
Comments Analyzed
Python
Primary Language
Configurations
Category

Source Discussions