clang-format updates
Run with clang-format-6.0 and update to latest .clang-format
as listed in the docs repository.
Change-Id: I40fb686cc66adf56b2c1b5277ac1c44b64b89349
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/.clang-format b/.clang-format
index bbc1bb1..ae9ad39 100644
--- a/.clang-format
+++ b/.clang-format
@@ -17,7 +17,7 @@
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@@ -42,12 +42,26 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
PointerAlignment: Left
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 +79,9 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
ReflowComments: true
-SortIncludes: false
+SortIncludes: true
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
@@ -82,4 +96,3 @@
TabWidth: 4
UseTab: Never
...
-
diff --git a/callout.cpp b/callout.cpp
index 7c0310e..eb26d64 100644
--- a/callout.cpp
+++ b/callout.cpp
@@ -12,16 +12,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "config.h"
+
+#include "callout.hpp"
+
+#include "dbus.hpp"
+
#include <cereal/archives/binary.hpp>
#include <cereal/types/string.hpp>
-#include <cereal/types/vector.hpp>
#include <cereal/types/tuple.hpp>
+#include <cereal/types/vector.hpp>
#include <experimental/filesystem>
#include <fstream>
#include <phosphor-logging/log.hpp>
-#include "callout.hpp"
-#include "config.h"
-#include "dbus.hpp"
CEREAL_CLASS_VERSION(ibm::logging::Callout, CALLOUT_CLASS_VERSION);
@@ -181,5 +184,5 @@
return true;
}
-}
-}
+} // namespace logging
+} // namespace ibm
diff --git a/callout.hpp b/callout.hpp
index b1e3b53..b860b9a 100644
--- a/callout.hpp
+++ b/callout.hpp
@@ -1,9 +1,10 @@
#pragma once
-#include <experimental/filesystem>
#include "dbus.hpp"
#include "interfaces.hpp"
+#include <experimental/filesystem>
+
namespace ibm
{
namespace logging
@@ -150,5 +151,5 @@
*/
uint64_t timestamp;
};
-}
-}
+} // namespace logging
+} // namespace ibm
diff --git a/dbus.cpp b/dbus.cpp
index 06b0078..70380d3 100644
--- a/dbus.cpp
+++ b/dbus.cpp
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <phosphor-logging/log.hpp>
#include "dbus.hpp"
+#include <phosphor-logging/log.hpp>
+
namespace ibm
{
namespace logging
@@ -129,5 +130,5 @@
return service;
}
-}
-}
+} // namespace logging
+} // namespace ibm
diff --git a/dbus.hpp b/dbus.hpp
index c572d99..50dcdfb 100644
--- a/dbus.hpp
+++ b/dbus.hpp
@@ -98,5 +98,5 @@
const std::string& service,
const std::string& objPath,
const std::string& interface);
-}
-}
+} // namespace logging
+} // namespace ibm
diff --git a/interfaces.hpp b/interfaces.hpp
index 6c7651f..3014398 100644
--- a/interfaces.hpp
+++ b/interfaces.hpp
@@ -27,5 +27,5 @@
CALLOUT,
POLICY
};
-}
-}
+} // namespace logging
+} // namespace ibm
diff --git a/main.cpp b/main.cpp
index 5a2870d..da4d05a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "config.h"
+
+#include "manager.hpp"
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
-#include "manager.hpp"
-#include "config.h"
int main()
{
diff --git a/manager.cpp b/manager.cpp
index 7c53a08..3d9850d 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -13,12 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <phosphor-logging/log.hpp>
-#include "callout.hpp"
#include "config.h"
+
#include "manager.hpp"
+
+#include "callout.hpp"
#include "policy_find.hpp"
+#include <phosphor-logging/log.hpp>
+
namespace ibm
{
namespace logging
@@ -355,5 +358,5 @@
erase(getEntryID(path));
}
}
-}
-}
+} // namespace logging
+} // namespace ibm
diff --git a/manager.hpp b/manager.hpp
index 39cf958..e340d90 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -1,12 +1,14 @@
#pragma once
+#include "config.h"
+
+#include "dbus.hpp"
+#include "interfaces.hpp"
+
#include <experimental/any>
#include <experimental/filesystem>
#include <map>
#include <sdbusplus/bus.hpp>
-#include "config.h"
-#include "dbus.hpp"
-#include "interfaces.hpp"
#ifdef USE_POLICY_INTERFACE
#include "policy_table.hpp"
#endif
@@ -285,5 +287,5 @@
policy::Table policies;
#endif
};
-}
-}
+} // namespace logging
+} // namespace ibm
diff --git a/policy_find.cpp b/policy_find.cpp
index 7833cfa..797f7b8 100644
--- a/policy_find.cpp
+++ b/policy_find.cpp
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "policy_find.hpp"
+
#include <phosphor-logging/log.hpp>
#include <sstream>
-#include "policy_find.hpp"
namespace ibm
{
@@ -189,6 +190,6 @@
return {policy.defaultEID(), policy.defaultMsg()};
}
-}
-}
-}
+} // namespace policy
+} // namespace logging
+} // namespace ibm
diff --git a/policy_find.hpp b/policy_find.hpp
index e8a4c50..5e45a5b 100644
--- a/policy_find.hpp
+++ b/policy_find.hpp
@@ -26,6 +26,6 @@
*/
PolicyProps find(const Table& policy,
const DbusPropertyMap& errorLogProperties);
-}
-}
-}
+} // namespace policy
+} // namespace logging
+} // namespace ibm
diff --git a/policy_table.cpp b/policy_table.cpp
index f051d41..d7fb93c 100644
--- a/policy_table.cpp
+++ b/policy_table.cpp
@@ -13,11 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "policy_table.hpp"
+
#include <experimental/filesystem>
#include <fstream>
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
-#include "policy_table.hpp"
namespace ibm
{
@@ -107,6 +108,6 @@
return {};
}
-}
-}
-}
+} // namespace policy
+} // namespace logging
+} // namespace ibm
diff --git a/policy_table.hpp b/policy_table.hpp
index 9272daa..fb12659 100644
--- a/policy_table.hpp
+++ b/policy_table.hpp
@@ -1,9 +1,10 @@
#pragma once
+#include "config.h"
+
#include <experimental/optional>
#include <map>
#include <vector>
-#include "config.h"
namespace ibm
{
@@ -130,6 +131,6 @@
*/
PolicyMap policies;
};
-}
-}
-}
+} // namespace policy
+} // namespace logging
+} // namespace ibm
diff --git a/test/test_callout.cpp b/test/test_callout.cpp
index 8d656cc..3ac2c3e 100644
--- a/test/test_callout.cpp
+++ b/test/test_callout.cpp
@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <fstream>
-#include <gtest/gtest.h>
-#include <experimental/filesystem>
#include "callout.hpp"
#include "dbus.hpp"
+#include <experimental/filesystem>
+#include <fstream>
+
+#include <gtest/gtest.h>
+
using namespace ibm::logging;
class CalloutTest : public ::testing::Test
diff --git a/test/test_policy.cpp b/test/test_policy.cpp
index a9cb0ec..4828c63 100644
--- a/test/test_policy.cpp
+++ b/test/test_policy.cpp
@@ -13,11 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <fstream>
-#include <gtest/gtest.h>
-#include <experimental/filesystem>
-#include "policy_table.hpp"
#include "policy_find.hpp"
+#include "policy_table.hpp"
+
+#include <experimental/filesystem>
+#include <fstream>
+
+#include <gtest/gtest.h>
using namespace ibm::logging;
namespace fs = std::experimental::filesystem;