This is an automated email from the ASF dual-hosted git repository.

weilee pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 07dd9f4deb ci: auto fix default_deferrable value with LibCST (#41984)
07dd9f4deb is described below

commit 07dd9f4deb970920a291b260c81c136e264d0605
Author: Wei Lee <[email protected]>
AuthorDate: Fri Sep 6 22:58:48 2024 +0800

    ci: auto fix default_deferrable value with LibCST (#41984)
---
 .pre-commit-config.yaml                           |  13 +--
 contributing-docs/08_static_code_checks.rst       |   2 +-
 dev/breeze/doc/images/output_static-checks.svg    |  38 ++++----
 dev/breeze/doc/images/output_static-checks.txt    |   2 +-
 dev/breeze/src/airflow_breeze/pre_commit_ids.py   |   2 +-
 scripts/ci/pre_commit/check_deferrable_default.py | 111 ++++++++++++----------
 6 files changed, 91 insertions(+), 77 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 44aa21db52..9e91b09613 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -218,6 +218,13 @@ repos:
         files: 
^airflow/models/taskinstance.py$|^airflow/models/taskinstancehistory.py$
         pass_filenames: false
         require_serial: true
+      - id: check-deferrable-default
+        name: Check and fix default value of default_deferrable
+        language: python
+        entry: ./scripts/ci/pre_commit/check_deferrable_default.py
+        pass_filenames: false
+        additional_dependencies: ["libcst>=1.4.0"]
+        files: ^airflow/.*/sensors/.*\.py$|^airflow/.*/operators/.*\.py$
   - repo: https://github.com/asottile/blacken-docs
     rev: 1.18.0
     hooks:
@@ -1165,12 +1172,6 @@ repos:
         pass_filenames: true
         files: \.py$
         exclude: 
^airflow/providers|^dev/.*\.py$|^scripts/.*\.py$|^tests/|^\w+_tests/|^docs/.*\.py$|^airflow/utils/helpers.py$|^hatch_build.py$
-      - id: check-deferrable-default-value
-        name: Check default value of deferrable attribute
-        language: python
-        entry: ./scripts/ci/pre_commit/check_deferrable_default.py
-        pass_filenames: false
-        files: ^airflow/.*/sensors/.*\.py$|^airflow/.*/operators/.*\.py$
       - id: check-provider-docs-valid
         name: Validate provider doc files
         entry: ./scripts/ci/pre_commit/check_provider_docs.py
diff --git a/contributing-docs/08_static_code_checks.rst 
b/contributing-docs/08_static_code_checks.rst
index 80be425da0..17506303ff 100644
--- a/contributing-docs/08_static_code_checks.rst
+++ b/contributing-docs/08_static_code_checks.rst
@@ -160,7 +160,7 @@ require Breeze Docker image to be built locally.
 
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
 | check-decorated-operator-implements-custom-name           | Check @task 
decorator implements custom_operator_name        |         |
 
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
-| check-deferrable-default-value                            | Check default 
value of deferrable attribute                  |         |
+| check-deferrable-default                                  | Check and fix 
default value of default_deferrable            |         |
 
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
 | check-docstring-param-types                               | Check that 
docstrings do not specify param types             |         |
 
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
diff --git a/dev/breeze/doc/images/output_static-checks.svg 
b/dev/breeze/doc/images/output_static-checks.svg
index 45889ee41b..047ce8361b 100644
--- a/dev/breeze/doc/images/output_static-checks.svg
+++ b/dev/breeze/doc/images/output_static-checks.svg
@@ -324,7 +324,7 @@
 </text><text class="breeze-static-checks-r1" x="12.2" y="93.2" 
textLength="219.6" 
clip-path="url(#breeze-static-checks-line-3)">Run&#160;static&#160;checks.</text><text
 class="breeze-static-checks-r1" x="1464" y="93.2" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-3)">
 </text><text class="breeze-static-checks-r1" x="1464" y="117.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-4)">
 </text><text class="breeze-static-checks-r5" x="0" y="142" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-5)">╭─</text><text 
