-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
132 lines (132 loc) · 5.11 KB
/
.pre-commit-config.yaml
File metadata and controls
132 lines (132 loc) · 5.11 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
# This is our configuration of pre-commit (https://pre-commit.com/),
# which is a framework for managing and maintaining multi-language
# pre-commit hooks.
#
# The hooks below do many things including running linters, remove
# trailing whitespace or preventing CompArch checksum conflicts. The
# basic idea to achieve some sort of basic code hygiene and catch
# simple issues early.
#
# Another major feature is auto-formatting of code; see
# https://howto.contact.de/index.php/Python_Coding_Guide#Code_Formatting
# for backgrounds.
#
# Feel free to adapt it to your needs; e.g. remove the ESLint hook
# if your component doesn't contain JS code.
#
# Related resources:
# * https://howto.contact.de/index.php/Pre-commit
# * https://pre-commit.com
# * https://pre-commit.com/hooks.html
#
repos:
# ------------------Format Hooks--------------- #
- repo: https://github.com/ambv/black
# Black is a PEP 8 compliant opinionated code formatter.
rev: 26.1.0
hooks:
- id: black
types: [file] # override `types: [python]`
files: \.(pyi?|ue)$
args: [--include, '\.(pyi?|ue)$', -v]
- repo: https://github.com/asottile/blacken-docs
# Runs black on Python code blocks in documentation files.
rev: 1.20.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==26.1.0
- repo: https://github.com/pycqa/isort
# Python utility that sorts imports in files
rev: 7.0.0
hooks:
- id: isort
types: [file] # override `types: [python]`
files: \.(pyi?|ue)$
- repo: https://github.com/rbubley/mirrors-prettier
# Prettier is an opinionated code formatter for JS, TS, json etc.
rev: v3.8.0
hooks:
- id: prettier
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.16.0
hooks:
- id: pretty-format-toml
args: [--autofix]
# ------------------Linter Hooks--------------- #
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# Prevents large files from being committed. Default is args: ['--maxkb=500']
- id: check-added-large-files
# Check for files with names that would conflict on a case-insensitive filesystem
- id: check-case-conflict
# Checks for a common error of placing code before the docstring.
- id: check-docstring-first
# Checks that non-binary executables have a proper shebang.
- id: check-executables-have-shebangs
# Attempts to load all JSON files to verify syntax.
- id: check-json
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Attempts to load all YAML files to verify syntax.
- id: check-yaml
# Check for debugger imports and py37+ breakpoint() calls in Python source.
- id: debug-statements
# Checks for the existence of private keys.
- id: detect-private-key
# Removes UTF-8 byte order marker
- id: fix-byte-order-marker
# Makes sure files end in a newline and only a newline.
- id: end-of-file-fixer
# Replaces or checks mixed line ending.
- id: mixed-line-ending
# Trims trailing whitespace.
- id: trailing-whitespace
- repo: https://github.com/homebysix/pre-commit-macadmin
rev: v1.22.0
hooks:
# Checks, whether a correct identity is used to commit/ push
- id: check-git-config-email
args: ['--domains', 'contact.de', 'contact-software.com']
- repo: https://github.com/PyCQA/flake8
# Flake8 is a wrapper around PyFlakes, pycodestyle and Ned Batchelder's McCabe script
# and runs these tools to lint files.
rev: 7.3.0
hooks:
- id: flake8
args:
- --format=pylint
- --max-line-length=100
types: [file] # override `types: [python]`
files: \.(pyi?|ue)$
# FIXME: pylint generates lots of issues that should get fixed prior proper releasing
- repo: https://github.com/pycqa/pylint
# Linting of Python 3 files
rev: v4.0.4
hooks:
- id: pylint
args:
- --rcfile=pyproject.toml
- --output-format=parseable
- -d=W0511 # W0511 disables fixme checking
- -j=4
- repo: https://github.com/PyCQA/bandit
# Bandit is a tool designed to find common security issues in Python code.
rev: 1.9.3
hooks:
- id: bandit
args:
- -x=tests # exclude tests from run
- --skip=B404,B603 # ignore subprocess-use and subprocess without shell=true
types: [file] # override `types: [python]`
files: \.(pyi?|ue)$
# Mypy for type assurance
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
exclude: ^tests/
args: [--config-file=pyproject.toml]
default_language_version:
python: python3