Skip to content

Commit fa22ff2

Browse files
authored
Add new pre-commit hooks (#1543)
* add new hooks with fixes * use clang-format inplace flag * mess with formatting * Revert "mess with formatting" This reverts commit fda7c21. * Remove unnecessary hooks
1 parent 0a8c11b commit fa22ff2

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ repos:
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
1111
rev: v4.6.0
1212
hooks:
13-
- id: trailing-whitespace
1413
- id: check-case-conflict
14+
- id: check-executables-have-shebangs
15+
- id: check-json
16+
- id: check-shebang-scripts-are-executable
17+
- id: check-merge-conflict
18+
- id: check-symlinks
1519
- id: end-of-file-fixer
20+
- id: forbid-submodules
1621
- id: mixed-line-ending
1722
args: ['--fix=lf']
23+
- id: trailing-whitespace
1824
- repo: https://github.com/psf/black
1925
rev: 24.4.2
2026
hooks:
@@ -23,7 +29,7 @@ repos:
2329
rev: v1.3.5
2430
hooks:
2531
- id: clang-format
26-
args: ["--style=file"] # Use the .clang-format file for configuration
32+
args: ["--style=file", "-i"] # Use the .clang-format file for configuration and apply all fixes
2733
files: ^(Common\+\+|Packet\+\+|Pcap\+\+|Tests|Examples)/.*\.(cpp|h)$
2834
- id: cppcheck
2935
args: ["--std=c++11", "--language=c++", "--suppressions-list=cppcheckSuppressions.txt", "--inline-suppr", "--force"]
@@ -38,3 +44,7 @@ repos:
3844
- id: typos
3945
args: ['--config=typos-config.toml']
4046
pass_filenames: false
47+
- repo: https://github.com/lovesegfault/beautysh
48+
rev: v6.2.1
49+
hooks:
50+
- id: beautysh
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22

33
if [ -z "${SAMPLES}" ]; then
4-
SAMPLES=regression_samples
4+
SAMPLES=regression_samples
55
fi
66
if [ -z "${BINARY}" ]; then
7-
BINARY=../Bin/FuzzTarget
7+
BINARY=../Bin/FuzzTarget
88
fi
99

1010
ERR_CODE=0
@@ -14,12 +14,12 @@ GREEN='\033[0;32m'
1414
NC='\033[0m'
1515

1616
for sample in $(ls ${SAMPLES}); do
17-
echo -n "Running sample $sample..."
18-
"${BINARY}" "$SAMPLES/$sample" &> /dev/null && echo -e "${GREEN}[OK]${NC}" || { FAILED=True && echo -e "${RED}[FAIL]${NC}"; }
17+
echo -n "Running sample $sample..."
18+
"${BINARY}" "$SAMPLES/$sample" &> /dev/null && echo -e "${GREEN}[OK]${NC}" || { FAILED=True && echo -e "${RED}[FAIL]${NC}"; }
1919
done
2020

2121
if [[ ! -z $FAILED ]]; then
22-
ERR_CODE=1
22+
ERR_CODE=1
2323
fi
2424

2525
exit $ERR_CODE

Tests/Fuzzers/ossfuzz.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ cmake -DPCAPPP_BUILD_FUZZERS=ON -DPCAPPP_BUILD_TESTS=OFF -DPCAPPP_BUILD_EXAMPLES
1616
cmake --build $TARGETS_DIR -j
1717

1818
# Copy target and options
19-
FUZZERS="
20-
FuzzTarget \
19+
FUZZERS="FuzzTarget \
2120
FuzzTargetNg \
2221
FuzzTargetSnoop \
2322
FuzzWriter \

cmake/setup_dpdk.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)