clang-format: Update to match docs repo
Update the .clang-format file.
Now includes header sorting and updating PointerAlignment.
Change-Id: I7119c12f1cc0a461cb7e4576dff6a02dcc95cbc4
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/.clang-format b/.clang-format
index bbc1bb1..9f628dc 100644
--- a/.clang-format
+++ b/.clang-format
@@ -42,12 +42,25 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
-PointerAlignment: Left
+DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 5
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.hpp"'
+ Priority: 1
+ - Regex: '^<.*\.h>'
+ Priority: 2
+ - Regex: '^<.*'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 4
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -65,9 +78,9 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
+PointerAlignment: Left
ReflowComments: true
-SortIncludes: false
+SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
@@ -82,4 +95,3 @@
TabWidth: 4
UseTab: Never
...
-
diff --git a/activation.cpp b/activation.cpp
old mode 100755
new mode 100644
index e8f0db9..4a54fbb
--- a/activation.cpp
+++ b/activation.cpp
@@ -1,17 +1,21 @@
-#include <experimental/filesystem>
-#include "activation.hpp"
#include "config.h"
+
+#include "activation.hpp"
+
#include "item_updater.hpp"
#include "serialize.hpp"
+
+#include <experimental/filesystem>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
#ifdef WANT_SIGNATURE_VERIFY
-#include <sdbusplus/server.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/elog-errors.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
#include "image_verify.hpp"
+
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <sdbusplus/server.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
#endif
namespace openpower
diff --git a/activation.hpp b/activation.hpp
old mode 100755
new mode 100644
index 98646e5..2fc08d7
--- a/activation.hpp
+++ b/activation.hpp
@@ -1,13 +1,15 @@
#pragma once
+#include "config.h"
+
+#include "org/openbmc/Associations/server.hpp"
+#include "xyz/openbmc_project/Software/ActivationProgress/server.hpp"
+#include "xyz/openbmc_project/Software/ExtendedVersion/server.hpp"
+#include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp"
+
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Software/Activation/server.hpp>
#include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp>
-#include "xyz/openbmc_project/Software/ExtendedVersion/server.hpp"
-#include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp"
-#include "xyz/openbmc_project/Software/ActivationProgress/server.hpp"
-#include "org/openbmc/Associations/server.hpp"
-#include "config.h"
namespace openpower
{
diff --git a/image_verify.cpp b/image_verify.cpp
index 475fbda..4ad22d1 100644
--- a/image_verify.cpp
+++ b/image_verify.cpp
@@ -1,16 +1,18 @@
-#include <set>
-#include <fstream>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <openssl/err.h>
+#include "config.h"
#include "image_verify.hpp"
-#include "config.h"
+
#include "version.hpp"
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
+#include <fcntl.h>
+#include <openssl/err.h>
+#include <sys/stat.h>
+
+#include <fstream>
#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <set>
#include <xyz/openbmc_project/Common/error.hpp>
namespace openpower
diff --git a/image_verify.hpp b/image_verify.hpp
index ac601a2..768182e 100644
--- a/image_verify.hpp
+++ b/image_verify.hpp
@@ -1,12 +1,14 @@
#pragma once
#include "utils.hpp"
-#include <openssl/rsa.h>
+
#include <openssl/evp.h>
#include <openssl/pem.h>
+#include <openssl/rsa.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
#include <experimental/filesystem>
#include <set>
-#include <unistd.h>
-#include <sys/mman.h>
namespace openpower
{
diff --git a/item_updater.cpp b/item_updater.cpp
index 8ae8549..91421b8 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -1,16 +1,19 @@
-#include <string>
-#include <experimental/filesystem>
-#include <fstream>
-#include <queue>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
-#include "xyz/openbmc_project/Common/error.hpp"
-#include <xyz/openbmc_project/Software/Version/server.hpp>
-#include "version.hpp"
#include "config.h"
+
#include "item_updater.hpp"
+
#include "activation.hpp"
#include "serialize.hpp"
+#include "version.hpp"
+#include "xyz/openbmc_project/Common/error.hpp"
+
+#include <experimental/filesystem>
+#include <fstream>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
+#include <queue>
+#include <string>
+#include <xyz/openbmc_project/Software/Version/server.hpp>
namespace openpower
{
diff --git a/item_updater.hpp b/item_updater.hpp
old mode 100755
new mode 100644
index 90441c4..41e229f
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -1,12 +1,13 @@
#pragma once
-#include <sdbusplus/server.hpp>
#include "activation.hpp"
+#include "org/openbmc/Associations/server.hpp"
+#include "version.hpp"
+#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
+
+#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Common/FactoryReset/server.hpp>
#include <xyz/openbmc_project/Object/Enable/server.hpp>
-#include "version.hpp"
-#include "org/openbmc/Associations/server.hpp"
-#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
namespace openpower
{
diff --git a/item_updater_main.cpp b/item_updater_main.cpp
old mode 100755
new mode 100644
index db7cae4..d773142
--- a/item_updater_main.cpp
+++ b/item_updater_main.cpp
@@ -1,10 +1,12 @@
+#include "config.h"
+
+#include "item_updater.hpp"
+#include "watch.hpp"
+
+#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
#include <system_error>
-#include "config.h"
-#include "item_updater.hpp"
-#include <phosphor-logging/log.hpp>
-#include "watch.hpp"
int main(int argc, char* argv[])
{
diff --git a/serialize.cpp b/serialize.cpp
index d96bf0b..7250a00 100644
--- a/serialize.cpp
+++ b/serialize.cpp
@@ -1,8 +1,10 @@
#include "config.h"
-#include <experimental/filesystem>
-#include <cereal/archives/json.hpp>
-#include <fstream>
+
#include "serialize.hpp"
+
+#include <cereal/archives/json.hpp>
+#include <experimental/filesystem>
+#include <fstream>
#include <sdbusplus/server.hpp>
namespace openpower
diff --git a/serialize.hpp b/serialize.hpp
index 5198847..e8860f3 100644
--- a/serialize.hpp
+++ b/serialize.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <string>
+
namespace openpower
{
namespace software
diff --git a/test/utest.cpp b/test/utest.cpp
index 38f9912..0163bf0 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -1,9 +1,12 @@
-#include <gtest/gtest.h>
-#include <openssl/sha.h>
-#include <string>
-#include <experimental/filesystem>
-#include "version.hpp"
#include "image_verify.hpp"
+#include "version.hpp"
+
+#include <openssl/sha.h>
+
+#include <experimental/filesystem>
+#include <string>
+
+#include <gtest/gtest.h>
using namespace openpower::software::updater;
using namespace openpower::software::image;
diff --git a/version.cpp b/version.cpp
index 150d031..aa9ee02 100644
--- a/version.cpp
+++ b/version.cpp
@@ -1,15 +1,18 @@
-#include <iostream>
-#include <string>
-#include <sstream>
-#include <fstream>
-#include <stdexcept>
-#include <phosphor-logging/log.hpp>
#include "version.hpp"
-#include <phosphor-logging/elog-errors.hpp>
-#include "xyz/openbmc_project/Common/error.hpp"
+
#include "item_updater.hpp"
+#include "xyz/openbmc_project/Common/error.hpp"
+
#include <openssl/sha.h>
+#include <fstream>
+#include <iostream>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sstream>
+#include <stdexcept>
+#include <string>
+
namespace openpower
{
namespace software
diff --git a/version.hpp b/version.hpp
index 8a07ae0..2b5a55a 100644
--- a/version.hpp
+++ b/version.hpp
@@ -1,10 +1,12 @@
#pragma once
-#include <sdbusplus/bus.hpp>
-#include "xyz/openbmc_project/Software/Version/server.hpp"
+#include "config.h"
+
#include "xyz/openbmc_project/Common/FilePath/server.hpp"
#include "xyz/openbmc_project/Object/Delete/server.hpp"
-#include "config.h"
+#include "xyz/openbmc_project/Software/Version/server.hpp"
+
+#include <sdbusplus/bus.hpp>
namespace openpower
{
diff --git a/watch.cpp b/watch.cpp
index 9402057..35cbb15 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -1,15 +1,19 @@
-#include <stdexcept>
-#include <cstddef>
-#include <cstring>
-#include <functional>
-#include <string>
+#include "config.h"
+
+#include "watch.hpp"
+
+#include "item_updater.hpp"
+
#include <sys/inotify.h>
#include <unistd.h>
+
+#include <cstddef>
+#include <cstring>
#include <experimental/filesystem>
+#include <functional>
#include <phosphor-logging/log.hpp>
-#include "config.h"
-#include "watch.hpp"
-#include "item_updater.hpp"
+#include <stdexcept>
+#include <string>
namespace openpower
{
diff --git a/watch.hpp b/watch.hpp
index 0ce5d0e..f7ae6af 100644
--- a/watch.hpp
+++ b/watch.hpp
@@ -3,6 +3,9 @@
#include <systemd/sd-event.h>
#include <unistd.h>
+#include <functional>
+#include <memory>
+
namespace openpower
{
namespace software