Skip to content

Commit 619e346

Browse files
committed
Make pre-commit hook a local hook
1 parent d22ad2c commit 619e346

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/franzpoeschel/openPMD-api-pre-commit-hooks
5-
rev: aa38b2ad4fae42db05c19de211f43df6a7981bc5
4+
- repo: local
65
hooks:
76
- id: clang-format
7+
name: clang-format
8+
description: Clang-format our code base
9+
language: conda
10+
entry: bash ./clang-format.sh --install-clang-format
11+
additional_dependencies: [clang-format-12]

clang-format.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ $1 = "--install-clang-format" ]]; then
4+
echo -e "\n\n\n–––––––\nENV:\n––––––––\n\n\n$(env)\n\n\n–––––\nBINS:\n–––––\n\n\n$(ls $CONDA_PREFIX/..)\n\n\n"
5+
ls /usr/bin
6+
fi
7+
8+
find include/ src/ test/ examples/ \
9+
-regextype egrep \
10+
-type f -regex '.*\.(hpp|cpp|hpp\.in)$' \
11+
| xargs /usr/bin/clang-format-12 -i

environment.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# I am a conda environment, used for our pre-commit hooks
2+
name: openPMD-api-dev
3+
channels:
4+
- conda-forge
5+
dependencies:
6+
- clang-format-12=12.0.1
7+
- bash=5

0 commit comments

Comments
 (0)