Skip to content

Commit

Permalink
Add pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
varunsh-xilinx committed Jul 11, 2022
1 parent 8df9b63 commit 048bdd7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,21 @@
repos:
# Python hooks
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
# C++ hooks
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.0
hooks:
- id: clang-format
# general hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: pretty-format-json
args: [--autofix]
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
3 changes: 2 additions & 1 deletion CONTRIBUTING.rst
Expand Up @@ -79,5 +79,6 @@ Here is an example Signed-off-by line which indicates that the contributor accep
Style Guide
-----------

Please run clang-format, clang-tidy and cpplint on your requests prior to submitting them.
``pre-commit`` is used to enforce style and is included in the development container.
Install it with ``pre-commit install`` to configure the pre-commit hook.
Add tests to validate your changes.
1 change: 1 addition & 0 deletions Dockerfile
Expand Up @@ -560,6 +560,7 @@ RUN apt-get update \
black \
cpplint \
cmakelang \
pre-commit \
# install opencv
opencv-python-headless \
# install benchmarking dependencies
Expand Down
1 change: 1 addition & 0 deletions docs/dependencies.rst
Expand Up @@ -122,6 +122,7 @@ The following packages (and any dependencies) are installed from the Python Pack
:pypipackages:`numpy`,latest,BSD-3,Scientific computing package for Python\ :superscript:`d 0`
:pypipackages:`opencv-python-headless`,latest,MIT,Python bindings for OpenCV\ :superscript:`d 0`
:pypipackages:`pip`,latest,MIT,Python package installer\ :superscript:`d 0`
:pypipackages:`pre-commit`,latest,MIT,Pre-commit hook framework\ :superscript:`d 0`
:pypipackages:`pybind11_mkdoc`,latest,MIT,Used to extract function documentation for Python binding\ :superscript:`d 0`
:pypipackages:`pybind11-stubgen`,latest,BSD-3,Used to generate type stubs for Python binding\ :superscript:`d 0`
:pypipackages:`pytest`,latest,MIT,Python testing infrastructure\ :superscript:`d 0`
Expand Down

0 comments on commit 048bdd7

Please sign in to comment.