-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgrep_clangformat_cppcheck.sh
More file actions
executable file
·57 lines (41 loc) · 2.44 KB
/
grep_clangformat_cppcheck.sh
File metadata and controls
executable file
·57 lines (41 loc) · 2.44 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# ** glob now searches any number of levels
shopt -s globstar
# miscellaneous checks - done before initializing git submodules to avoid checking stuff not in our code
echo "check NULL instead of nullptr"
grep "nullptr" --recursive ../library/ && exit 1
echo "check no endl"
grep "endl" --recursive library_checker_aizu_tests/ && exit 1
echo "check template<class T> over template<typename T>:"
grep --extended-regexp "template\s?<typename" --recursive ../library/ && exit 1
echo "check 1 instead of true"
grep "true" --recursive ../library/ && exit 1
echo "check ll instead of long long or int64_t"
grep "long long" --recursive ../library/ && exit 1
grep "int64_t" --recursive ../library/**/*.hpp | grep "uint64_t" --invert-match && exit 1
echo "check pii instead of pair<int, int>"
grep "pair<int, int>" --recursive ../library/**/*.hpp && exit 1
echo "check sz instead of ssize"
grep "ssize" --recursive ../library/ && exit 1
echo "check vi instead of vector<int>"
grep "vector<int>" --recursive ../library/**/*.hpp && exit 1
echo "check no basic_string, excluding @code example inits"
grep "[[:space:]]*//\!" --recursive --invert-match ../library/**/*.hpp library_checker_aizu_tests/**/*.test.cpp | grep "basic_string" && exit 1
echo "check begin(arr) instead of arr.begin(), similarly for end, rbegin, rend, empty, size:"
# TODO: remove this define filter if/when we move to -std=c++20
grep --invert-match --fixed-strings "#define" --recursive ../library/ library_checker_aizu_tests/ |
grep --fixed-strings --regexp=".begin()" --regexp=".rbegin()" --regexp=".end()" --regexp=".rend()" --regexp=".empty()" --regexp=".size()" && exit 1
echo "check that there are no empty lines"
grep "^$" ../library/**/*.hpp && exit 1
echo "check files and directories are snake_case:"
find ../library/ library_checker_aizu_tests/ -name "*[A-Z]*" -or -name "*-*" |
grep --invert-match ".verify-helper" |
grep --invert-match "README" &&
exit 1
clang-format-19 --dry-run --Werror --style=file:.config/.clang-format library_checker_aizu_tests/**/*.hpp library_checker_aizu_tests/**/*.test.cpp ../library/**/*.hpp ../library/**/*.cpp || exit 1
git submodule init
git submodule update
cppcheck --enable=all --inconclusive --suppressions-list=.config/.cppcheck_suppression_list \
--force --language=c++ --error-exitcode=1 --std=c++20 --max-ctu-depth=50 \
library_checker_aizu_tests/**/*.hpp library_checker_aizu_tests/**/*.test.cpp ../library/**/*.hpp ../library/**/*.cpp ||
exit 1