-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
112 lines (111 loc) · 3.34 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
# This file configures the code-style checks and runs unittests before code changes are git committed and pushed to Github (the file pyproject.toml contains additional settings)
# After git cloning this repo please install all requirements in requirements.txt and requirements-dev.txt and then execute "pre-commit install"
# Trigger manual run with: pre-commit run --all-files
# Article that explains this: https://towardsdatascience.com/4-pre-commit-plugins-to-automate-code-reviewing-and-formatting-in-python-c80c6d2e9f5
repos:
# General Clean-Up
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: pretty-format-json
args: [ '--autofix' ]
- id: check-toml
- id: check-xml
- id: check-yaml
args:
- "--unsafe"
- id: debug-statements
- id: detect-private-key
- id: fix-byte-order-marker
- id: fix-encoding-pragma
- id: end-of-file-fixer
exclude_types:
- svg
- pofile
exclude: "(^LICENSE$)"
- id: trailing-whitespace
exclude_types:
- svg
args: [ --markdown-linebreak-ext=md ]
- id: mixed-line-ending
args:
- "--fix=lf"
- id: no-commit-to-branch
args: [ --branch, master, --branch, main ]
# Spelling
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--ignore-words-list", "HSI,te,hsi"]
exclude: "(^data/)"
exclude_types:
- pofile
- json
# JavaScript & HTML Formatter
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v3.1.0'
hooks:
- id: prettier
types_or:
- javascript
- ts
- markdown
exclude: "(^Pipfile\\.lock$)"
# Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.7
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
# # Dockerfile formatter
#- repo: https://github.com/AleksaC/hadolint-py
# rev: v2.12.1b3
# hooks:
# - id: hadolint
# Shell script formatter
- repo: https://github.com/lovesegfault/beautysh
rev: v6.2.1
hooks:
- id: beautysh
args:
- "--tab"
# Check shell scripts
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
hooks:
- id: shellcheck
# Finds and removes unused import statements
- repo: https://github.com/hadialqattan/pycln
rev: v2.2.2
hooks:
- id: pycln
# Add static typing to functions/classes
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies: [ types-pytz==2023.3.1.1, types-requests==2.31.0.4, types-PyYAML==6.0.12.20240808 ]
# Checks codebase for missing docstrings
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
# # Run unittests
# - repo: local
# hooks:
# - id: unittests
# name: run unit tests
# entry: python -m unittest
# language: system
# pass_filenames: false
# args: [ "discover" ]