class="breeze-static-checks-r5" x="24.4" y="142" textLength="219.6" 
clip-path="url(#breeze-static-checks-line-5)">&#160;Pre-commit&#160;flags&#160;</text><text
 class="breeze-static-checks-r5" x="244" y="142" textLength="1195.6" 
clip-path="url(#breeze-static-checks-line-5)">────────────────────────────────────────────────────────────────────────────────
 [...]
-</text><text class="breeze-static-checks-r5" x="0" y="166.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-6)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="166.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-6)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="166.4" textLength="61" 
clip-path="url(#breeze-static-checks-line-6)">-type</text><text 
class="breeze-static-checks-r6" x="402.6" y="166.4" textLength="24.4" 
clip-path="url(#breeze- [...]
+</text><text class="breeze-static-checks-r5" x="0" y="166.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-6)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="166.4" textLength="73.2" 
clip-path="url(#breeze-static-checks-line-6)">--type</text><text 
class="breeze-static-checks-r6" x="402.6" y="166.4" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-6)">-t</text><text 
class="breeze-static-checks-r1" x="451.4" y="166.4" textLength="988.2" 
clip-path="url(#b [...]
 </text><text class="breeze-static-checks-r5" x="0" y="190.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-7)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="190.8" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-7)">(all&#160;|&#160;bandit&#160;|&#160;blacken-docs&#160;|&#160;check-aiobotocore-optional&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><te
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="215.2" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-8)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="215.2" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-8)">check-airflow-k8s-not-used&#160;|&#160;check-airflow-provider-compatibility&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class="breeze-static-checks-r5" x="1451.8" y="215.2" text [...]
 </text><text class="breeze-static-checks-r5" x="0" y="239.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-9)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="239.6" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-9)">check-airflow-providers-bug-report-template&#160;|&#160;check-apache-license-rat&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class="breeze-static-checks-r5" x="1451.8" y="239.6" textLength="12.2" 
clip-path=" [...]
@@ -335,7 +335,7 @@
 </text><text class="breeze-static-checks-r5" x="0" y="361.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-14)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="361.6" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-14)">check-code-deprecations&#160;|&#160;check-common-compat-used-for-openlineage&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class="breeze-static-checks-r5" x="1451.8" y="361.6" textLen [...]
 </text><text class="breeze-static-checks-r5" x="0" y="386" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-15)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="386" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-15)">check-compat-cache-on-methods&#160;|&#160;check-core-deprecation-classes&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class="breeze-static-checks-r5" x="1451.8" y [...]
 </text><text class="breeze-static-checks-r5" x="0" y="410.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-16)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="410.4" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-16)">check-daysago-import-from-utils&#160;|&#160;check-decorated-operator-implements-custom-name</text><text
 class="breeze-static-checks-r5" x="1451.8" y="410.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-16)">│</text><tex [...]
-</text><text class="breeze-static-checks-r5" x="0" y="434.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-17)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="434.8" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-17)">|&#160;check-deferrable-default-value&#160;|&#160;check-docstring-param-types&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class="breeze-static-checks-r5" x=" [...]
+</text><text class="breeze-static-checks-r5" x="0" y="434.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-17)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="434.8" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-17)">|&#160;check-deferrable-default&#160;|&#160;check-docstring-param-types&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class [...]
 </text><text class="breeze-static-checks-r5" x="0" y="459.2" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-18)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="459.2" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-18)">check-example-dags-urls&#160;|&#160;check-executables-have-shebangs&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class="breeze-s [...]
 </text><text class="breeze-static-checks-r5" x="0" y="483.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-19)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="483.6" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-19)">check-extra-packages-references&#160;|&#160;check-extras-order&#160;|&#160;check-fab-migrations&#160;|&#160;&#160;&#160;&#160;</text><text
 class="breeze-static-checks-r5" x="1451.8" y="483.6" textLength="12.2" 
clip-path="url(#breeze-s [...]
 </text><text class="breeze-static-checks-r5" x="0" y="508" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-20)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="508" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-20)">check-for-inclusive-language&#160;|&#160;check-get-lineage-collector-providers&#160;|&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text
 class="breeze-static-checks-r5" x="1451.8" y="508" textLength="12.2" clip- 
