gopidesupavan commented on code in PR #57250: URL: https://github.com/apache/airflow/pull/57250#discussion_r2463021996
########## providers/.pre-commit-config.yaml: ########## @@ -0,0 +1,232 @@ +# 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: check-deferrable-default + name: Check and fix default value of default_deferrable + language: python + entry: ../scripts/ci/prek/check_deferrable_default.py + pass_filenames: false + files: ^(.*/)?airflow/.*/(sensors|operators)/.*\.py$ + - id: update-providers-dependencies + name: Update dependencies for providers + entry: ../scripts/ci/prek/update_providers_dependencies.py + language: python + always_run: true + pass_filenames: false + - id: validate-operators-init + name: No templated field logic checks in operator __init__ + description: Prevent templated field logic checks in operators' __init__ + language: python + entry: ../scripts/ci/prek/validate_operators_init.py + pass_filenames: true + files: ^.*/src/airflow/providers/.*/(operators|transfers|sensors)/.*\.py$ + - id: update-providers-build-files + name: Update providers build files + entry: ../scripts/ci/prek/update_providers_build_files.py + language: python + pass_filenames: true + files: | + (?x) + ^[^\/]*/src/airflow/providers/[^\/]*/__init__\.py$| + ^[^\/]*/[^\/]*/src/airflow/providers/[^\/]*/[^\/]*/__init__\.py$| + ^.*/pyproject\.toml$| + ^.*/provider\.yaml$| + ^../dev/breeze/src/airflow_breeze/templates/PROVIDER__INIT__PY_TEMPLATE\.py\.jinja2$| + ^../dev/breeze/src/airflow_breeze/templates/get_provider_info_TEMPLATE\.py\.jinja2$| + ^../dev/breeze/src/airflow_breeze/templates/PROVIDER_README_TEMPLATE\.rst\.jinja2$ + require_serial: true + - id: check-airflow-v-imports-in-tests + name: Check AIRFLOW_V imports in tests + language: python + entry: ../scripts/ci/prek/check_airflow_v_imports_in_tests.py + pass_filenames: true + files: ^.*/tests/.+\.py$ + - id: check-sql-dependency-common-data-structure + name: Check dependency of SQL providers + description: Check dependency of SQL Providers with common data structure + entry: ../scripts/ci/prek/check_common_sql_dependency.py + language: python + files: ^.*/src/airflow/providers/.*/hooks/.*\.py$ + - id: generate-volumes-for-sources + name: Generate volumes for docker compose + entry: ../scripts/ci/prek/generate_volumes_for_sources.py + language: python + files: ^.*/provider\.yaml$ + pass_filenames: false + require_serial: true + - id: check-pytest-mark-db-test-in-providers + language: pygrep + name: Check pytest.mark.db_test use in providers + entry: pytest\.mark\.db_test + pass_filenames: true + # Here we should add providers that are already free from the pytest.mark.db_test + # and we want to keep them clean and only use non-db-tests + files: > + (?x) + ^airbyte/.*\.py$| + ^apache/beam/.*\.py$| + ^apache/flink/.*\.py$| + ^apache/iceberg/.*\.py$| + ^apache/kafka/.*\.py$| + ^apprise/.*\.py$| + ^arangodb/.*\.py$| + ^asana/.*\.py$| + ^atlassian/jira/.*\.py$| + ^cloudant/.*\.py$| + ^cohere/.*\.py$| + ^common/compat/.*\.py$| + ^common/messaging/.*\.py$| + ^datadog/.*\.py$| + ^dingding/.*\.py$| + ^discord/.*\.py$| + ^exasol/.*\.py$| + ^facebook/.*\.py$| + ^ftp/.*\.py$| + ^grpc/.*\.py$| + ^hashicorp/.*\.py$| + ^imap/.*\.py$| + ^influxdb/.*\.py$| + ^jdbc/.*\.py$| + ^jenkins/.*\.py$| + ^mongo/.*\.py$| + ^microsoft/psrp/.*\.py$| + ^microsoft/winrm/.*\.py$| + ^neo4j/.*\.py$| + ^odbc/.*\.py$| + ^openai/.*\.py$| + ^openfaas/.*\.py$| + ^opsgenie/.*\.py$| + ^oracle/.*\.py$| + ^pagerduty/.*\.py$| + ^pgvector/.*\.py$| + ^pinecone/.*\.py$| + ^postgres/.*\.py$| + ^presto/.*\.py$| + ^segment/.*\.py$| + ^sendgrid/.*\.py$| + ^singularity/.*\.py$| + ^slack/.*\.py$| + ^smtp/.*\.py$| + ^tableau/.*\.py$| + ^teradata/.*\.py$| + ^trino/.*\.py$| + ^vertica/.*\.py$| + ^yandex/.*\.py$| + ^zendesk/.*\.py$ + - id: check-links-to-example-dags-do-not-use-hardcoded-versions + name: Verify no hard-coded version in example dags + description: The links to example dags should use |version| as version specification + language: pygrep + entry: > + (?i) + .*https://github.*/main/providers/.*/src/airflow/providers/.*/example_dags/| + .*https://github.*/master/providers/.*/src/airflow/providers/.*/example_dags/ + pass_filenames: true + files: ^.*/docs/.*\.rst + - id: check-no-airflow-deprecation-in-providers + language: pygrep + name: Do not use DeprecationWarning in providers + description: Use AirflowProviderDeprecationWarning in providers + entry: "^\\s*DeprecationWarning*" + pass_filenames: true + files: ^.*/src/airflow/providers/.*\.py$ + - id: check-base-operator-usage + language: pygrep + name: Check BaseOperator other imports + description: Make sure BaseOperator is imported from airflow.models outside of core + entry: "from airflow\\.models\\.baseoperator import.* BaseOperator" Review Comment: oh okay could be, looking forward for min airflow version 3 for providers, then we have bunch of things to refactor 😄 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
