clang-format rules modernized
The 'old' clang-format rules file included lines that the current CI
tools do not like. This change updates the rules file to match what's
current in use for other OBMC subprojects like entity-manager and
dbus-sensors.
Appropriate files have also been updated according to the new rules
file.
Change-Id: I48aa704aa99ed5da379574ba35233ee5842afd31
Signed-off-by: Chris Sides <Christopher.Sides@hpe.com>
diff --git a/.clang-format b/.clang-format
index bbc1bb1..d43e884 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,25 +5,30 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
-AlignOperands: true
-AlignTrailingComments: true
+AlignEscapedNewlines: Right
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
-AllowShortIfStatementsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
+BitFieldColonSpacing: None
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
+ AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
@@ -31,27 +36,59 @@
AfterUnion: true
BeforeCatch: true
BeforeElse: true
+ BeforeLambdaBody: false
+ BeforeWhile: false
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
+CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
-PointerAlignment: Left
+DerivePointerAlignment: false
DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
-ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 7
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.h"'
+ Priority: 1
+ - Regex: '^".*\.hpp"'
+ Priority: 2
+ - Regex: '^<.*\.h>'
+ Priority: 3
+ - Regex: '^<.*\.hpp>'
+ Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
+IndentExternBlock: NoIndent
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -59,26 +96,39 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
+PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
-SortIncludes: false
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
+SortIncludes: CaseSensitive
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
+SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/src/mainapp.cpp b/src/mainapp.cpp
index bde3f23..5f4dc86 100644
--- a/src/mainapp.cpp
+++ b/src/mainapp.cpp
@@ -15,6 +15,7 @@
*/
#include "u-boot-env-mgr.hpp"
+
#include <phosphor-logging/log.hpp>
int main()
diff --git a/src/u-boot-env-mgr.cpp b/src/u-boot-env-mgr.cpp
index 30c8656..882e26c 100644
--- a/src/u-boot-env-mgr.cpp
+++ b/src/u-boot-env-mgr.cpp
@@ -15,14 +15,16 @@
*/
#include "u-boot-env-mgr.hpp"
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog-errors.hpp>
+
#include <boost/process/child.hpp>
#include <boost/process/io.hpp>
-#include <vector>
-#include <unordered_map>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <unordered_map>
+#include <vector>
+
template <typename... ArgTypes>
static std::vector<std::string> executeCmd(const char* path,
ArgTypes&&... tArgs)
@@ -75,8 +77,8 @@
iface->register_method(
"Write", [this](const std::string& key, const std::string& value) {
- writeVariable(key, value);
- });
+ writeVariable(key, value);
+ });
iface->initialize(true);
}