[...]
@@ -375,36 +375,36 @@
 </text><text class="breeze-static-checks-r5" x="0" y="1337.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-54)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="1337.6" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-54)">update-reproducible-source-date-epoch&#160;|&#160;update-spelling-wordlist-to-be-sorted&#160;|&#160;&#160;</text><text
 class="breeze-static-checks-r5" x="1451.8" y="1337.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1362" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-55)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="1362" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-55)">update-supported-versions&#160;|&#160;update-vendored-in-k8s-json-schema&#160;|&#160;update-version&#160;|</text><text
 class="breeze-static-checks-r5" x="1451.8" y="1362" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-55)"> [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1386.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-56)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="1386.4" textLength="988.2" 
clip-path="url(#breeze-static-checks-line-56)">validate-operators-init&#160;|&#160;yamllint)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&
 [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1410.8" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-57)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1410.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-57)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1410.8" textLength="61" 
clip-path="url(#breeze-static-checks-line-57)">-show</text><text 
class="breeze-static-checks-r4" x="97.6" y="1410.8" textLength="195.2" 
clip-path="url(# [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1435.2" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-58)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1435.2" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-58)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1435.2" textLength="134.2" 
clip-path="url(#breeze-static-checks-line-58)">-initialize</text><text 
class="breeze-static-checks-r4" x="170.8" y="1435.2" textLength="146.4" clip-p 
[...]
-</text><text class="breeze-static-checks-r5" x="0" y="1459.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-59)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1459.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-59)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1459.6" textLength="48.8" 
clip-path="url(#breeze-static-checks-line-59)">-max</text><text 
class="breeze-static-checks-r4" x="85.4" y="1459.6" textLength="292.8" 
clip-path="url( [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1410.8" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-57)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1410.8" textLength="268.4" 
clip-path="url(#breeze-static-checks-line-57)">--show-diff-on-failure</text><text
 class="breeze-static-checks-r6" x="402.6" y="1410.8" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-57)">-s</text><text 
class="breeze-static-checks-r1" x="451.4" y="1410.8" textLength=" [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1435.2" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-58)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1435.2" textLength="292.8" 
clip-path="url(#breeze-static-checks-line-58)">--initialize-environment</text><text
 class="breeze-static-checks-r1" x="451.4" y="1435.2" textLength="549" 
clip-path="url(#breeze-static-checks-line-58)">Initialize&#160;environment&#160;before&#160;running&#160;checks.</text><text
 c [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1459.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-59)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1459.6" textLength="353.8" 
clip-path="url(#breeze-static-checks-line-59)">--max-initialization-attempts</text><text
 class="breeze-static-checks-r1" x="451.4" y="1459.6" textLength="854" 
clip-path="url(#breeze-static-checks-line-59)">Maximum&#160;number&#160;of&#160;attempts&#160;to&#160;initialize&#160;env
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1484" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-60)">│</text><text 
class="breeze-static-checks-r7" x="451.4" y="1484" textLength="854" 
clip-path="url(#breeze-static-checks-line-60)">(INTEGER&#160;RANGE)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1508.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-61)">│</text><text 
class="breeze-static-checks-r5" x="451.4" y="1508.4" textLength="854" 
clip-path="url(#breeze-static-checks-line-61)">[default:&#160;3;&#160;1&lt;=x&lt;=10]&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#16
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1532.8" 
textLength="1464" 
clip-path="url(#breeze-static-checks-line-62)">╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</text><text
 class="breeze-static-checks-r1" x="1464" y="1532.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-62)">
 </text><text class="breeze-static-checks-r5" x="0" y="1557.2" 
textLength="24.4" clip-path="url(#breeze-static-checks-line-63)">╭─</text><text 
class="breeze-static-checks-r5" x="24.4" y="1557.2" textLength="463.6" 
clip-path="url(#breeze-static-checks-line-63)">&#160;Selecting&#160;files&#160;to&#160;run&#160;the&#160;checks&#160;on&#160;</text><text
 class="breeze-static-checks-r5" x="488" y="1557.2" textLength="951.6" 
clip-path="url(#breeze-static-checks-line-63)">──────────────────────── [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1581.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-64)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1581.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-64)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1581.6" textLength="61" 
clip-path="url(#breeze-static-checks-line-64)">-file</text><text 
class="breeze-static-checks-r6" x="256.2" y="1581.6" textLength="24.4" 
clip-path="url(# [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1606" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-65)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1606" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-65)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1606" textLength="48.8" 
clip-path="url(#breeze-static-checks-line-65)">-all</text><text 
class="breeze-static-checks-r4" x="85.4" y="1606" textLength="73.2" 
clip-path="url(#breeze-s [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1630.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-66)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1630.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-66)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1630.4" textLength="85.4" 
clip-path="url(#breeze-static-checks-line-66)">-commit</text><text 
class="breeze-static-checks-r4" x="122" y="1630.4" textLength="48.8" 
clip-path="url [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1654.8" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-67)">│</text><text 
class="breeze-static-checks-r1" x="305" y="1654.8" textLength="183" 
clip-path="url(#breeze-static-checks-line-67)">exclusive&#160;with&#160;</text><text
 class="breeze-static-checks-r4" x="488" y="1654.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-67)">-</text><text 
