-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
108 lines (108 loc) · 3.81 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
default_stages: ['commit']
repos:
# pre-commit repo:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
# general hooks:
- id: check-added-large-files # Prevent giant files from being committed
args: ['--maxkb=5000']
- id: check-case-conflict # Check for files with names that would conflict on a case-insensitive filesystems
- id: check-executables-have-shebangs # Checks that non-binary executables have a proper shebang
- id: check-merge-conflict # Check for files that contain merge conflict strings
- id: check-symlinks # Checks for symlinks which do not point to anything
- id: check-yaml # Attempts to load all yaml files to verify syntax
- id: destroyed-symlinks # Detects symlinks which are changed to regular files
- id: detect-private-key # Checks for the existence of private keys
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline
- id: fix-byte-order-marker # removes UTF-8 byte order marker
- id: mixed-line-ending # Replaces or checks mixed line endings
args: ['--fix=lf']
- id: trailing-whitespace # Trims trailing whitespace
# Python specific hooks:
- id: check-ast # Simply check whether files parse as valid python
- id: check-docstring-first # Checks for a common error of placing code before the docstring
- id: debug-statements # Check for debugger imports and py37+ `breakpoint()` calls in python source
- id: fix-encoding-pragma # Remove `# -*- coding: utf-8 -*-` from the top of python files
args: ['--remove']
- id: name-tests-test # Assert that files in tests/ end in `_test.py`
- id: requirements-txt-fixer # Sorts entries in requirements.txt and removes incorrect entry `pkg-resources==0.0.0`
# General repos:
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
exclude_types: [markdown]
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
args: [
'--ignore=body-is-missing,title-must-not-contain-word',
'--msg-filename',
]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
hooks:
- id: markdownlint
- repo: https://github.com/adrienverge/yamllint
rev: v1.34.0
hooks:
- id: yamllint
args: [
'--config-data={extends: default, rules: {indentation: {indent-sequences: consistent}, line-length: {max: 120}}}'
]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.28.0
hooks:
- id: check-jsonschema
name: 'Validate GitLab CI configuration'
files: ^\.gitlab-ci.yml
args: [
'--schemafile',
'https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json',
]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.28.0
hooks:
- id: check-github-workflows
- repo: https://github.com/IngoMeyer441/hadolint-get
rev: v0.1.1
hooks:
- id: hadolint-get
args: ['--hadolint-version=v2.12.0', '--', '--failure-threshold=error']
# Python specific repos:
- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.0
hooks:
- id: rstcheck
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
args: ['--line-length=120']
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [ # Arguments for `black` compatibility
'--line-length=120',
'--multi-line=3',
'--trailing-comma',
'--force-grid-wrap=0',
'--use-parentheses',
'--ensure-newline-before-comments',
]
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args: [
'--max-line-length=120',
'--ignore=E203,W503', # Otherwise, `flake8` is not compatible with `black`
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
args: ['--ignore-missing-imports']