clang-format: Update to match docs repo

Update the .clang-format file.
Now includes header sorting and updating PointerAlignment.

Change-Id: I5c7690d8d83cdebe26ff3a73b90a2a8c17dd8054
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
index 8fac93c..dc1993e 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -1,15 +1,18 @@
 #include "activation.hpp"
+
 #include "images.hpp"
 #include "item_updater.hpp"
 #include "serialize.hpp"
+
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/exception.hpp>
 
 #ifdef WANT_SIGNATURE_VERIFY
-#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 <xyz/openbmc_project/Common/error.hpp>
 #endif
 
 namespace phosphor
diff --git a/activation.hpp b/activation.hpp
index 654d21f..27dfdd4 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -1,14 +1,15 @@
 #pragma once
 
+#include "config.h"
+
+#include "flash.hpp"
+#include "org/openbmc/Associations/server.hpp"
+#include "xyz/openbmc_project/Software/ActivationProgress/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 "flash.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"
 
 #ifdef WANT_SIGNATURE_VERIFY
 #include <experimental/filesystem>
diff --git a/download_manager.cpp b/download_manager.cpp
index 6bbe604..6357ee8 100644
--- a/download_manager.cpp
+++ b/download_manager.cpp
@@ -1,16 +1,20 @@
-#include <iostream>
-#include <string>
-#include <unistd.h>
-#include <sys/wait.h>
-#include <phosphor-logging/log.hpp>
-#include <experimental/filesystem>
-#include <algorithm>
 #include "config.h"
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/elog-errors.hpp>
-#include "xyz/openbmc_project/Common/error.hpp"
+
 #include "download_manager.hpp"
 
