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: I913685cddaf9a2256b3edcd3ced8e89a32386394
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 52ac0a1..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,12 +38,13 @@
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
@@ -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/phosphor-ldap-config/ldap_config.cpp b/phosphor-ldap-config/ldap_config.cpp
index d6cd6dd..35c3041 100644
--- a/phosphor-ldap-config/ldap_config.cpp
+++ b/phosphor-ldap-config/ldap_config.cpp
@@ -685,7 +685,6 @@
void Config::serialize()
{
-
if (!fs::exists(configPersistPath.c_str()))
{
std::ofstream os(configPersistPath.string(),
diff --git a/phosphor-ldap-config/ldap_config_mgr.hpp b/phosphor-ldap-config/ldap_config_mgr.hpp
index 4bd013a..17d133b 100644
--- a/phosphor-ldap-config/ldap_config_mgr.hpp
+++ b/phosphor-ldap-config/ldap_config_mgr.hpp
@@ -17,10 +17,10 @@
static constexpr auto defaultNslcdFile = "nslcd.conf.default";
static constexpr auto nsSwitchFile = "nsswitch.conf";
-static auto openLDAPDbusObjectPath =
- std::string(LDAP_CONFIG_ROOT) + "/openldap";
-static auto adDbusObjectPath =
- std::string(LDAP_CONFIG_ROOT) + "/active_directory";
+static auto openLDAPDbusObjectPath = std::string(LDAP_CONFIG_ROOT) +
+ "/openldap";
+static auto adDbusObjectPath = std::string(LDAP_CONFIG_ROOT) +
+ "/active_directory";
using CreateIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::User::Ldap::server::Create>;
diff --git a/test/ldap_config_test.cpp b/test/ldap_config_test.cpp
index febe687..7685543 100644
--- a/test/ldap_config_test.cpp
+++ b/test/ldap_config_test.cpp
@@ -30,8 +30,7 @@
class TestLDAPConfig : public testing::Test
{
public:
- TestLDAPConfig() : bus(sdbusplus::bus::new_default())
- {}
+ TestLDAPConfig() : bus(sdbusplus::bus::new_default()) {}
void SetUp() override
{
using namespace phosphor::ldap;
@@ -569,8 +568,8 @@
// Permission of the persistent file should be 640
// Others should not be allowed to read.
- auto permission =
- fs::perms::owner_read | fs::perms::owner_write | fs::perms::group_read;
+ auto permission = fs::perms::owner_read | fs::perms::owner_write |
+ fs::perms::group_read;
auto persistFilepath = std::string(dir.c_str());
persistFilepath += adDbusObjectPath;
persistFilepath += "/config";
diff --git a/test/mock_user_mgr.hpp b/test/mock_user_mgr.hpp
index aa5409b..3440299 100644
--- a/test/mock_user_mgr.hpp
+++ b/test/mock_user_mgr.hpp
@@ -12,8 +12,7 @@
class MockManager : public UserMgr
{
public:
- MockManager(sdbusplus::bus_t& bus, const char* path) : UserMgr(bus, path)
- {}
+ MockManager(sdbusplus::bus_t& bus, const char* path) : UserMgr(bus, path) {}
MOCK_METHOD0(getPrivilegeMapperObject, DbusUserObj());
MOCK_METHOD1(userLockedForFailedAttempt, bool(const std::string& userName));
diff --git a/test/user_mgr_test.cpp b/test/user_mgr_test.cpp
index 3a07fda..e757803 100644
--- a/test/user_mgr_test.cpp
+++ b/test/user_mgr_test.cpp
@@ -881,7 +881,6 @@
UserMgrInTest,
CheckAndThrowForDisallowedGroupCreationThrowsIfGroupNameHasDisallowedCharacters)
{
-
EXPECT_THROW(
checkAndThrowForDisallowedGroupCreation("openbmc_rfp_?owerService"),
sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
@@ -894,7 +893,6 @@
UserMgrInTest,
CheckAndThrowForDisallowedGroupCreationThrowsIfGroupNameHasDisallowedPrefix)
{
-
EXPECT_THROW(
checkAndThrowForDisallowedGroupCreation("google_rfp_"),
sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
diff --git a/user_mgr.cpp b/user_mgr.cpp
index a2b6a76..090e204 100644
--- a/user_mgr.cpp
+++ b/user_mgr.cpp
@@ -155,10 +155,10 @@
}
return std::accumulate(std::next(vec.begin()), vec.end(), vec[0],
[](std::string&& val, std::string_view element) {
- val += ',';
- val += element;
- return val;
- });
+ val += ',';
+ val += element;
+ return val;
+ });
}
bool removeStringFromCSV(std::string& csvStr, const std::string& delStr)
@@ -844,8 +844,8 @@
elog<InternalFailure>();
}
- const std::string failDateTime =
- splitWords[t2FailDateIdx] + ' ' + splitWords[t2FailTimeIdx];
+ const std::string failDateTime = splitWords[t2FailDateIdx] + ' ' +
+ splitWords[t2FailTimeIdx];
// NOTE: Cannot use std::get_time() here as the implementation of %y in
// libstdc++ does not match POSIX strptime() before gcc 12.1.0
@@ -906,8 +906,8 @@
buflen = 1024;
}
std::vector<char> buffer(buflen);
- auto status =
- getspnam_r(userName.c_str(), &spwd, buffer.data(), buflen, &spwdPtr);
+ auto status = getspnam_r(userName.c_str(), &spwd, buffer.data(), buflen,
+ &spwdPtr);
// On success, getspnam_r() returns zero, and sets *spwdPtr to spwd.
// If no matching password record was found, these functions return 0
// and store NULL in *spwdPtr
@@ -1054,8 +1054,8 @@
std::string basePath = "/xyz/openbmc_project/user/ldap/openldap";
std::string interface = "xyz.openbmc_project.User.Ldap.Config";
- auto ldapMgmtService =
- getServiceName(std::move(basePath), std::move(interface));
+ auto ldapMgmtService = getServiceName(std::move(basePath),
+ std::move(interface));
auto method = bus.new_method_call(
ldapMgmtService.c_str(), ldapMgrObjBasePath,
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");