class="breeze-static-checks-r4" x="500.2" y="1654.8" textLength="61" [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1581.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-64)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1581.6" textLength="73.2" 
clip-path="url(#breeze-static-checks-line-64)">--file</text><text 
class="breeze-static-checks-r6" x="256.2" y="1581.6" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-64)">-f</text><text 
class="breeze-static-checks-r1" x="305" y="1581.6" textLength="427" 
clip-path="url [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1606" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-65)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1606" textLength="134.2" 
clip-path="url(#breeze-static-checks-line-65)">--all-files</text><text 
class="breeze-static-checks-r6" x="256.2" y="1606" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-65)">-a</text><text 
class="breeze-static-checks-r1" x="305" y="1606" textLength="292.8" 
clip-path="url [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1630.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-66)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1630.4" textLength="146.4" 
clip-path="url(#breeze-static-checks-line-66)">--commit-ref</text><text 
class="breeze-static-checks-r6" x="256.2" y="1630.4" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-66)">-r</text><text 
class="breeze-static-checks-r1" x="305" y="1630.4" textLength="1134.6" clip 
[...]
+</text><text class="breeze-static-checks-r5" x="0" y="1654.8" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-67)">│</text><text 
class="breeze-static-checks-r1" x="305" y="1654.8" textLength="183" 
clip-path="url(#breeze-static-checks-line-67)">exclusive&#160;with&#160;</text><text
 class="breeze-static-checks-r4" x="488" y="1654.8" textLength="158.6" 
clip-path="url(#breeze-static-checks-line-67)">--last-commit</text><text 
class="breeze-static-checks-r1" x="646.6" y="1654.8" te [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1679.2" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-68)">│</text><text 
class="breeze-static-checks-r7" x="305" y="1679.2" textLength="1134.6" 
clip-path="url(#breeze-static-checks-line-68)">(TEXT)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160
 [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1703.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-69)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1703.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-69)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1703.6" textLength="61" 
clip-path="url(#breeze-static-checks-line-69)">-last</text><text 
class="breeze-static-checks-r4" x="97.6" y="1703.6" textLength="85.4" 
clip-path="url(#b [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1728" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-70)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1728" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-70)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1728" textLength="61" 
clip-path="url(#breeze-static-checks-line-70)">-only</text><text 
class="breeze-static-checks-r4" x="97.6" y="1728" textLength="134.2" 
clip-path="url(#breeze-s [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1703.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-69)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1703.6" textLength="158.6" 
clip-path="url(#breeze-static-checks-line-69)">--last-commit</text><text 
class="breeze-static-checks-r6" x="256.2" y="1703.6" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-69)">-c</text><text 
class="breeze-static-checks-r1" x="305" y="1703.6" textLength="793" clip-p [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1728" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-70)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1728" textLength="207.4" 
clip-path="url(#breeze-static-checks-line-70)">--only-my-changes</text><text 
class="breeze-static-checks-r6" x="256.2" y="1728" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-70)">-m</text><text 
class="breeze-static-checks-r1" x="305" y="1728" textLength="1134.6" clip-pa 
[...]
 </text><text class="breeze-static-checks-r5" x="0" y="1752.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-71)">│</text><text 
