discard non-sipified directories in prepare_commit and verify_indent

This commit is contained in:
Denis Rouzaud 2024-11-29 16:06:04 +01:00
parent e8b702b9b8
commit 5b60c23a49
3 changed files with 31 additions and 21 deletions

View File

@ -1,6 +1,7 @@
exclude: |
(?x)^(
python/.*/auto_\w+/.*.py|
external/.*|
tests/testdata/script_with_error.py
)$
fail_fast: false
@ -8,16 +9,20 @@ fail_fast: false
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.3
exclude: |
(?x)^(
src/core/.*|
src/gui/.*|
src/analysis/.*|
src/3d/.*
)$
# if adding directory handled by clang-format
# you need to adapt prepare_commit and verify_indentation scripts accordingly
hooks:
- id: clang-format
types_or: [c++, c, c#]
exclude: |
(?x)^(
src/core/.*|
src/gui/.*|
src/analysis/.*|
src/3d/.*|
src/server/.*|
tests/code_layout/sipify/sipifyheader.h
)$
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0

View File

@ -119,13 +119,15 @@ for f in $MODIFIED; do
;;
esac
m=$f.$REV.prepare
cp "$f" "$m"
ASTYLEPROGRESS=" [$i/$N]" astyle.sh "$f"
if diff -u "$m" "$f" >>"$ASTYLEDIFF"; then
# no difference found
rm "$m"
# only run astyle on sipified directories, others are handled by clang-format (see .pre-commit-config.yaml)
if [[ $f =~ "^src/(core|gui|analysis|3d|server)" ]]; then
m=$f.$REV.prepare
cp "$f" "$m"
ASTYLEPROGRESS=" [$i/$N]" astyle.sh "$f"
if diff -u "$m" "$f" >>"$ASTYLEDIFF"; then
# no difference found
rm "$m"
fi
fi
done

View File

@ -39,13 +39,16 @@ for f in $FILES; do
;;
esac
m="$f.prepare"
cp "$f" "$m"
astyle.sh "$f"
if diff -u "$m" "$f" >>$ASTYLEDIFF; then
rm "$m"
else
echo "File $f is not styled properly."
# only run astyle on sipified directories, others are handled by clang-format (see .pre-commit-config.yaml)
if [[ $f =~ "^src/(core|gui|analysis|3d|server)" ]]; then
m="$f.prepare"
cp "$f" "$m"
astyle.sh "$f"
if diff -u "$m" "$f" >>$ASTYLEDIFF; then
rm "$m"
else
echo "File $f is not styled properly."
fi
fi
done