-
Notifications
You must be signed in to change notification settings - Fork 319
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
134 lines (130 loc) · 4.69 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
134 lines (130 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3
repos:
- repo: local
hooks:
- id: check-python-version
name: Ensure Python ≥ 3.10
language: python
pass_filenames: false
always_run: true
entry: python
args:
- -c
- |
import sys
required_major = 3
required_minor = 10
current_major, current_minor = sys.version_info[:2]
if (current_major, current_minor) < (required_major, required_minor):
print(
f"ERROR: Python {current_major}.{current_minor} is too old "
f"(requires ≥ {required_major}.{required_minor})."
)
raise SystemExit(1)
- repo: local
hooks:
- id: check-env-file
name: Check if .env file is empty
entry: bash -c 'FILE=dev/.env; if [ -s "$FILE" ]; then echo "$FILE is not empty. Please remove its content."; exit 1; fi'
language: system
types: [file]
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
hooks:
- id: check-added-large-files
exclude: ^dev/dags/dbt/cross_project/(downstream|project_a_bidirectional|project_b_bidirectional)/target/manifest.json$
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
args:
- --unsafe
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: pretty-format-json
args: ["--autofix"]
- id: trailing-whitespace
- id: detect-private-key
- id: detect-aws-credentials
args: ["--allow-missing-credentials"]
- repo: https://github.com/codespell-project/codespell
rev: 57b21406f092110c18776e39b0bda50d37c945c8 # v2.4.3
hooks:
- id: codespell
name: Run codespell to check for common misspellings in files
language: python
types: [text]
args:
- --exclude-file=tests/sample/manifest_model_version.json
- --skip=**/manifest.json,**.min.js,**/manifest_source.json
- -L connexion,aci
- --ignore-words=.codespell-ignore-words
- repo: https://github.com/pre-commit/pygrep-hooks
rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # v1.10.0
hooks:
- id: rst-backticks
- id: python-check-mock-methods
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: ad1b27d73581aa16cca06fc4a0761fc563ffe8e8 # v1.5.6
hooks:
- id: remove-crlf
- id: remove-tabs
exclude: ^docs/make.bat$|^docs/Makefile$|^dev/dags/dbt/jaffle_shop/seeds/raw_orders.csv$
- repo: local
hooks:
- id: check-docs-style
name: Enforce Cosmos docs style guide
entry: python scripts/check_docs_style.py
language: python
files: ^docs/.*\.(rst|jinja2)$
- repo: https://github.com/asottile/pyupgrade
rev: 75992aaa40730136014f34227e0135f63fc951b4 # v3.21.2
hooks:
- id: pyupgrade
args:
- --py310-plus
- --keep-runtime-typing
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 65dbdb59d2f2d9c3bdc343c566821ad3319ddaa3 # v0.16.3
hooks:
- id: ruff-check
args: [ --fix ]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 4160603246a6b365d4a2af661c6d71b0a0f50478 # 26.5.1
hooks:
- id: black
args: ["--config", "./pyproject.toml"]
- repo: https://github.com/asottile/blacken-docs
rev: fda77690955e9b63c6687d8806bafd56a526e45f # 1.20.0
hooks:
- id: blacken-docs
alias: black
additional_dependencies: [black==26.5.1]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 7ff8d35ae36a7d2b968f2f90b4c723e292e594ee # v2.3.1
hooks:
- id: mypy
name: mypy-python
args: [--config-file, "./pyproject.toml"]
additional_dependencies:
[
types-PyYAML,
types-attrs,
attrs,
types-pytz,
types-requests,
types-python-dateutil,
apache-airflow<3.1, # TODO: https://github.com/astronomer/astronomer-cosmos/issues/2004
]
files: ^cosmos
exclude: "dev/dags/dbt/simple/dbt_packages/.*"
ci:
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
autoupdate_schedule: quarterly
skip:
- mypy # build of https://github.com/pre-commit/mirrors-mypy:types-PyYAML,types-attrs,attrs,types-requests,
#types-python-dateutil,apache-airflow@v1.5.0 for python@python3 exceeds tier max size 250MiB: 262.6MiB