clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: Icdb911b82f317b75b8f147d9e8e0599131c7e601
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index cab3139..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
@@ -36,6 +38,7 @@
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
@@ -49,6 +52,7 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -74,9 +78,13 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -84,13 +92,19 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
diff --git a/healthMonitor.cpp b/healthMonitor.cpp
index f8b2c54..6892cad 100644
--- a/healthMonitor.cpp
+++ b/healthMonitor.cpp
@@ -591,7 +591,6 @@
void HealthMon::getConfigData(Json& data, HealthConfig& cfg)
{
-
static const Json empty{};
/* Default frerquency of sensor polling is 1 second */
@@ -606,8 +605,8 @@
auto criticalData = threshold.value("Critical", empty);
if (!criticalData.empty())
{
- cfg.criticalHigh =
- criticalData.value("Value", defaultHighThreshold);
+ cfg.criticalHigh = criticalData.value("Value",
+ defaultHighThreshold);
cfg.criticalLog = criticalData.value("Log", true);
cfg.criticalTgt = criticalData.value("Target", "");
}
@@ -624,7 +623,6 @@
std::vector<HealthConfig> HealthMon::getHealthConfig()
{
-
std::vector<HealthConfig> cfgs;
auto data = parseConfigFile(HEALTH_CONFIG_FILE);
@@ -638,8 +636,8 @@
auto key = j.key();
/* key need match default value in map readSensors or match the key
* start with "Storage" or "Inode" */
- bool isStorageOrInode =
- (key.rfind(storage, 0) == 0 || key.rfind(inode, 0) == 0);
+ bool isStorageOrInode = (key.rfind(storage, 0) == 0 ||
+ key.rfind(inode, 0) == 0);
if (readSensors.find(key) != readSensors.end() || isStorageOrInode)
{
HealthConfig cfg = HealthConfig();
@@ -719,7 +717,6 @@
}
else
{
-
// If this daemon maintains its own DBus object, we must make sure
// the object is registered to ObjectMapper
if (phosphor::health::findPathsWithType(bus, BMC_INVENTORY_ITEM)
@@ -767,58 +764,57 @@
sensorRecreateTimer = std::make_shared<boost::asio::deadline_timer>(io);
// If the SystemInventory does not exist: wait for the InterfaceAdded signal
- auto interfacesAddedSignalHandler = std::make_unique<
- sdbusplus::bus::match_t>(
- static_cast<sdbusplus::bus_t&>(*conn),
- sdbusplus::bus::match::rules::interfacesAdded(),
- [conn](sdbusplus::message_t& msg) {
- using Association =
- std::tuple<std::string, std::string, std::string>;
- using InterfacesAdded = std::vector<std::pair<
- std::string,
- std::vector<std::pair<
- std::string, std::variant<std::vector<Association>>>>>>;
+ auto interfacesAddedSignalHandler =
+ std::make_unique<sdbusplus::bus::match_t>(
+ static_cast<sdbusplus::bus_t&>(*conn),
+ sdbusplus::bus::match::rules::interfacesAdded(),
+ [conn](sdbusplus::message_t& msg) {
+ using Association = std::tuple<std::string, std::string, std::string>;
+ using InterfacesAdded = std::vector<std::pair<
+ std::string,
+ std::vector<std::pair<std::string,
+ std::variant<std::vector<Association>>>>>>;
- sdbusplus::message::object_path o;
- InterfacesAdded interfacesAdded;
+ sdbusplus::message::object_path o;
+ InterfacesAdded interfacesAdded;
- try
- {
- msg.read(o);
- msg.read(interfacesAdded);
- }
- catch (const std::exception& e)
- {
- error(
- "Exception occurred while processing interfacesAdded: {EXCEPTION}",
- "EXCEPTION", e.what());
- return;
- }
+ try
+ {
+ msg.read(o);
+ msg.read(interfacesAdded);
+ }
+ catch (const std::exception& e)
+ {
+ error(
+ "Exception occurred while processing interfacesAdded: {EXCEPTION}",
+ "EXCEPTION", e.what());
+ return;
+ }
- // Ignore any signal coming from health-monitor itself.
- if (msg.get_sender() == conn->get_unique_name())
- {
- return;
- }
+ // Ignore any signal coming from health-monitor itself.
+ if (msg.get_sender() == conn->get_unique_name())
+ {
+ return;
+ }
- // Check if the BMC Inventory is in the interfaces created.
- bool hasBmcConfiguration = false;
- for (const auto& x : interfacesAdded)
+ // Check if the BMC Inventory is in the interfaces created.
+ bool hasBmcConfiguration = false;
+ for (const auto& x : interfacesAdded)
+ {
+ if (x.first == BMC_CONFIGURATION)
{
- if (x.first == BMC_CONFIGURATION)
- {
- hasBmcConfiguration = true;
- }
+ hasBmcConfiguration = true;
}
+ }
- if (hasBmcConfiguration)
- {
- info(
- "BMC configuration detected, will create a corresponding Inventory item");
- healthMon->createBmcInventoryIfNotCreated();
- needUpdate = true;
- }
- });
+ if (hasBmcConfiguration)
+ {
+ info(
+ "BMC configuration detected, will create a corresponding Inventory item");
+ healthMon->createBmcInventoryIfNotCreated();
+ needUpdate = true;
+ }
+ });
// Start the timer
boost::asio::post(io, [conn]() {