+#include "xyz/openbmc_project/Common/error.hpp"
+
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <experimental/filesystem>
+#include <iostream>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <string>
+
 namespace phosphor
 {
 namespace software
diff --git a/download_manager.hpp b/download_manager.hpp
index 30e0b73..edafaab 100644
--- a/download_manager.hpp
+++ b/download_manager.hpp
@@ -1,8 +1,9 @@
 #pragma once
 
-#include <sdbusplus/bus.hpp>
 #include "xyz/openbmc_project/Common/TFTP/server.hpp"
 
+#include <sdbusplus/bus.hpp>
+
 namespace phosphor
 {
 namespace software
diff --git a/download_manager_main.cpp b/download_manager_main.cpp
index 9ea37ad..cf4cb82 100644
--- a/download_manager_main.cpp
+++ b/download_manager_main.cpp
@@ -1,7 +1,9 @@
-#include <sdbusplus/bus.hpp>
 #include "config.h"
+
 #include "download_manager.hpp"
 
+#include <sdbusplus/bus.hpp>
+
 int main(int argc, char* argv[])
 {
     auto bus = sdbusplus::bus::new_default();
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 20f5f45..a175849 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -2,12 +2,12 @@
 // See elog-gen.py for more details
 #pragma once
 
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/exception.hpp>
 #include <string>
 #include <tuple>
 #include <type_traits>
-#include <sdbusplus/exception.hpp>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
 
 namespace sdbusplus
 {
diff --git a/image_manager.cpp b/image_manager.cpp
index c346fd4..8bae16c 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -1,20 +1,24 @@
-#include <string>
-#include <experimental/filesystem>
-#include <stdlib.h>
-#include <cstring>
-#include <stdio.h>
-#include <unistd.h>
-#include <algorithm>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <elog-errors.hpp>
-#include <xyz/openbmc_project/Software/Version/error.hpp>
 #include "config.h"
+
+#include "image_manager.hpp"
+
 #include "version.hpp"
 #include "watch.hpp"
-#include "image_manager.hpp"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <cstring>
+#include <elog-errors.hpp>
+#include <experimental/filesystem>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <string>
+#include <xyz/openbmc_project/Software/Version/error.hpp>
 
 namespace phosphor
 {
diff --git a/image_manager.hpp b/image_manager.hpp
index ccd82a0..8498c77 100644
--- a/image_manager.hpp
+++ b/image_manager.hpp
@@ -1,7 +1,8 @@
 #pragma once
-#include <sdbusplus/server.hpp>
 #include "version.hpp"
 
+#include <sdbusplus/server.hpp>
+
 namespace phosphor
 {
 namespace software
diff --git a/image_manager_main.cpp b/image_manager_main.cpp
index 419b467..af711a7 100644
--- a/image_manager_main.cpp
+++ b/image_manager_main.cpp
@@ -1,10 +1,12 @@
+#include "config.h"
+
+#include "image_manager.hpp"
+#include "watch.hpp"
+
 #include <cstdlib>
 #include <exception>
-#include <sdbusplus/bus.hpp>
 #include <phosphor-logging/log.hpp>
-#include "config.h"
-#include "watch.hpp"
-#include "image_manager.hpp"
+#include <sdbusplus/bus.hpp>
 
 int main(int argc, char* argv[])
 {
diff --git a/image_verify.cpp b/image_verify.cpp
index fa60173..7f0bca7 100644
--- a/image_verify.cpp
+++ b/image_verify.cpp
@@ -1,17 +1,19 @@
-#include <set>
-#include <fstream>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <openssl/err.h>
+#include "config.h"
+
+#include "image_verify.hpp"
 
 #include "images.hpp"
-#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 phosphor
diff --git a/image_verify.hpp b/image_verify.hpp
index 99b3567..3a7f911 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 phosphor
 {
diff --git a/images.hpp b/images.hpp
index eee7c34..97b8f7f 100644
--- a/images.hpp
+++ b/images.hpp
@@ -1,8 +1,8 @@
+#include "config.h"
+
 #include <string>
 #include <vector>
 
-#include "config.h"
-
 namespace phosphor
 {
 namespace software
diff --git a/item_updater.cpp b/item_updater.cpp
index 6d90579..0fd2345 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -1,18 +1,21 @@
+#include "config.h"
+
+#include "item_updater.hpp"
+
+#include "images.hpp"
+#include "serialize.hpp"
+#include "version.hpp"
+#include "xyz/openbmc_project/Software/Version/server.hpp"
+
+#include <elog-errors.hpp>
+#include <experimental/filesystem>
 #include <fstream>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
 #include <queue>
 #include <set>
 #include <string>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <elog-errors.hpp>
 #include <xyz/openbmc_project/Software/Version/error.hpp>
-#include "config.h"
-#include "item_updater.hpp"
-#include "xyz/openbmc_project/Software/Version/server.hpp"
-#include <experimental/filesystem>
-#include "version.hpp"
-#include "serialize.hpp"
-#include "images.hpp"
 
 namespace phosphor
 {
diff --git a/item_updater.hpp b/item_updater.hpp
index ec7aee0..12583f5 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -1,13 +1,14 @@
 #pragma once
 
-#include <sdbusplus/server.hpp>
 #include "activation.hpp"
 #include "item_updater_helper.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/Control/FieldMode/server.hpp>
-#include "org/openbmc/Associations/server.hpp"
-#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
 
 namespace phosphor
 {
diff --git a/item_updater_helper.hpp b/item_updater_helper.hpp
index a2d90b8..0b67642 100644
--- a/item_updater_helper.hpp
+++ b/item_updater_helper.hpp
@@ -1,7 +1,7 @@
 #pragma once
 
-#include <string>
 #include <sdbusplus/bus.hpp>
+#include <string>
 
 namespace phosphor
 {
diff --git a/item_updater_main.cpp b/item_updater_main.cpp
index 42343bb..3568124 100644
--- a/item_updater_main.cpp
+++ b/item_updater_main.cpp
@@ -1,7 +1,9 @@
+#include "config.h"
+
+#include "item_updater.hpp"
+
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/manager.hpp>
-#include "config.h"
-#include "item_updater.hpp"
 
 int main(int argc, char* argv[])
 {
diff --git a/serialize.cpp b/serialize.cpp
index f52ec16..2acc373 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 phosphor
diff --git a/serialize.hpp b/serialize.hpp
index 5ebebc6..adaf018 100644
--- a/serialize.hpp
+++ b/serialize.hpp
@@ -1,8 +1,9 @@
 #pragma once
 
-#include <experimental/filesystem>
 #include "config.h"
 
+#include <experimental/filesystem>
+
 namespace phosphor
 {
 namespace software
diff --git a/static/flash.cpp b/static/flash.cpp
index d06d08c..82c2393 100644
--- a/static/flash.cpp
+++ b/static/flash.cpp
@@ -1,10 +1,12 @@
-#include <experimental/filesystem>
+#include "config.h"
+
+#include "flash.hpp"
 
 #include "activation.hpp"
-#include "config.h"
-#include "flash.hpp"
 #include "images.hpp"
 
+#include <experimental/filesystem>
+
 namespace
 {
 constexpr auto PATH_INITRAMFS = "/run/initramfs";
diff --git a/static/item_updater_helper.cpp b/static/item_updater_helper.cpp
index 572cb9c..e087d71 100644
--- a/static/item_updater_helper.cpp
+++ b/static/item_updater_helper.cpp
@@ -1,4 +1,5 @@
 #include "config.h"
+
 #include "item_updater_helper.hpp"
 
 namespace phosphor
diff --git a/sync_manager.cpp b/sync_manager.cpp
index debead2..48d773b 100644
--- a/sync_manager.cpp
+++ b/sync_manager.cpp
@@ -1,10 +1,13 @@
-#include <experimental/filesystem>
-#include <phosphor-logging/log.hpp>
+#include "config.h"
+
+#include "sync_manager.hpp"
+
 #include <sys/inotify.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include "config.h"
-#include "sync_manager.hpp"
+
+#include <experimental/filesystem>
+#include <phosphor-logging/log.hpp>
 
 namespace phosphor
 {
diff --git a/sync_manager_main.cpp b/sync_manager_main.cpp
index b801ba7..1be7f7d 100644
--- a/sync_manager_main.cpp
+++ b/sync_manager_main.cpp
@@ -1,11 +1,14 @@
+#include "config.h"
+
+#include "sync_manager.hpp"
+#include "sync_watch.hpp"
+
+#include <systemd/sd-event.h>
+
 #include <exception>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/manager.hpp>
-#include <systemd/sd-event.h>
-#include "config.h"
-#include "sync_manager.hpp"
-#include "sync_watch.hpp"
 
 int main(int argc, char* argv[])
 {
diff --git a/sync_watch.cpp b/sync_watch.cpp
index a8b4eeb..c017716 100644
--- a/sync_watch.cpp
+++ b/sync_watch.cpp
@@ -1,10 +1,13 @@
+#include "config.h"
+
+#include "sync_watch.hpp"
+
+#include <sys/inotify.h>
+#include <unistd.h>
+
 #include <experimental/filesystem>
 #include <fstream>
 #include <phosphor-logging/log.hpp>
-#include <sys/inotify.h>
-#include <unistd.h>
-#include "config.h"
-#include "sync_watch.hpp"
 
 namespace phosphor
 {
diff --git a/sync_watch.hpp b/sync_watch.hpp
index 4303671..30ea5f7 100644
--- a/sync_watch.hpp
+++ b/sync_watch.hpp
@@ -1,8 +1,10 @@
 #pragma once
 
+#include <systemd/sd-event.h>
+
 #include <experimental/filesystem>
 #include <functional>
-#include <systemd/sd-event.h>
+#include <map>
 
 namespace phosphor
 {
diff --git a/test/utest.cpp b/test/utest.cpp
index 73d3a0f..2c3223d 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -1,13 +1,16 @@
+#include "image_verify.hpp"
 #include "version.hpp"
-#include <gtest/gtest.h>
-#include <experimental/filesystem>
+
+#include <openssl/sha.h>
 #include <stdlib.h>
+
+#include <experimental/filesystem>
 #include <fstream>
 #include <iostream>
 #include <sstream>
 #include <string>
-#include <openssl/sha.h>
-#include "image_verify.hpp"
+
+#include <gtest/gtest.h>
 
 using namespace phosphor::software::manager;
 using namespace phosphor::software::image;
diff --git a/ubi/flash.cpp b/ubi/flash.cpp
index 4d6d153..ffa9348 100644
--- a/ubi/flash.cpp
+++ b/ubi/flash.cpp
@@ -1,6 +1,7 @@
-#include "activation.hpp"
 #include "config.h"
 
+#include "activation.hpp"
+
 namespace phosphor
 {
 namespace software
diff --git a/ubi/item_updater_helper.cpp b/ubi/item_updater_helper.cpp
index b05291e..68162cb 100644
--- a/ubi/item_updater_helper.cpp
+++ b/ubi/item_updater_helper.cpp
@@ -1,8 +1,9 @@
-#include <phosphor-logging/log.hpp>
-
 #include "config.h"
+
 #include "item_updater_helper.hpp"
 
+#include <phosphor-logging/log.hpp>
+
 namespace phosphor
 {
 namespace software
diff --git a/version.cpp b/version.cpp
index 6702fbd..ca7e29c 100644
--- a/version.cpp
+++ b/version.cpp
@@ -1,15 +1,19 @@
-#include <iostream>
-#include <string>
-#include <sstream>
-#include <fstream>
-#include <stdexcept>
-#include <openssl/sha.h>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog-errors.hpp>
-#include "xyz/openbmc_project/Common/error.hpp"
 #include "config.h"
+
 #include "version.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 phosphor
 {
 namespace software
diff --git a/version.hpp b/version.hpp
index 75d9f8b..ef0eef3 100644
--- a/version.hpp
+++ b/version.hpp
@@ -1,10 +1,11 @@
 #pragma once
 
-#include <sdbusplus/bus.hpp>
-#include "xyz/openbmc_project/Software/Version/server.hpp"
 #include "xyz/openbmc_project/Common/FilePath/server.hpp"
 #include "xyz/openbmc_project/Object/Delete/server.hpp"
+#include "xyz/openbmc_project/Software/Version/server.hpp"
+
 #include <functional>
+#include <sdbusplus/bus.hpp>
 
 namespace phosphor
 {
diff --git a/watch.cpp b/watch.cpp
index 2ad8c4c..e46b8aa 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -1,14 +1,18 @@
-#include <stdexcept>
-#include <cstddef>
-#include <cstring>
-#include <string>
+#include "config.h"
+
+#include "watch.hpp"
+
+#include "image_manager.hpp"
+
 #include <sys/inotify.h>
 #include <unistd.h>
+
+#include <cstddef>
+#include <cstring>
 #include <experimental/filesystem>
 #include <phosphor-logging/log.hpp>
-#include "config.h"
-#include "watch.hpp"
-#include "image_manager.hpp"
+#include <stdexcept>
+#include <string>
 
 namespace phosphor
 {
diff --git a/watch.hpp b/watch.hpp
index 451f1d6..c63f765 100644
--- a/watch.hpp
+++ b/watch.hpp
@@ -1,8 +1,9 @@
 #pragma once
 
-#include <functional>
 #include <systemd/sd-event.h>
 
+#include <functional>
+
 namespace phosphor
 {
 namespace software