class="breeze-static-checks-r1" x="305" y="1752.4" textLength="1134.6" 
clip-path="url(#breeze-static-checks-line-71)">branch&#160;and&#160;HEAD&#160;of&#160;your&#160;branch.&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#1
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1776.8" 
textLength="1464" 
clip-path="url(#breeze-static-checks-line-72)">╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</text><text
 class="breeze-static-checks-r1" x="1464" y="1776.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-72)">
 </text><text class="breeze-static-checks-r5" x="0" y="1801.2" 
textLength="24.4" clip-path="url(#breeze-static-checks-line-73)">╭─</text><text 
class="breeze-static-checks-r5" x="24.4" y="1801.2" textLength="463.6" 
clip-path="url(#breeze-static-checks-line-73)">&#160;Building&#160;image&#160;before&#160;running&#160;checks&#160;</text><text
 class="breeze-static-checks-r5" x="488" y="1801.2" textLength="951.6" 
clip-path="url(#breeze-static-checks-line-73)">──────────────────────────────────
 [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1825.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-74)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1825.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-74)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1825.6" textLength="61" 
clip-path="url(#breeze-static-checks-line-74)">-skip</text><text 
class="breeze-static-checks-r4" x="97.6" y="1825.6" textLength="244" 
clip-path="url(#br [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1850" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-75)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1850" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-75)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1850" textLength="73.2" 
clip-path="url(#breeze-static-checks-line-75)">-force</text><text 
class="breeze-static-checks-r4" x="109.8" y="1850" textLength="73.2" 
clip-path="url(#breez [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1874.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-76)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1874.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-76)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1874.4" textLength="73.2" 
clip-path="url(#breeze-static-checks-line-76)">-image</text><text 
class="breeze-static-checks-r4" x="109.8" y="1874.4" textLength="48.8" 
clip-path="ur [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1825.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-74)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1825.6" textLength="317.2" 
clip-path="url(#breeze-static-checks-line-74)">--skip-image-upgrade-check</text><text
 class="breeze-static-checks-r1" x="414.8" y="1825.6" textLength="536.8" 
