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

vincbeck 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 267882a4672 Extract prek hooks for FAB provider (#57181)
267882a4672 is described below

commit 267882a4672dbd72d8fae2aaf74f27405a220b83
Author: Jens Scheffler <[email protected]>
AuthorDate: Fri Oct 24 17:23:32 2025 +0200

    Extract prek hooks for FAB provider (#57181)
    
    * Extract prek hooks for FAB provider
    
    * Apply suggestion from @jscheffl
    
    * Apply suggestion from @jscheffl
    
    * Apply suggestion from @jscheffl
---
 .pre-commit-config.yaml               | 25 ++++-------------
 providers/fab/.pre-commit-config.yaml | 51 +++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 46d8ee4ba4c..f2f85974777 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -537,7 +537,6 @@ repos:
             (?x)
             ^airflow-ctl.*\.py$|
             ^airflow-core/src/airflow/models/.*\.py$|
-            ^providers/fab/.*\.py$|
             ^task_sdk.*\.py$
         pass_filenames: true
       - id: update-supported-versions
@@ -554,10 +553,9 @@ repos:
         files: >
           (?x)
           ^scripts/ci/prek/version_heads_map\.py$|
-          
^airflow-core/src/airflow/migrations/versions/.*$|^airflow-core/src/airflow/migrations/versions|
-          
^providers/fab/src/airflow/providers/fab/migrations/versions/.*$|^providers/fab/src/airflow/providers/fab/migrations/versions|
-          ^airflow-core/src/airflow/utils/db\.py$|
-          ^providers/fab/src/airflow/providers/fab/auth_manager/models/db\.py$
+          ^airflow-core/src/airflow/migrations/versions/.*$|
+          ^airflow-core/src/airflow/migrations/versions|
+          ^airflow-core/src/airflow/utils/db\.py$
       - id: update-version
         name: Update versions in docs
         entry: ./scripts/ci/prek/update_versions.py
@@ -937,13 +935,6 @@ repos:
         entry: ./scripts/ci/prek/compile_ui_assets.py
         pass_filenames: false
         additional_dependencies: ['[email protected]']
-      - id: compile-fab-assets
-        name: Compile FAB provider assets
-        language: node
-        files: ^providers/fab/.*/www/
-        entry: ./scripts/ci/prek/compile_provider_assets.py fab
-        pass_filenames: false
-        additional_dependencies: ['[email protected]']
       - id: compile-ui-assets-dev
         name: Compile ui assets in dev mode (manual)
         language: node
@@ -1252,7 +1243,7 @@ repos:
           # W0133: "Exception statement has no effect"
           # see: https://github.com/astral-sh/ruff/issues/10145
           - "--enable=W0133"
-      - id: check-fab-migrations
+      - id: check-no-fab-migrations
         language: pygrep
         name: Check no migration is done on FAB related table
         description: >
@@ -1408,14 +1399,8 @@ repos:
         language: python
         entry: ./scripts/ci/prek/generate_openapi_spec.py
         pass_filenames: false
-        files: 
^airflow-core/src/airflow/api_fastapi/.*\.py$|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/.*\.py$|^providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/.*\.py$
+        files: 
^airflow-core/src/airflow/api_fastapi/.*\.py$|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/.*\.py$
         exclude: ^airflow-core/src/airflow/api_fastapi/execution_api/.*
-      - id: generate-openapi-spec-fab
-        name: Generate the FastAPI API spec for FAB
-        language: python
-        entry: ./scripts/ci/prek/generate_openapi_spec_providers.py fab
-        pass_filenames: false
-        files: 
^providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/.*\.py$
       - id: check-i18n-json
         name: Check i18n files validity
         description: Check i18n files are valid json, have no TODOs, and 
auto-format them
diff --git a/providers/fab/.pre-commit-config.yaml 
b/providers/fab/.pre-commit-config.yaml
new file mode 100644
index 00000000000..0f18a39d0bd
--- /dev/null
+++ b/providers/fab/.pre-commit-config.yaml
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+default_stages: [pre-commit, pre-push]
+minimum_prek_version: '0.0.28'
+repos:
+  - repo: local
+    hooks:
+      - id: compile-fab-assets
+        name: Compile FAB provider assets
+        language: node
+        files: ^.*/www/
+        entry: ../../scripts/ci/prek/compile_provider_assets.py fab
+        pass_filenames: false
+        additional_dependencies: ['[email protected]']
+      - id: generate-openapi-spec-fab
+        name: Generate the FastAPI API spec for FAB
+        language: python
+        entry: ../../scripts/ci/prek/generate_openapi_spec_providers.py fab
+        pass_filenames: false
+        files: ^src/airflow/providers/fab/auth_manager/api_fastapi/.*\.py$
+      - id: check-revision-heads-map-fab
+        name: Check that the REVISION_HEADS_MAP is up-to-date
+        language: python
+        entry: ../../scripts/ci/prek/check_revision_heads_map.py
+        pass_filenames: false
+        files: >
+          (?x)
+          ^src/airflow/providers/fab/migrations/versions/.*$|
+          ^src/airflow/providers/fab/migrations/versions|
+          ^src/airflow/providers/fab/auth_manager/models/db\.py$
+      - id: prevent-deprecated-sqlalchemy-usage-fab
+        name: Prevent deprecated sqlalchemy usage
+        entry: ../../scripts/ci/prek/prevent_deprecated_sqlalchemy_usage.py
+        language: python
+        files: ^.*\.py$
+        pass_filenames: true

Reply via email to