-
Notifications
You must be signed in to change notification settings - Fork 2
/
.pre-commit-config.yaml
115 lines (115 loc) · 5.38 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
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
---
# all commands by default will run on every commit
default_install_hook_types: [pre-commit]
default_stages: [commit]
# some configs are only available after v2.18
minimum_pre_commit_version: '2.18'
repos:
# Git hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: no-commit-to-branch # prevents users from pushing changes to specific (protected) branches
args: [--branch, develop, --branch, main, --pattern, release/.*]
name: Git checks - committed to protected Git branch?
- id: check-merge-conflict # checks for files that contain merge conflict strings.
name: Git checks - any merge conflicts?
- repo: local
hooks:
- id: git_branch_name_validation # Custom Git branch validation hook
name: Git checks - Git branch name validation
description: This hook validates the Git branch name.
entry: src/sh/pre_commit_hooks/git_validate_branch_name.sh
language: script
pass_filenames: false
# SQLFluff - linter for SQL
- repo: https://github.com/sqlfluff/sqlfluff
rev: 2.0.2
hooks:
- id: sqlfluff-lint # lints SQL files with `SQLFluff`
args: [--dialect, snowflake, --disregard-sqlfluffignores]
# in dbt v1.5 there is a breaking change that causes the package 'sqlfluff-templater-dbt' to fail
additional_dependencies: [dbt-core==1.4, dbt-snowflake==1.4, sqlfluff-templater-dbt==2.0.2]
name: SQL check - linter (using SQLFluff)
# Shell script validation hook - ensures shell scripts conform to shellcheck
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck # Ensure shell scripts conform to shellcheck
name: Shell script checks - linter (using shellcheck)
# Makefile linter
- repo: https://github.com/mrtazz/checkmake.git
rev: 0.2.2
hooks:
- id: checkmake
name: Makefile check - linter
# YAML hooks
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.30.0
hooks:
- id: yamllint # Lint YAML files using rules specified in .yamllint
args: [-c=.yamllint]
name: YAML checks - linter (using yamllint)
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.1
hooks:
- id: yamlfmt # yamlfmt - fix input yaml files
name: YAML fixes
# Python - fixes
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
args: [--line-length=120]
name: Python fixes - format Python code using the Black formatter
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade # automatically upgrade Python syntax to instead use the syntax used in Python 3.6 and above.
args: [--py36-plus]
name: Python fixes - upgrade Python syntax to instead use the syntax used in Python 3.6 and above.
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
hooks:
- id: reorder-python-imports # Reorders import statements in python files.
name: Python fixes - reorder import statements in python files.
# Python - checks
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8 # enforces flake8 style consistency across Python files.
language_version: python3
args: [--max-line-length=150, --max-complexity=10]
name: Python checks - linter (using flake8)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast # checks whether files parse as valid python.
name: Python checks - valid syntax?
- id: name-tests-test # verifies Python test files are named correctly - i.e., ensure py tests match /test*.py
args: [--pytest-test-first]
name: Python checks - pytest tests - named correctly? (I.e., 'test_')
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate # checks your code base for missing docstrings.
args: [--quiet, --fail-under=90]
name: Python checks - docstrings missing?
# General/housekeeping hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline.
name: General fixes - fix end of files
- id: trailing-whitespace # trims trailing whitespace.
name: General fixes - trim trailing whitespace
- id: fix-byte-order-marker # removes utf-8 byte order marker.
name: General fixes - fix utf-9 byte order marker
- id: mixed-line-ending # replaces or checks mixed line ending.
name: General fixes - fix mixed line endings
- id: check-added-large-files # prevents giant files from being committed.
name: General checks - any large files added?
- id: check-case-conflict # checks for files that would conflict in case-insensitive filesystems.
name: General checks - any string case conflicts?
- id: detect-private-key # checks for the existence of private keys.
name: General checks - private key added?