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: Ia9a79a850d4ae8d576f052bb552a83429b792ddb
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 79a474d..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
@@ -75,9 +78,13 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
+InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -85,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
@@ -111,6 +124,6 @@
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
-UseCRLF: false
UseTab: Never
...
+
diff --git a/dbusUtils.hpp b/dbusUtils.hpp
index ae95d15..984ac5f 100644
--- a/dbusUtils.hpp
+++ b/dbusUtils.hpp
@@ -68,8 +68,8 @@
{
Value value;
- auto method =
- bus.new_method_call(service.c_str(), path.c_str(), propIntf, methodGet);
+ auto method = bus.new_method_call(service.c_str(), path.c_str(), propIntf,
+ methodGet);
method.append(intf, property);
diff --git a/virtualSensor.cpp b/virtualSensor.cpp
index e8fc218..a61527e 100644
--- a/virtualSensor.cpp
+++ b/virtualSensor.cpp
@@ -172,8 +172,8 @@
}
else
{
- auto sev =
- getNumberFromConfig<uint64_t>(propertyMap, "Severity", true);
+ auto sev = getNumberFromConfig<uint64_t>(propertyMap, "Severity",
+ true);
/* Checking bounds ourselves so we throw invalid argument on
* invalid user input */
if (sev >= thresholdTypes.size())
@@ -204,8 +204,8 @@
auto threshold = getThresholdType(direction, severity);
thresholds[threshold] = value;
- auto hysteresis =
- getNumberFromConfig<double>(propertyMap, "Hysteresis", false);
+ auto hysteresis = getNumberFromConfig<double>(propertyMap, "Hysteresis",
+ false);
if (hysteresis != std::numeric_limits<double>::quiet_NaN())
{
thresholds[threshold + "Hysteresis"] = hysteresis;
@@ -230,8 +230,8 @@
std::replace(sensor.begin(), sensor.end(), ' ', '_');
auto sensorObjPath = sensorDbusPath + sensorType + "/" + sensor;
- auto paramPtr =
- std::make_unique<SensorParam>(bus, sensorObjPath, this);
+ auto paramPtr = std::make_unique<SensorParam>(bus, sensorObjPath,
+ this);
symbols.create_variable(sensor);
paramMap.emplace(std::move(sensor), std::move(paramPtr));
}
@@ -353,8 +353,8 @@
{
auto path = sensorDbusPath + sensorType + "/" + name;
- auto paramPtr =
- std::make_unique<SensorParam>(bus, path, this);
+ auto paramPtr = std::make_unique<SensorParam>(bus, path,
+ this);
std::string paramName = j["ParamName"];
symbols.create_variable(paramName);
paramMap.emplace(std::move(paramName), std::move(paramPtr));
@@ -400,8 +400,8 @@
std::filesystem::path p(entityPath);
auto assocsDbus =
AssociationList{{"chassis", "all_sensors", p.parent_path().string()}};
- associationIface =
- std::make_unique<AssociationObject>(bus, objPath.c_str());
+ associationIface = std::make_unique<AssociationObject>(bus,
+ objPath.c_str());
associationIface->associations(assocsDbus);
}
@@ -411,8 +411,8 @@
const std::string& calculationIface)
{
Json thresholds;
- const std::string vsThresholdsIntf =
- calculationIface + vsThresholdsIfaceSuffix;
+ const std::string vsThresholdsIntf = calculationIface +
+ vsThresholdsIfaceSuffix;
for (const auto& [interface, propertyMap] : interfaceMap)
{
@@ -492,8 +492,8 @@
throw std::invalid_argument("ParamName not found in symbols");
}
}
- auto itr =
- std::find(calculationIfaces.begin(), calculationIfaces.end(), exprStr);
+ auto itr = std::find(calculationIfaces.begin(), calculationIfaces.end(),
+ exprStr);
auto val = (itr == calculationIfaces.end())
? expression.value()
: calculateValue(exprStr, paramMap);
@@ -936,8 +936,8 @@
virtualSensorsMap.emplace(name, std::move(virtualSensorPtr));
/* Setup match for interfaces removed */
- auto intfRemoved = [this, objpath,
- name](sdbusplus::message_t& message) {
+ auto intfRemoved =
+ [this, objpath, name](sdbusplus::message_t& message) {
if (!virtualSensorsMap.contains(name))
{
return;
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index 921aee2..8f17395 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -57,8 +57,7 @@
*
* @param[in] value - Value of constant parameter
*/
- explicit SensorParam(double value) : value(value), paramType(constParam)
- {}
+ explicit SensorParam(double value) : value(value), paramType(constParam) {}
/** @brief Constructs SensorParam (type = dbusParam)
*