blob: bb6e2aae8de8d4c39cd602f1cd865ea7ed4062dd [file] [log] [blame]
# 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.
---
minimum_pre_commit_version: 2.16.0
exclude: >
(?x)^(
.+/.venv/.+|.+/dist/.+|.+/.autovenv|.+/docs/|.github
)$
fail_fast: true
default_language_version:
python: python3
default_stages:
- prepare-commit-msg
- commit
# - push
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-case-conflict
- id: check-merge-conflict
stages:
- commit
- id: check-added-large-files
args: [--maxkb=1000]
stages:
- commit
- id: detect-aws-credentials
args:
- --allow-missing-credentials
- id: fix-encoding-pragma
args:
- --remove
- id: detect-private-key
- id: destroyed-symlinks
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-toml
# To match test*.py instead
# - id: name-tests-test
# args: [--django]
# exclude: |
# - tests/test_licenses
- id: end-of-file-fixer
description: Ensures that a file is either empty, or ends with one newline.
exclude_types: [sql]
# types: [text]
- id: pretty-format-json
args:
- --autofix
- --no-sort-keys
- --indent
- '2'
# files:
pass_filenames: true
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.10
hooks:
- id: insert-license
name: Add license for all md files
files: \.md$
exclude: ^\.github/.*$
args:
- --comment-style
- <!--|| -->
- --license-filepath
- dev/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all SQL files
files: \.sql$
exclude: ^\.github/.*$|^airflow/_vendor/
args:
- --comment-style
- /*||*/
- --license-filepath
- dev/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all other files
exclude: ^\.github/.*$|^airflow/_vendor/
args:
- --comment-style
- '|#|'
- --license-filepath
- dev/LICENSE.txt
- --fuzzy-match-generates-todo
files: >
\.properties$|\.cfg$|\.conf$|\.ini$|\.ldif$|\.readthedocs$|\.service$|\.tf$|Dockerfile.*$
- id: insert-license
name: Add license for all JINJA template files
files: ^airflow/www/templates/.*\.html$|^docs/templates/.*\.html$.*\.jinja2
exclude: ^\.github/.*$^airflow/_vendor/
args:
- --comment-style
- '{#||#}'
- --license-filepath
- dev/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all shell files
exclude: ^\.github/.*$|^airflow/_vendor/
files: ^breeze$|^breeze-complete$|\.sh$|\.bash$|\.bats$
args:
- --comment-style
- '|#|'
- --license-filepath
- dev/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all Python files
exclude: ^\.github/.*$|^airflow/_vendor/
types: [python]
args:
- --comment-style
- '|#|'
- --license-filepath
- dev/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all YAML files
exclude: ^\.github/.*$|^airflow/_vendor/
types: [yaml]
files: \.yml$|\.yaml$
args:
- --comment-style
- '|#|'
- --license-filepath
- dev/LICENSE.txt
- --fuzzy-match-generates-todo
# Python: Black formatter
- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
args: [--safe, --quiet, --config=./pyproject.toml]
files: \.pyi?$
exclude: .github/
# override until resolved: https://github.com/psf/black/issues/402
types: []
# - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
# rev: 0.1.0
# hooks:
# - id: yamlfmt
# args: [--mapping, '2', --sequence, '4', --offset, '2']
# Yaml: lint
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
hooks:
- id: yamllint
name: Check YAML files with yamllint
entry: yamllint -c yamllint-config.yml # --strict
types: [yaml]
# Python - isort to sort imports in Python files
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
hooks:
- id: isort
name: Run isort to sort imports in Python files
args: [--profile, black]
files: \.py$
# To keep consistent with the global isort skip config defined in setup.cfg
exclude: ^build/.*$|^.tox/.*$|^venv/.*$
# PyUpgrade - 3.6
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
args: [--py36-plus]
exclude: ^scripts/|^docs
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
hooks:
- id: blacken-docs
alias: black
additional_dependencies: [black==21.9b0]
# - repo: https://github.com/PyCQA/bandit
# rev: 1.7.1
# hooks:
# - id: bandit
# args: [-ll, -r, liminal]
# files: .py$
# exclude: tests/test_licenses.py|^tests/runners