-
Notifications
You must be signed in to change notification settings - Fork 2
/
.pre-commit-config.yaml
169 lines (148 loc) · 5.73 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# Ensures no trailing whitespace in files, which can cause
# merge conflicts and makes diffs harder to read.
- id: trailing-whitespace
# Ensures each file ends with a newline, which is a POSIX standard
# for text files and can prevent errors with certain parsers.
- id: end-of-file-fixer
# Validates YAML file syntax, which is helpful since YAML is
# whitespace-sensitive and prone to syntax errors.
- id: check-yaml
# Warns if files above a specified size are added, as large files
# can bloat the repository and slow down cloning and other operations.
- id: check-added-large-files
# Checks the syntax of TOML files, ensuring the correctness of
# `pyproject.toml` or other configuration files in TOML format.
- id: check-toml
# Detects private keys accidentally committed to the repository,
# which helps prevent sensitive information from being exposed.
- id: detect-private-key
- repo: https://github.com/python-poetry/poetry
rev: "1.8.0"
hooks:
# Verifies that the `pyproject.toml` file is valid and follows Poetry's
# expected syntax, which ensures consistent dependency management.
- id: poetry-check
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.4"
hooks:
# Formats the `pyproject.toml` file to follow a consistent structure
# and style, making it easier to read and maintain.
- id: pyproject-fmt
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
# Detects and corrects common typos in the codebase, improving
# readability and reducing minor mistakes.
- id: codespell
exclude: |
(?x)^(
.*\.lock |
.*\.json |
.*\.bib |
.*\.ipynb
)$
additional_dependencies:
- tomli
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
# Formats Markdown files to ensure a consistent style,
# making the documentation easier to read and maintain.
- id: mdformat
additional_dependencies:
- mdformat-myst
- mdformat-gfm
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
# Lints YAML files to enforce consistent formatting, which
# makes YAML easier to read and reduces syntax errors.
- id: yamllint
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
# Formats Python code to follow the Black code style,
# promoting consistency and readability across the codebase.
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
hooks:
# Formats code blocks in Markdown and reStructuredText
# documentation files with Black's style, ensuring
# consistency in inline code snippets.
- id: blacken-docs
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
# Sorts imports in Python files, making the code easier to
# navigate and reducing merge conflicts in import statements.
- id: isort
- repo: https://github.com/PyCQA/bandit
rev: 1.7.9
hooks:
# Scans Python code for common security issues, helping to identify
# and fix potential vulnerabilities in the codebase.
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.2"
hooks:
# A fast linter that checks for stylistic errors in Python code,
# helping maintain code quality and adherence to style guidelines.
- id: ruff
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
# Lints GitHub Actions workflows, ensuring syntax correctness and
# reducing errors in continuous integration and automation configurations.
- id: actionlint-docker
- repo: https://github.com/citation-file-format/cffconvert
rev: b6045d78aac9e02b039703b030588d54d53262ac
hooks:
# Validates `CITATION.cff` files, ensuring proper citation metadata
# for the repository, which promotes good citation practices.
- id: validate-cff
- repo: https://github.com/jendrikseipp/vulture
rev: 'v2.13'
hooks:
# Detects unused code, helping identify dead code that can be removed
# to keep the codebase lean and maintainable.
- id: vulture
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
# Runs Black formatting on Jupyter notebooks, ensuring code cells
# adhere to the Black code style.
- id: nbqa-black
# Runs isort on Jupyter notebooks, sorting imports in code
# cells for consistency.
- id: nbqa-isort
args: ["--float-to-top"]
- repo: local
hooks:
# Runs the Vale linting tool to check for spelling, grammar,
# and style errors in text files, improving the quality of documentation.
- id: vale.sh
name: vale.sh writing checks
entry: poetry run poe vale-checks
language: system
pass_filenames: false
# Checks that the sbom.json (software bill of materials) file
# is up to date with accurate data for the dependencies within
# the project. This file is important for providing an accurate
# and standardized reference of all components used to implement
# or build this software.
- id: syft-sbom-check
name: Syft SBOM Check
entry: poetry run poe sbom-checks
language: system
pass_filenames: false