format: add project-wide clang-format file

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ibfc8d8386e77178edb3ca36badc07d9ad13abd51
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..00e2e25
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,117 @@
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: Yes
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterCaseLabel:  true
+  AfterClass:      true
+  AfterControlStatement: true
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  true
+  AfterObjCDeclaration: true
+  AfterStruct:     true
+  AfterUnion:      true
+  AfterExternBlock: true
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+  SplitEmptyFunction:   false
+  SplitEmptyRecord:     false
+  SplitEmptyNamespace:  false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: false
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DeriveLineEnding: false
+DerivePointerAlignment: false
+PointerAlignment: Left
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+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
+IndentWidth:     4
+IndentWrappedFunctionNames: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+ReflowComments:  true
+SortIncludes:    true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Latest
+TabWidth:        4
+UseCRLF: false
+UseTab:          Never
+...
+
diff --git a/src/kunlun_oem.cpp b/src/kunlun_oem.cpp
index 83bdb19..22d1906 100644
--- a/src/kunlun_oem.cpp
+++ b/src/kunlun_oem.cpp
@@ -1,10 +1,12 @@
-#include <filesystem>
-#include <fstream>
+#include "config.h"
+
+#include "kunlun_oem.hpp"
+
 #include <ipmid/api.hpp>
 #include <phosphor-logging/log.hpp>
 
-#include "config.h"
-#include "kunlun_oem.hpp"
+#include <filesystem>
+#include <fstream>
 
 namespace ipmi
 {
@@ -14,11 +16,12 @@
 // save cpu infomation from bios to file
 // index[in]: cpu index
 // info[in]: data saving to file
-static int saveInfoToFile(uint8_t index, std::vector<char> &info)
+static int saveInfoToFile(uint8_t index, std::vector<char>& info)
 {
     char infoPath[PATH_MAX];
 
-    std::snprintf(infoPath, sizeof(infoPath), IPMI_BIOSDATA_DIR"/cpu%02x", index);
+    std::snprintf(infoPath, sizeof(infoPath), IPMI_BIOSDATA_DIR "/cpu%02x",
+                  index);
 
     if (!(std::filesystem::exists(IPMI_BIOSDATA_DIR)))
     {
@@ -36,11 +39,12 @@
 // load cpu infomation from file
 // index[in]: cpu index
 // info[out]: data loading from file
-static int loadInfoFromFile(uint8_t index, std::vector<char> &info)
+static int loadInfoFromFile(uint8_t index, std::vector<char>& info)
 {
     char infoPath[PATH_MAX];
 
-    std::snprintf(infoPath, sizeof(infoPath), IPMI_BIOSDATA_DIR"/cpu%02x", index);
+    std::snprintf(infoPath, sizeof(infoPath), IPMI_BIOSDATA_DIR "/cpu%02x",
+                  index);
 
     if (!(std::filesystem::exists(infoPath)))
     {
diff --git a/src/kunlun_oem.hpp b/src/kunlun_oem.hpp
index acd62db..de477b9 100644
--- a/src/kunlun_oem.hpp
+++ b/src/kunlun_oem.hpp
@@ -1,20 +1,21 @@
 #pragma once
 
-#include <cstdint>
 #include <ipmid/api.hpp>
 
+#include <cstdint>
+
 namespace ipmi
 {
 
 using NetFn = uint8_t;
-using Cmd   = uint8_t;
-using Cc    = uint8_t;
+using Cmd = uint8_t;
+using Cc = uint8_t;
 
 constexpr NetFn netfnKunlunOem = netFnOemSix;
 namespace cmd
 {
-    constexpr Cmd cmdSetCpuInfo   = 0x0;
-    constexpr Cmd cmdGetCpuInfo   = 0x1;
+constexpr Cmd cmdSetCpuInfo = 0x0;
+constexpr Cmd cmdGetCpuInfo = 0x1;
 } // namespace cmd
 
 RspType<> setCpuInfo(uint8_t index, std::vector<char> info);
diff --git a/test/test_kunlun_ipmi_oem.cpp b/test/test_kunlun_ipmi_oem.cpp
index 1b4526a..a140ddd 100644
--- a/test/test_kunlun_ipmi_oem.cpp
+++ b/test/test_kunlun_ipmi_oem.cpp
@@ -20,7 +20,8 @@
 namespace impl
 {
 
-bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, ::ipmi::HandlerBase::ptr handler)
+bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv,
+                     ::ipmi::HandlerBase::ptr handler)
 {
     (void)prio;
     (void)netFn;