File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ BasedOnStyle : Chromium
3+ IndentWidth : 4
4+ TabWidth : 4
5+ UseTab : Always
6+ DerivePointerAlignment : true
7+ BreakBeforeBraces : Custom
8+ BraceWrapping :
9+ AfterFunction : true
10+ BeforeCatch : false
11+ BeforeElse : false
12+ AlignAfterOpenBracket : false
13+ SortIncludes : false
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ The project is setup to use two different cryptographic
2020
2121Go ahead, file issues, make pull requests.
2222
23- before committing changes, run ` ./scripts/format_code .sh `
23+ before committing changes, run ` ./scripts/format_cmake.sh ` and ` ./scripts/format_source .sh`
2424
2525## Building
2626
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # This script searches all source code files and formats them according to the .cmake-format style.
4+
5+ cmakeFormat=" cmake-format"
6+
7+ if [ -z " $cmakeFormat " ]
8+ then
9+ echo " $cmakeFormat is not installed. Cannot format cmake files..."
10+ echo " run: pip3 install cmake-format"
11+ exit 1
12+ fi
13+
14+ SCRIPTPATH=" $( cd " $( dirname " $0 " ) " > /dev/null 2>&1 ; pwd -P ) "
15+ PROJECT_PATH=$SCRIPTPATH /../
16+ PROJECT_PATH=" $( cd " $PROJECT_PATH " > /dev/null 2>&1 ; pwd -P ) "
17+
18+ echo " $cmakeFormat was found, going to format your cmake scripts..." >&2
19+ echo " formatting from root folder: $PROJECT_PATH " >&2
20+
21+ find " $PROJECT_PATH " \
22+ -not \( -path " */build/*" -prune \) \
23+ -not \( -path " */scripts/*" -prune \) \
24+ -not \( -path " */.vscode/*" -prune \) \
25+ -not \( -path ' */cmake/LCov.cmake' -prune \) \
26+ -not \( -path ' */cmake/Coveralls.cmake' -prune \) \
27+ -not \( -path ' */cmake/CoverallsGenerateGcov.cmake' -prune \) \
28+ -not \( -path ' */cmake/CoverallsClear.cmake' -prune \) \
29+ -not \( -path ' */cmake/FindMbedTLS.cmake' -prune \) \
30+ \( -name * .cmake -o -name CMakeLists.txt ! -iname " *Find*" \) \
31+ | xargs $cmakeFormat -c cmake-format.yaml -i
32+
33+
34+ echo " done formatting with cmake-format"
Original file line number Diff line number Diff line change 1+ # This script searches all source code files and formats them according to the .clang-format style.
2+
3+ base=clang-format
4+ format=" "
5+
6+ # Redirect output to stderr.
7+ exec 1>&2
8+
9+ # check if clang-format is installed
10+ type " $base " > /dev/null 2>&1 && format=" $base "
11+
12+ path_to_clang_format=" $( which $format ) "
13+ echo " $path_to_clang_format "
14+
15+ # no versions of clang-format are installed
16+ if [ -z " $format " ]
17+ then
18+ echo " $base is not installed. Cannot format code..."
19+ echo " run: pip3 install clang-format"
20+ exit 1
21+ fi
22+
23+ echo " $format was found, going to format your code..." >&2
24+
25+ SCRIPTPATH=" $( cd " $( dirname " $0 " ) " > /dev/null 2>&1 ; pwd -P ) "
26+ PROJECT_PATH=$SCRIPTPATH /../
27+ PROJECT_PATH=" $( cd " $PROJECT_PATH " > /dev/null 2>&1 ; pwd -P ) "
28+
29+ echo " Project path: $PROJECT_PATH "
30+
31+ find " $PROJECT_PATH " \
32+ -not \( -path " */build/*" -prune \) \
33+ -not \( -path " */_build/*" -prune \) \
34+ -not \( -path " */cmake/*" -prune \) \
35+ -not \( -path " */.vscode/*" -prune \) \
36+ -not \( -path " */.idea/*" -prune \) \
37+ -not \( -path " */third_party/*" -prune \) \
38+ -not \( -path " *Coverity_Model.c*" -prune \) \
39+ -not \( -path " */docs/*" -prune \) \
40+ \( -name " *.h" -o -name " *.hpp" -o -name " *.c" -o -name " *.cpp" \) \
41+ | xargs $format -i
42+
43+
44+ echo " done formatting with clang"
You can’t perform that action at this time.
0 commit comments