Skip to content

Commit 048bdd7

Browse files
Add pre-commit
1 parent 8df9b63 commit 048bdd7

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
# Python hooks
3+
- repo: https://github.com/psf/black
4+
rev: 22.3.0
5+
hooks:
6+
- id: black
7+
# C++ hooks
8+
- repo: https://github.com/pre-commit/mirrors-clang-format
9+
rev: v13.0.0
10+
hooks:
11+
- id: clang-format
12+
# general hooks
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v4.1.0
15+
hooks:
16+
- id: check-added-large-files
17+
- id: pretty-format-json
18+
args: [--autofix]
19+
- id: check-merge-conflict
20+
- id: trailing-whitespace
21+
- id: end-of-file-fixer

CONTRIBUTING.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,6 @@ Here is an example Signed-off-by line which indicates that the contributor accep
7979
Style Guide
8080
-----------
8181

82-
Please run clang-format, clang-tidy and cpplint on your requests prior to submitting them.
82+
``pre-commit`` is used to enforce style and is included in the development container.
83+
Install it with ``pre-commit install`` to configure the pre-commit hook.
8384
Add tests to validate your changes.

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ RUN apt-get update \
560560
black \
561561
cpplint \
562562
cmakelang \
563+
pre-commit \
563564
# install opencv
564565
opencv-python-headless \
565566
# install benchmarking dependencies

docs/dependencies.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ The following packages (and any dependencies) are installed from the Python Pack
122122
:pypipackages:`numpy`,latest,BSD-3,Scientific computing package for Python\ :superscript:`d 0`
123123
:pypipackages:`opencv-python-headless`,latest,MIT,Python bindings for OpenCV\ :superscript:`d 0`
124124
:pypipackages:`pip`,latest,MIT,Python package installer\ :superscript:`d 0`
125+
:pypipackages:`pre-commit`,latest,MIT,Pre-commit hook framework\ :superscript:`d 0`
125126
:pypipackages:`pybind11_mkdoc`,latest,MIT,Used to extract function documentation for Python binding\ :superscript:`d 0`
126127
:pypipackages:`pybind11-stubgen`,latest,BSD-3,Used to generate type stubs for Python binding\ :superscript:`d 0`
127128
:pypipackages:`pytest`,latest,MIT,Python testing infrastructure\ :superscript:`d 0`

0 commit comments

Comments
 (0)