-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix.sh
executable file
·28 lines (22 loc) · 899 Bytes
/
fix.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -o errexit
echo "======================== Clang Format ==================================="
clang-format -i include/*.h src/*.cc
echo "======================== Copyright fix =================================="
add_copyright() {
paths=("$@")
copyright_text="\/\* Copyright 2024 Damian Kolaska \*\/"
for file in "${paths[@]}"; do
if [ -f "$file" ] && [ -r "$file" ]; then
if ! grep -q "^${copyright_text}$" "$file"; then
echo "Adding copyright clause to $file"
sed -i '' "1s/^/${copyright_text}\n/" "$file"
fi
fi
done
}
add_copyright ./include/*.h
add_copyright ./src/*.cc
echo "======================== Clang Tidy fix ================================="
clang-tidy -fix-errors src/*.cc -- -Iinclude/ -std=c++20
echo "======================== Finished ======================================="