mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
.clang-format and code format script
This commit is contained in:
12
.clang-format
Normal file
12
.clang-format
Normal file
@@ -0,0 +1,12 @@
|
||||
BasedOnStyle: google
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
ColumnLimit: 120
|
||||
UseTab: Never
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
BreakBeforeBraces: Allman
|
||||
AccessModifierOffset: -4
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Left
|
||||
18
code_format.sh
Executable file
18
code_format.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
CLANG_FORMAT_PATH=$(which clang-format)
|
||||
|
||||
if [ -z "$CLANG_FORMAT_PATH" ]; then
|
||||
echo "clang-format not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROJECT_ROOT=$(dirname "$0")
|
||||
|
||||
cpp_files=$(find $PROJECT_ROOT -name '*.cpp' -or -name '*.h' )
|
||||
|
||||
for file in $cpp_files; do
|
||||
echo "Formatting $file"
|
||||
$CLANG_FORMAT_PATH -i $file
|
||||
done
|
||||
|
||||
echo "All .cpp or .h files have been formatted."
|
||||
Reference in New Issue
Block a user