clip-path="url(#breeze-static-checks-line-74)">Skip&#160;checking&#160;if&#160;the&#160;CI&#160;image&#160;is&#160;up&#160
 [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1850" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-75)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1850" textLength="158.6" 
clip-path="url(#breeze-static-checks-line-75)">--force-build</text><text 
class="breeze-static-checks-r1" x="414.8" y="1850" textLength="707.6" 
clip-path="url(#breeze-static-checks-line-75)">Force&#160;image&#160;build&#160;no&#160;matter&#160;if&#160;it&#160;is&#160;determined&#160;a
 [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1874.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-76)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1874.4" textLength="134.2" 
clip-path="url(#breeze-static-checks-line-76)">--image-tag</text><text 
class="breeze-static-checks-r1" x="414.8" y="1874.4" textLength="695.4" 
clip-path="url(#breeze-static-checks-line-76)">Tag&#160;of&#160;the&#160;image&#160;which&#160;is&#160;used&#160;to&#160;run&#160;the&#16
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1898.8" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-77)">│</text><text 
class="breeze-static-checks-r7" x="414.8" y="1898.8" textLength="963.8" 
clip-path="url(#breeze-static-checks-line-77)">(TEXT)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#16
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1923.2" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-78)">│</text><text 
class="breeze-static-checks-r5" x="414.8" y="1923.2" textLength="963.8" 
clip-path="url(#breeze-static-checks-line-78)">[default:&#160;latest]&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
 [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1947.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-79)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1947.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-79)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1947.6" textLength="85.4" 
clip-path="url(#breeze-static-checks-line-79)">-github</text><text 
class="breeze-static-checks-r4" x="122" y="1947.6" textLength="134.2" 
clip-path="ur [...]
-</text><text class="breeze-static-checks-r5" x="0" y="1972" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-80)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1972" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-80)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="1972" textLength="97.6" 
clip-path="url(#breeze-static-checks-line-80)">-builder</text><text 
class="breeze-static-checks-r1" x="414.8" y="1972" textLength="756.4" 
clip-path="url(#br [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1947.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-79)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1947.6" textLength="231.8" 
clip-path="url(#breeze-static-checks-line-79)">--github-repository</text><text 
class="breeze-static-checks-r6" x="366" y="1947.6" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-79)">-g</text><text 
class="breeze-static-checks-r1" x="414.8" y="1947.6" textLength="585.6 [...]
+</text><text class="breeze-static-checks-r5" x="0" y="1972" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-80)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="1972" textLength="109.8" 
clip-path="url(#breeze-static-checks-line-80)">--builder</text><text 
class="breeze-static-checks-r1" x="414.8" y="1972" textLength="756.4" 
clip-path="url(#breeze-static-checks-line-80)">Buildx&#160;builder&#160;used&#160;to&#160;perform&#160;`docker&#160;buildx&#160;build`&#160;comma
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="1996.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-81)">│</text><text 
class="breeze-static-checks-r5" x="414.8" y="1996.4" textLength="756.4" 
clip-path="url(#breeze-static-checks-line-81)">[default:&#160;autodetect]&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#
 [...]
 </text><text class="breeze-static-checks-r5" x="0" y="2020.8" 
textLength="1464" 
clip-path="url(#breeze-static-checks-line-82)">╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</text><text
 class="breeze-static-checks-r1" x="1464" y="2020.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-82)">
 </text><text class="breeze-static-checks-r5" x="0" y="2045.2" 
textLength="24.4" clip-path="url(#breeze-static-checks-line-83)">╭─</text><text 
class="breeze-static-checks-r5" x="24.4" y="2045.2" textLength="195.2" 
clip-path="url(#breeze-static-checks-line-83)">&#160;Common&#160;options&#160;</text><text
 class="breeze-static-checks-r5" x="219.6" y="2045.2" textLength="1220" 
clip-path="url(#breeze-static-checks-line-83)">──────────────────────────────────────────────────────────────────────
 [...]
-</text><text class="breeze-static-checks-r5" x="0" y="2069.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-84)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="2069.6" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-84)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="2069.6" textLength="48.8" 
clip-path="url(#breeze-static-checks-line-84)">-dry</text><text 
class="breeze-static-checks-r4" x="85.4" y="2069.6" textLength="48.8" 
clip-path="url(# [...]
-</text><text class="breeze-static-checks-r5" x="0" y="2094" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-85)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="2094" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-85)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="2094" textLength="97.6" 
clip-path="url(#breeze-static-checks-line-85)">-verbose</text><text 
class="breeze-static-checks-r6" x="158.6" y="2094" textLength="24.4" 
clip-path="url(#bre [...]
-</text><text class="breeze-static-checks-r5" x="0" y="2118.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-86)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="2118.4" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-86)">-</text><text 
class="breeze-static-checks-r4" x="36.6" y="2118.4" textLength="61" 
clip-path="url(#breeze-static-checks-line-86)">-help</text><text 
class="breeze-static-checks-r6" x="158.6" y="2118.4" textLength="24.4" 
clip-path="url(# [...]
+</text><text class="breeze-static-checks-r5" x="0" y="2069.6" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-84)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="2069.6" textLength="109.8" 
clip-path="url(#breeze-static-checks-line-84)">--dry-run</text><text 
class="breeze-static-checks-r6" x="158.6" y="2069.6" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-84)">-D</text><text 
class="breeze-static-checks-r1" x="207.4" y="2069.6" textLength="719.8" clip-p 
[...]
+</text><text class="breeze-static-checks-r5" x="0" y="2094" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-85)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="2094" textLength="109.8" 
clip-path="url(#breeze-static-checks-line-85)">--verbose</text><text 
class="breeze-static-checks-r6" x="158.6" y="2094" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-85)">-v</text><text 
class="breeze-static-checks-r1" x="207.4" y="2094" textLength="585.6" 
clip-path="url [...]
+</text><text class="breeze-static-checks-r5" x="0" y="2118.4" 
textLength="12.2" clip-path="url(#breeze-static-checks-line-86)">│</text><text 
class="breeze-static-checks-r4" x="24.4" y="2118.4" textLength="73.2" 
clip-path="url(#breeze-static-checks-line-86)">--help</text><text 
class="breeze-static-checks-r6" x="158.6" y="2118.4" textLength="24.4" 
clip-path="url(#breeze-static-checks-line-86)">-h</text><text 
class="breeze-static-checks-r1" x="207.4" y="2118.4" textLength="329.4" 
clip-path= [...]
 </text><text class="breeze-static-checks-r5" x="0" y="2142.8" 
