-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
77 lines (77 loc) · 2.59 KB
/
.pre-commit-config.yaml
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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
args:
- --unsafe
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args: [--show-source, --fix]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
types_or: [rst, markdown]
files: docs
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
args: [--warn-unused-configs]
additional_dependencies:
# Type stubs
- pandas-stubs==v1.5.3.230321
- types-requests
- numpy
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
types: [yaml]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.28.0
hooks:
- id: yamllint
args: []
- repo: local
hooks:
- name: Dbt deps
id: dbt-deps
language: system
entry: poetry run dbt deps --project-dir transform
always_run: false
pass_filenames: false
types: [sql]
# Note: for SQLFluff we don't use the default pre-commit hook for a few reasons:
# 1. dbt cloud looks for config in the dbt project directory, so we put it in
# transform/, however sqlfluff requires the templater config to be in the
# current working directory. So we have to cd to transform/ to properly set the
# templater config.
# 2. Some machines (such as ODI Macs) seem to struggle with sqlfluff's
# multiprocessing implementation, so we force it to be single-process.
# 3. The pre-commit managed python environment can be difficult to install,
# especially due to issues with pyarrow being brought in by Snowflake.
# This keep things more predictable by using the poetry.lock environment.
- repo: local
hooks:
- id: sqlfluff
name: sqlfluff
language: system
description: "Lints sql files with `SQLFluff`"
types: [sql]
require_serial: true
entry: >
poetry run python -c "import os, subprocess; os.chdir('transform');
subprocess.run(['sqlfluff', 'fix', '--force', '--processes', '1',
'--nocolor', '--show-lint-violations', '--disable-progress-bar'],
check=True, )"