1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge branch 'clang_format_fixes' into 'master'

Clang format fixes

See merge request OpenMW/openmw!2433
This commit is contained in:
psi29a 2022-09-25 18:42:11 +00:00
commit 0d225e14e3
5 changed files with 22 additions and 37 deletions

View File

@ -2,13 +2,13 @@
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
@ -83,7 +83,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortIncludes: CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true

View File

@ -15,3 +15,5 @@
# Date: 9/22/2022 9:26:05 PM
# Apply clang-format to code base
ddb0522bbf2aa8aa7c9e139ff7395fb8ed6a841f
88ec8a95231341e7962b85716510d414e9f0c424

View File

@ -1,33 +1,10 @@
#!/bin/bash
#!/bin/bash -ex
set -o pipefail
CLANG_FORMAT="${CLANG_FORMAT:-clang-format}"
HAS_DIFFS=0
check_format_file() {
local item=$1
"$CLANG_FORMAT" --dry-run -Werror "$item" &>/dev/null
if [[ $? = 1 ]]; then
"${CLANG_FORMAT}" "${item}" | git diff --color=always --no-index "${item}" -
HAS_DIFFS=1
fi
}
check_format() {
local path=$1
find "$path" -type f -name "*" | while read item;
do
if [[ "$item" =~ .*\.(cpp|hpp|h) ]]; then
check_format_file "$item"
fi;
done;
}
check_format "./apps"
check_format "./components"
if [[ $HAS_DIFFS -eq 1 ]]; then
echo "clang-format differences detected"
exit 1
fi;
exit 0
git ls-files |
grep -v '^extern/' |
grep -P '\.(cpp|hpp|h)$' |
xargs -I '{}' -P $(nproc) bash -ec "\"${CLANG_FORMAT:?}\" --dry-run -Werror \"\${0:?}\" &> /dev/null || \"${CLANG_FORMAT:?}\" \"\${0:?}\" | git diff --color=always --no-index \"\${0:?}\" -" '{}' ||
( echo "clang-format differences detected"; exit -1 )

View File

@ -56,7 +56,10 @@ namespace CSMWorld
/// Works like getAppendIndex unless an overloaded method uses the record pointer
/// to get additional info about the record that results in an alternative index.
int getAppendIndex (const std::string& id, UniversalId::Type type) const override { return getInsertIndex(id, type); }
int getAppendIndex(const std::string& id, UniversalId::Type type) const override
{
return getInsertIndex(id, type);
}
bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override;
///< Reorder the rows [baseIndex, baseIndex+newOrder.size()) according to the indices

View File

@ -165,7 +165,10 @@ namespace Debug
CurrentDebugLevel = Verbose;
}
virtual std::streamsize writeImpl(const char* str, std::streamsize size, Level debugLevel) { return size; }
virtual std::streamsize writeImpl(const char* str, std::streamsize size, Level debugLevel)
{
return size;
}
};
#if defined _WIN32 && defined _DEBUG