textLength="1464" 
clip-path="url(#breeze-static-checks-line-87)">╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</text><text
 class="breeze-static-checks-r1" x="1464" y="2142.8" textLength="12.2" 
clip-path="url(#breeze-static-checks-line-87)">
 </text>
     </g>
diff --git a/dev/breeze/doc/images/output_static-checks.txt 
b/dev/breeze/doc/images/output_static-checks.txt
index 5b94473d3c..0042dc0d42 100644
--- a/dev/breeze/doc/images/output_static-checks.txt
+++ b/dev/breeze/doc/images/output_static-checks.txt
@@ -1 +1 @@
-66c92f1353526631aa8a9aea74df63a8
+0fe349c8dcd5f6f59df5dab7c166b228
diff --git a/dev/breeze/src/airflow_breeze/pre_commit_ids.py 
b/dev/breeze/src/airflow_breeze/pre_commit_ids.py
index 66cb126e99..df6066364a 100644
--- a/dev/breeze/src/airflow_breeze/pre_commit_ids.py
+++ b/dev/breeze/src/airflow_breeze/pre_commit_ids.py
@@ -45,7 +45,7 @@ PRE_COMMIT_LIST = [
     "check-core-deprecation-classes",
     "check-daysago-import-from-utils",
     "check-decorated-operator-implements-custom-name",
-    "check-deferrable-default-value",
+    "check-deferrable-default",
     "check-docstring-param-types",
     "check-example-dags-urls",
     "check-executables-have-shebangs",
diff --git a/scripts/ci/pre_commit/check_deferrable_default.py 
b/scripts/ci/pre_commit/check_deferrable_default.py
index 1e1fd9c7a6..bfde61f231 100755
--- a/scripts/ci/pre_commit/check_deferrable_default.py
+++ b/scripts/ci/pre_commit/check_deferrable_default.py
@@ -25,6 +25,10 @@ import os
 import sys
 from typing import Iterator
 
+import libcst as cst
+from libcst.codemod import CodemodContext
+from libcst.codemod.visitors import AddImportsVisitor
+
 ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 
os.pardir, os.pardir))
 
 DEFERRABLE_DOC = (
@@ -33,62 +37,71 @@ DEFERRABLE_DOC = (
 )
 
 
+class DefaultDeferrableVisitor(ast.NodeVisitor):
+    def __init__(self, *args, **kwargs) -> None:
+        super().__init__(*args, *kwargs)
+        self.error_linenos: list[int] = []
+
+    def visit_FunctionDef(self, node: ast.FunctionDef) -> ast.FunctionDef:
+        if node.name == "__init__":
+            args = node.args
+            arguments = reversed([*args.args, *args.posonlyargs, 
*args.kwonlyargs])
+            defaults = reversed([*args.defaults, *args.kw_defaults])
+            for argument, default in itertools.zip_longest(arguments, 
defaults):
+                # argument is not deferrable
+                if argument is None or argument.arg != "deferrable":
+                    continue
+
+                # argument is deferrable, but comes with no default value
+                if default is None:
+                    self.error_linenos.append(argument.lineno)
+                    continue
+
+                # argument is deferrable, but the default value is not valid
+                if not _is_valid_deferrable_default(default):
+                    self.error_linenos.append(default.lineno)
+        return node
+
+
+class DefaultDeferrableTransformer(cst.CSTTransformer):
+    def leave_Param(self, original_node: cst.Param, updated_node: cst.Param) 
-> cst.Param:
+        if original_node.name.value == "deferrable":
+            expected_default_cst = cst.parse_expression(
+                'conf.getboolean("operators", "default_deferrable", 
fallback=False)'
+            )
+
+            if updated_node.default and 
updated_node.default.deep_equals(expected_default_cst):
+                return updated_node
+            return updated_node.with_changes(default=expected_default_cst)
+        return updated_node
+
+
 def _is_valid_deferrable_default(default: ast.AST) -> bool:
     """Check whether default is 'conf.getboolean("operators", 
"default_deferrable", fallback=False)'"""
-    if not isinstance(default, ast.Call):
-        return False  # Not a function call.
-
-    # Check the function callee is exactly 'conf.getboolean'.
-    call_to_conf_getboolean = (
-        isinstance(default.func, ast.Attribute)
-        and isinstance(default.func.value, ast.Name)
-        and default.func.value.id == "conf"
-        and default.func.attr == "getboolean"
-    )
-    if not call_to_conf_getboolean:
-        return False
-
-    # Check arguments.
-    return (
-        len(default.args) == 2
-        and isinstance(default.args[0], ast.Constant)
-        and default.args[0].value == "operators"
-        and isinstance(default.args[1], ast.Constant)
-        and default.args[1].value == "default_deferrable"
-        and len(default.keywords) == 1
-        and default.keywords[0].arg == "fallback"
-        and isinstance(default.keywords[0].value, ast.Constant)
-        and default.keywords[0].value.value is False
-    )
+    return ast.unparse(default) == "conf.getboolean('operators', 
'default_deferrable', fallback=False)"
 
 
 def iter_check_deferrable_default_errors(module_filename: str) -> 
Iterator[str]:
-    ast_obj = ast.parse(open(module_filename).read())
-    cls_nodes = (node for node in ast.iter_child_nodes(ast_obj) if 
isinstance(node, ast.ClassDef))
-    init_method_nodes = (
-        node
-        for cls_node in cls_nodes
-        for node in ast.iter_child_nodes(cls_node)
-        if isinstance(node, ast.FunctionDef) and node.name == "__init__"
-    )
+    ast_tree = ast.parse(open(module_filename).read())
+    visitor = DefaultDeferrableVisitor()
+    visitor.visit(ast_tree)
+    # We check the module using the ast once and then fix it through cst if 
needed.
+    # The primary reason we don't do it all through cst is performance.
+    if visitor.error_linenos:
+        _fix_invalide_deferrable_default_value(module_filename)
+    yield from (f"{module_filename}:{lineno}" for lineno in 
visitor.error_linenos)
 
-    for node in init_method_nodes:
-        args = node.args
-        arguments = reversed([*args.args, *args.posonlyargs, *args.kwonlyargs])
-        defaults = reversed([*args.defaults, *args.kw_defaults])
-        for argument, default in itertools.zip_longest(arguments, defaults):
-            # argument is not deferrable
-            if argument is None or argument.arg != "deferrable":
-                continue
 
-            # argument is deferrable, but comes with no default value
-            if default is None:
-                yield f"{module_filename}:{argument.lineno}"
-                continue
+def _fix_invalide_deferrable_default_value(module_filename: str) -> None:
+    context = CodemodContext(filename=module_filename)
+    AddImportsVisitor.add_needed_import(context, "airflow.configuration", 
"conf")
+    transformer = DefaultDeferrableTransformer()
 
-            # argument is deferrable, but the default value is not valid
-            if not _is_valid_deferrable_default(default):
-                yield f"{module_filename}:{default.lineno}"
+    source_cst_tree = cst.parse_module(open(module_filename).read())
+    modified_cst_tree = 
AddImportsVisitor(context).transform_module(source_cst_tree.visit(transformer))
+    if not source_cst_tree.deep_equals(modified_cst_tree):
+        with open(module_filename, "w") as writer:
+            writer.write(modified_cst_tree.code)
 
 
 def main() -> int:
@@ -103,7 +116,7 @@ def main() -> int:
         for error in errors:
             print(f"  {error}")
         print(
-            """Please set the default value of deferrbale to """
+            """Please set the default value of deferrable to """
             """"conf.getboolean("operators", "default_deferrable", 
fallback=False)"\n"""
             f"See: {DEFERRABLE_DOC}\n"
         )


Reply via email to