From 89492a157c9cf972b342421e24d41fd382510251 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Wed, 10 May 2023 07:51:34 -0500 Subject: 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: I75f89d2959b0f1338c20d72ad669fbdc1d720835 Signed-off-by: Patrick Williams --- .clang-format | 25 +++++++++---- http/app.hpp | 4 +-- http/http_client.hpp | 1 - http/http_connection.hpp | 4 +-- http/http_response.hpp | 3 +- http/http_server.hpp | 4 +-- http/logging.hpp | 6 ++-- http/routing.hpp | 33 +++++++---------- http/utility.hpp | 4 +-- http/websocket.hpp | 3 +- include/async_resp.hpp | 3 +- include/authentication.hpp | 4 +-- include/dbus_utility.hpp | 2 +- include/hostname_monitor.hpp | 6 ++-- include/human_sort.hpp | 1 - include/ibm/locks.hpp | 5 --- include/ibm/management_console_rest.hpp | 11 +++--- include/login_routes.hpp | 12 +++---- include/multipart_parser.hpp | 4 +-- include/openbmc_dbus_rest.hpp | 11 +++--- include/sessions.hpp | 3 +- include/ssl_key_handler.hpp | 9 +++-- redfish-core/include/event_service_manager.hpp | 21 ++++++----- redfish-core/include/gzfile.hpp | 4 +-- redfish-core/include/redfish_aggregator.hpp | 12 +++---- redfish-core/include/utils/json_utils.hpp | 3 +- redfish-core/include/utils/query_param.hpp | 6 ++-- redfish-core/include/utils/sw_utils.hpp | 1 - redfish-core/include/utils/time_utils.hpp | 4 +-- redfish-core/lib/account_service.hpp | 30 +++++++--------- redfish-core/lib/certificate_service.hpp | 34 +++++++++--------- redfish-core/lib/ethernet.hpp | 36 +++++++++---------- redfish-core/lib/event_service.hpp | 5 ++- redfish-core/lib/fabric_adapters.hpp | 1 - redfish-core/lib/health.hpp | 1 - redfish-core/lib/hypervisor_system.hpp | 4 +-- redfish-core/lib/log_services.hpp | 42 +++++++++++----------- redfish-core/lib/managers.hpp | 18 +++------- redfish-core/lib/memory.hpp | 30 +++++++--------- redfish-core/lib/message_registries.hpp | 4 +-- redfish-core/lib/metric_report_definition.hpp | 4 +-- redfish-core/lib/network_protocol.hpp | 1 - redfish-core/lib/pcie.hpp | 6 ++-- redfish-core/lib/pcie_slots.hpp | 1 - redfish-core/lib/power.hpp | 5 ++- redfish-core/lib/processor.hpp | 1 - redfish-core/lib/redfish_sessions.hpp | 3 -- redfish-core/lib/redfish_util.hpp | 4 +-- redfish-core/lib/redfish_v1.hpp | 8 ++--- redfish-core/lib/sensors.hpp | 21 ++++++----- redfish-core/lib/storage.hpp | 4 +-- redfish-core/lib/systems.hpp | 11 +++--- redfish-core/lib/task.hpp | 4 +-- redfish-core/lib/update_service.hpp | 7 ++-- redfish-core/lib/virtual_media.hpp | 2 -- src/boost_asio.cpp | 2 +- src/boost_asio_ssl.cpp | 2 +- src/boost_beast.cpp | 2 +- src/boost_url.cpp | 2 +- src/ssl_key_handler_test.cpp | 2 +- test/http/verb_test.cpp | 2 +- test/include/dbus_utility_test.cpp | 2 +- test/include/google/google_service_root_test.cpp | 2 +- test/include/human_sort_test.cpp | 2 +- test/redfish-core/include/privileges_test.cpp | 6 ++-- .../include/redfish_aggregator_test.cpp | 20 +++++------ test/redfish-core/include/utils/hex_utils_test.cpp | 2 +- .../include/utils/query_param_test.cpp | 2 +- test/redfish-core/lib/chassis_test.cpp | 3 +- 69 files changed, 245 insertions(+), 302 deletions(-) diff --git a/.clang-format b/.clang-format index be651e775e..d92a3f10a4 100644 --- a/.clang-format +++ b/.clang-format @@ -6,12 +6,14 @@ AlignAfterOpenBracket: Align 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 @@ BraceWrapping: SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false +BreakAfterAttributes: Never BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom BreakBeforeTernaryOperators: true @@ -49,6 +52,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true +DeriveLineEnding: false DerivePointerAlignment: false PointerAlignment: Left DisableFormat: false @@ -74,24 +78,33 @@ IncludeCategories: - 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 NamespaceIndentation: None -LambdaBodyIndentation: OuterScope 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/http/app.hpp b/http/app.hpp index 60c2215a29..d47cd898ac 100644 --- a/http/app.hpp +++ b/http/app.hpp @@ -116,8 +116,8 @@ class App } else { - sslServer = - std::make_unique(this, socketFd, sslContext, io); + sslServer = std::make_unique(this, socketFd, + sslContext, io); } sslServer->run(); diff --git a/http/http_client.hpp b/http/http_client.hpp index 4201499075..8161eb1c5f 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -536,7 +536,6 @@ class ConnectionInfo : public std::enable_shared_from_this void afterSslShutdown(const std::shared_ptr& /*self*/, bool retry, const boost::system::error_code& ec) { - if (ec) { BMCWEB_LOG_ERROR << host << ":" << std::to_string(port) diff --git a/http/http_connection.hpp b/http/http_connection.hpp index 47f9432bde..c8ae1fd8fa 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -45,8 +45,8 @@ inline void prettyPrintJson(crow::Response& res) static int connectionCount = 0; // request body limit size set by the bmcwebHttpReqBodyLimitMb option -constexpr uint64_t httpReqBodyLimit = - 1024UL * 1024UL * bmcwebHttpReqBodyLimitMb; +constexpr uint64_t httpReqBodyLimit = 1024UL * 1024UL * + bmcwebHttpReqBodyLimitMb; constexpr uint64_t loggedOutPostBodyLimit = 4096; diff --git a/http/http_response.hpp b/http/http_response.hpp index 5cbdb28eb3..2af12c9d05 100644 --- a/http/http_response.hpp +++ b/http/http_response.hpp @@ -37,8 +37,7 @@ struct Response stringResponse->set(key, value); } - Response() : stringResponse(response_type{}) - {} + Response() : stringResponse(response_type{}) {} Response(Response&& res) noexcept : stringResponse(std::move(res.stringResponse)), diff --git a/http/http_server.hpp b/http/http_server.hpp index 3949a46ab0..afa4514c1f 100644 --- a/http/http_server.hpp +++ b/http/http_server.hpp @@ -67,8 +67,8 @@ class Server gmtime_r(&lastTimeT, &myTm); dateStr.resize(100); - size_t dateStrSz = - strftime(&dateStr[0], 99, "%a, %d %b %Y %H:%M:%S GMT", &myTm); + size_t dateStrSz = strftime(&dateStr[0], 99, + "%a, %d %b %Y %H:%M:%S GMT", &myTm); dateStr.resize(dateStrSz); } diff --git a/http/logging.hpp b/http/logging.hpp index 6543b7306e..ed0c7f7c0b 100644 --- a/http/logging.hpp +++ b/http/logging.hpp @@ -65,8 +65,8 @@ class Logger gmtime_r(&t, &myTm); - size_t sz = - strftime(date.data(), date.size(), "%Y-%m-%d %H:%M:%S", &myTm); + size_t sz = strftime(date.data(), date.size(), "%Y-%m-%d %H:%M:%S", + &myTm); date.resize(sz); return date; } @@ -93,7 +93,7 @@ class Logger // template - Logger& operator<<([[maybe_unused]] T const& value) + Logger& operator<<([[maybe_unused]] const T& value) { // Somewhere in the code we're implicitly casting an array to a // pointer in logging code. It's non-trivial to find, diff --git a/http/routing.hpp b/http/routing.hpp index 18d3c2afd9..5bf6902e9c 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -34,8 +34,7 @@ namespace crow class BaseRule { public: - explicit BaseRule(const std::string& thisRule) : rule(thisRule) - {} + explicit BaseRule(const std::string& thisRule) : rule(thisRule) {} virtual ~BaseRule() = default; @@ -183,8 +182,7 @@ struct Wrapped template struct ReqHandlerWrapper { - explicit ReqHandlerWrapper(Func fIn) : f(std::move(fIn)) - {} + explicit ReqHandlerWrapper(Func fIn) : f(std::move(fIn)) {} void operator()(const Request& req, const std::shared_ptr& asyncResp, @@ -284,11 +282,9 @@ class WebSocketRule : public BaseRule using self_t = WebSocketRule; public: - explicit WebSocketRule(const std::string& ruleIn) : BaseRule(ruleIn) - {} + explicit WebSocketRule(const std::string& ruleIn) : BaseRule(ruleIn) {} - void validate() override - {} + void validate() override {} void handle(const Request& /*req*/, const std::shared_ptr& asyncResp, @@ -453,8 +449,7 @@ struct RuleParameterTraits class DynamicRule : public BaseRule, public RuleParameterTraits { public: - explicit DynamicRule(const std::string& ruleIn) : BaseRule(ruleIn) - {} + explicit DynamicRule(const std::string& ruleIn) : BaseRule(ruleIn) {} void validate() override { @@ -514,8 +509,7 @@ class TaggedRule : public: using self_t = TaggedRule; - explicit TaggedRule(const std::string& ruleIn) : BaseRule(ruleIn) - {} + explicit TaggedRule(const std::string& ruleIn) : BaseRule(ruleIn) {} void validate() override { @@ -584,8 +578,7 @@ class Trie } }; - Trie() : nodes(1) - {} + Trie() : nodes(1) {} private: void optimizeNode(Node* node) @@ -1015,8 +1008,8 @@ class Router // Make sure it's safe to deference the array at that index static_assert(maxVerbIndex < std::tuple_size_v); - FindRoute route = - findRouteByIndex(req.url().encoded_path(), perMethodIndex); + FindRoute route = findRouteByIndex(req.url().encoded_path(), + perMethodIndex); if (route.rule == nullptr) { continue; @@ -1246,8 +1239,8 @@ class Router // route if (foundRoute.allowHeader.empty()) { - foundRoute.route = - findRouteByIndex(req.url().encoded_path(), notFoundIndex); + foundRoute.route = findRouteByIndex(req.url().encoded_path(), + notFoundIndex); } else { @@ -1260,7 +1253,6 @@ class Router // Fill in the allow header if it's valid if (!foundRoute.allowHeader.empty()) { - asyncResp->res.addHeader(boost::beast::http::field::allow, foundRoute.allowHeader); } @@ -1332,8 +1324,7 @@ class Router Trie trie; // rule index 0 has special meaning; preallocate it to avoid // duplication. - PerMethod() : rules(1) - {} + PerMethod() : rules(1) {} }; std::array perMethods; diff --git a/http/utility.hpp b/http/utility.hpp index 75c84c2fc8..7a85519b90 100644 --- a/http/utility.hpp +++ b/http/utility.hpp @@ -123,8 +123,8 @@ constexpr inline uint64_t getParameterTag(std::string_view url) { return 0; } - std::string_view tag = - url.substr(urlSegmentIndex, urlIndex + 1 - urlSegmentIndex); + std::string_view tag = url.substr(urlSegmentIndex, + urlIndex + 1 - urlSegmentIndex); // Note, this is a really lame way to do std::pow(6, paramIndex) // std::pow doesn't work in constexpr in clang. diff --git a/http/websocket.hpp b/http/websocket.hpp index 87742008ce..e61f58b0bd 100644 --- a/http/websocket.hpp +++ b/http/websocket.hpp @@ -27,8 +27,7 @@ enum class MessageType struct Connection : std::enable_shared_from_this { public: - explicit Connection(const crow::Request& reqIn) : req(reqIn.req) - {} + explicit Connection(const crow::Request& reqIn) : req(reqIn.req) {} Connection(const Connection&) = delete; Connection(Connection&&) = delete; diff --git a/include/async_resp.hpp b/include/async_resp.hpp index d7f5819142..eafaaca3ef 100644 --- a/include/async_resp.hpp +++ b/include/async_resp.hpp @@ -16,8 +16,7 @@ class AsyncResp { public: AsyncResp() = default; - explicit AsyncResp(crow::Response&& resIn) : res(std::move(resIn)) - {} + explicit AsyncResp(crow::Response&& resIn) : res(std::move(resIn)) {} AsyncResp(const AsyncResp&) = delete; AsyncResp(AsyncResp&&) = delete; diff --git a/include/authentication.hpp b/include/authentication.hpp index 7110034cf2..18e782266f 100644 --- a/include/authentication.hpp +++ b/include/authentication.hpp @@ -146,8 +146,8 @@ static std::shared_ptr { endIndex = cookieValue.size(); } - std::string_view authKey = - cookieValue.substr(startIndex, endIndex - startIndex); + std::string_view authKey = cookieValue.substr(startIndex, + endIndex - startIndex); std::shared_ptr sessionOut = persistent_data::SessionStore::getInstance().loginSessionByToken( diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp index b2788829ce..ba3e5fa82b 100644 --- a/include/dbus_utility.hpp +++ b/include/dbus_utility.hpp @@ -125,7 +125,7 @@ inline bool getNthStringFromPath(const std::string& path, int index, std::filesystem::path p1(path); int count = -1; - for (auto const& element : p1) + for (const auto& element : p1) { if (element.has_filename()) { diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp index ed719d5c9c..fd49b02cf4 100644 --- a/include/hostname_monitor.hpp +++ b/include/hostname_monitor.hpp @@ -75,9 +75,9 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */, const int maxKeySize = 256; std::array cnBuffer{}; - int cnLength = - X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, - cnBuffer.data(), cnBuffer.size()); + int cnLength = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), + NID_commonName, cnBuffer.data(), + cnBuffer.size()); if (cnLength == -1) { BMCWEB_LOG_ERROR << "Failed to read NID_commonName"; diff --git a/include/human_sort.hpp b/include/human_sort.hpp index 7ab326d1a1..5cb6e56283 100644 --- a/include/human_sort.hpp +++ b/include/human_sort.hpp @@ -24,7 +24,6 @@ enum class ModeType inline int alphanumComp(std::string_view left, std::string_view right) { - std::string_view::const_iterator l = left.begin(); std::string_view::const_iterator r = right.begin(); diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp index fd27ef91cb..99b9cc3fba 100644 --- a/include/ibm/locks.hpp +++ b/include/ibm/locks.hpp @@ -187,7 +187,6 @@ class Lock inline RcGetLockList Lock::getLockList(const ListOfSessionIds& listSessionId) { - std::vector> lockList; if (!lockTable.empty()) @@ -241,7 +240,6 @@ inline RcReleaseLockApi Lock::releaseLock(const ListOfTransactionIds& p, inline RcAcquireLock Lock::acquireLock(const LockRequests& lockRequestStructure) { - // validate the lock request for (const auto& lockRecord : lockRequestStructure) @@ -363,7 +361,6 @@ inline bool Lock::validateRids(const ListOfTransactionIds& refRids) inline bool Lock::isValidLockRequest(const LockRequest& refLockRecord) { - // validate the locktype if (!((boost::equals(std::get<2>(refLockRecord), "Read") || @@ -392,7 +389,6 @@ inline bool Lock::isValidLockRequest(const LockRequest& refLockRecord) for (const auto& p : std::get<4>(refLockRecord)) { - // validate the lock flags // Allowed lockflags are locksame,lockall & dontlock @@ -552,7 +548,6 @@ inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1, uint32_t i = 0; for (const auto& p : std::get<4>(refLockRecord1)) { - // return conflict when any of them is try to lock all resources // under the current resource level. if (boost::equals(p.first, "LockAll") || diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp index e1b7f83949..51f5298b38 100644 --- a/include/ibm/management_console_rest.hpp +++ b/include/ibm/management_console_rest.hpp @@ -36,11 +36,11 @@ constexpr const char* internalServerError = "Internal Server Error"; constexpr size_t maxSaveareaDirSize = 25000000; // Allow save area dir size to be max 25MB constexpr size_t minSaveareaFileSize = - 100; // Allow save area file size of minimum 100B + 100; // Allow save area file size of minimum 100B constexpr size_t maxSaveareaFileSize = - 500000; // Allow save area file size upto 500KB + 500000; // Allow save area file size upto 500KB constexpr size_t maxBroadcastMsgSize = - 1000; // Allow Broadcast message size upto 1KB + 1000; // Allow Broadcast message size upto 1KB inline void handleFilePut(const crow::Request& req, const std::shared_ptr& asyncResp, @@ -323,8 +323,8 @@ inline void handleFileGet(const std::shared_ptr& asyncResp, return; } - std::string contentDispositionParam = - "attachment; filename=\"" + fileID + "\""; + std::string contentDispositionParam = "attachment; filename=\"" + fileID + + "\""; asyncResp->res.addHeader(boost::beast::http::field::content_disposition, contentDispositionParam); std::string fileData; @@ -685,7 +685,6 @@ inline bool isValidConfigFileName(const std::string& fileName, inline void requestRoutes(App& app) { - // allowed only for admin BMCWEB_ROUTE(app, "/ibm/v1/") .privileges({{"ConfigureComponents", "ConfigureManager"}}) diff --git a/include/login_routes.hpp b/include/login_routes.hpp index 00debb5531..122e741340 100644 --- a/include/login_routes.hpp +++ b/include/login_routes.hpp @@ -37,8 +37,8 @@ inline void requestRoutes(App& app) // Check if auth was provided by a payload if (contentType.starts_with("application/json")) { - loginCredentials = - nlohmann::json::parse(req.body(), nullptr, false); + loginCredentials = nlohmann::json::parse(req.body(), nullptr, + false); if (loginCredentials.is_discarded()) { BMCWEB_LOG_DEBUG << "Bad json in request"; @@ -77,8 +77,8 @@ inline void requestRoutes(App& app) if (dataIt->size() == 2) { nlohmann::json::iterator userIt2 = dataIt->begin(); - nlohmann::json::iterator passIt2 = - dataIt->begin() + 1; + nlohmann::json::iterator passIt2 = dataIt->begin() + + 1; looksLikePhosphorRest = true; if (userIt2 != dataIt->end() && passIt2 != dataIt->end()) @@ -235,8 +235,8 @@ inline void requestRoutes(App& app) const auto& session = req.session; if (session != nullptr) { - asyncResp->res.jsonValue["data"] = - "User '" + session->username + "' logged out"; + asyncResp->res.jsonValue["data"] = "User '" + session->username + + "' logged out"; asyncResp->res.jsonValue["message"] = "200 OK"; asyncResp->res.jsonValue["status"] = "ok"; diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp index adeeccb4df..abc1657fcb 100644 --- a/include/multipart_parser.hpp +++ b/include/multipart_parser.hpp @@ -274,8 +274,8 @@ class MultipartParser // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) const char* start = buffer + partDataMark; size_t size = i - partDataMark; - mime_fields.rbegin()->content += - std::string_view(start, size); + mime_fields.rbegin()->content += std::string_view(start, + size); } index++; } diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index 5bdc4ec0b7..82e3ecd8c1 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -221,7 +221,6 @@ inline void getPropertiesForEnumerate( } else { - propertyJson = val; } }, @@ -344,7 +343,6 @@ inline void getManagedObjectsForEnumerate( } else { - propertyJson = val; } }, @@ -1678,8 +1676,8 @@ inline void handleEnumerate(const std::shared_ptr& asyncResp, [objectPath, asyncResp]( const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& objectNames) { - auto transaction = - std::make_shared(objectPath, asyncResp); + auto transaction = std::make_shared(objectPath, + asyncResp); transaction->subtree = std::make_shared( @@ -2030,7 +2028,6 @@ inline void handleDBusUrl(const crow::Request& req, const std::shared_ptr& asyncResp, std::string& objectPath) { - // If accessing a single attribute, fill in and update objectPath, // otherwise leave destProperty blank std::string destProperty; @@ -2572,8 +2569,8 @@ inline void requestRoutes(App& app) asyncResp->res.result(boost::beast::http::status::not_found); return; } - std::string contentDispositionParam = - "attachment; filename=\"" + dumpFileName + "\""; + std::string contentDispositionParam = "attachment; filename=\"" + + dumpFileName + "\""; asyncResp->res.addHeader( boost::beast::http::field::content_disposition, diff --git a/include/sessions.hpp b/include/sessions.hpp index 99a1a0e962..6bb6a7a0e3 100644 --- a/include/sessions.hpp +++ b/include/sessions.hpp @@ -417,8 +417,7 @@ class SessionStore AuthConfigMethods authMethodsConfig; private: - SessionStore() : timeoutInSeconds(1800) - {} + SessionStore() : timeoutInSeconds(1800) {} }; } // namespace persistent_data diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp index 73d0b83590..71528417de 100644 --- a/include/ssl_key_handler.hpp +++ b/include/ssl_key_handler.hpp @@ -21,8 +21,8 @@ namespace ensuressl { -constexpr char const* trustStorePath = "/etc/ssl/certs/authority"; -constexpr char const* x509Comment = "Generated from OpenBMC service"; +constexpr const char* trustStorePath = "/etc/ssl/certs/authority"; +constexpr const char* x509Comment = "Generated from OpenBMC service"; static void initOpenssl(); static EVP_PKEY* createEcKey(); @@ -144,8 +144,8 @@ inline bool verifyOpensslKeyCert(const std::string& filepath) } } #else - EVP_PKEY_CTX* pkeyCtx = - EVP_PKEY_CTX_new_from_pkey(nullptr, pkey, nullptr); + EVP_PKEY_CTX* pkeyCtx = EVP_PKEY_CTX_new_from_pkey(nullptr, pkey, + nullptr); if (pkeyCtx == nullptr) { @@ -158,7 +158,6 @@ inline bool verifyOpensslKeyCert(const std::string& filepath) } else { - std::cerr << "Key not valid error number " << ERR_get_error() << "\n"; } diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index 0b87555ec0..3fc4133e6b 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -245,8 +245,8 @@ inline int formatEventLogEntry(const std::string& logEntryID, return -1; } - std::string msg = - redfish::registries::fillMessageArgs(messageArgs, message->message); + std::string msg = redfish::registries::fillMessageArgs(messageArgs, + message->message); if (msg.empty()) { return -1; @@ -440,8 +440,8 @@ class Subscription : public persistent_data::UserSubscription msg["Name"] = "Event Log"; msg["Events"] = logEntryArray; - std::string strMsg = - msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + std::string strMsg = msg.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); return this->sendEvent(strMsg); } @@ -509,8 +509,8 @@ class Subscription : public persistent_data::UserSubscription msg["Name"] = "Event Log"; msg["Events"] = logEntryArray; - std::string strMsg = - msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + std::string strMsg = msg.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); this->sendEvent(strMsg); } #endif @@ -549,8 +549,8 @@ class Subscription : public persistent_data::UserSubscription msg["Context"] = customText; } - std::string strMsg = - msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + std::string strMsg = msg.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); this->sendEvent(strMsg); } @@ -883,7 +883,6 @@ class EventServiceManager std::string addSubscription(const std::shared_ptr& subValue, const bool updateFile = true) { - std::uniform_int_distribution dist(0); bmcweb::OpenSSLGenerator gen; @@ -1317,8 +1316,8 @@ class EventServiceManager } // Watch redfish event log file for modifications. - fileWatchDesc = - inotify_add_watch(inotifyFd, redfishEventLogFile, IN_MODIFY); + fileWatchDesc = inotify_add_watch(inotifyFd, redfishEventLogFile, + IN_MODIFY); if (fileWatchDesc == -1) { BMCWEB_LOG_ERROR diff --git a/redfish-core/include/gzfile.hpp b/redfish-core/include/gzfile.hpp index 844932aa81..34bc151ef5 100644 --- a/redfish-core/include/gzfile.hpp +++ b/redfish-core/include/gzfile.hpp @@ -97,8 +97,8 @@ class GzFileReader while (pos != std::string::npos) { - std::string logEntry = - bufferStr.substr(initialPos, pos - initialPos); + std::string logEntry = bufferStr.substr(initialPos, + pos - initialPos); // Since there might be consecutive delimiters like "\r\n", we need // to filter empty strings. if (!logEntry.empty()) diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp index 9168cc5ec5..896eb4aac5 100644 --- a/redfish-core/include/redfish_aggregator.hpp +++ b/redfish-core/include/redfish_aggregator.hpp @@ -815,8 +815,8 @@ class RedfishAggregator if (boost::iequals(contentType, "application/json") || boost::iequals(contentType, "application/json; charset=utf-8")) { - nlohmann::json jsonVal = - nlohmann::json::parse(resp.body(), nullptr, false); + nlohmann::json jsonVal = nlohmann::json::parse(resp.body(), nullptr, + false); if (jsonVal.is_discarded()) { BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON"; @@ -879,8 +879,8 @@ class RedfishAggregator if (boost::iequals(contentType, "application/json") || boost::iequals(contentType, "application/json; charset=utf-8")) { - nlohmann::json jsonVal = - nlohmann::json::parse(resp.body(), nullptr, false); + nlohmann::json jsonVal = nlohmann::json::parse(resp.body(), nullptr, + false); if (jsonVal.is_discarded()) { BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON"; @@ -1013,8 +1013,8 @@ class RedfishAggregator boost::iequals(contentType, "application/json; charset=utf-8")) { bool addedLinks = false; - nlohmann::json jsonVal = - nlohmann::json::parse(resp.body(), nullptr, false); + nlohmann::json jsonVal = nlohmann::json::parse(resp.body(), nullptr, + false); if (jsonVal.is_discarded()) { BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON"; diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp index 26b9a8a2e1..774ab7c5eb 100644 --- a/redfish-core/include/utils/json_utils.hpp +++ b/redfish-core/include/utils/json_utils.hpp @@ -505,8 +505,7 @@ inline bool readJsonHelper(nlohmann::json& jsonRequest, crow::Response& res, return result; } -inline void packVariant(std::span /*toPack*/) -{} +inline void packVariant(std::span /*toPack*/) {} template void packVariant(std::span toPack, std::string_view key, diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp index 96885ebb20..e6ca9d313a 100644 --- a/redfish-core/include/utils/query_param.hpp +++ b/redfish-core/include/utils/query_param.hpp @@ -916,9 +916,9 @@ inline void recursiveSelect(nlohmann::json& currRoot, constexpr std::array reservedProperties = { "@odata.id", "@odata.type", "@odata.context", "@odata.etag", "error"}; - bool reserved = - std::find(reservedProperties.begin(), reservedProperties.end(), - it.key()) != reservedProperties.end(); + bool reserved = std::find(reservedProperties.begin(), + reservedProperties.end(), + it.key()) != reservedProperties.end(); if (reserved || (nextNode != nullptr && nextNode->isSelected())) { it = nextIt; diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp index 90048dd1b5..7c746a0b1d 100644 --- a/redfish-core/include/utils/sw_utils.hpp +++ b/redfish-core/include/utils/sw_utils.hpp @@ -110,7 +110,6 @@ inline void std::string, std::vector>>>& obj : subtree) { - sdbusplus::message::object_path path(obj.first); std::string swId = path.filename(); if (swId.empty()) diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp index f4fb0c07d5..cb018eff20 100644 --- a/redfish-core/include/utils/time_utils.hpp +++ b/redfish-core/include/utils/time_utils.hpp @@ -261,8 +261,8 @@ constexpr std::tuple z += 719468; IntType era = (z >= 0 ? z : z - 146096) / 146097; unsigned doe = static_cast(z - era * 146097); // [0, 146096] - unsigned yoe = - (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; // [0, 399] + unsigned yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / + 365; // [0, 399] IntType y = static_cast(yoe) + era * 400; unsigned doy = doe - (365 * yoe + yoe / 4 - yoe / 100); // [0, 365] unsigned mp = (5 * doy + 2) / 153; // [0, 11] diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index a844b61aaf..c9d4eb840d 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -204,8 +204,8 @@ inline void parseLDAPConfigData(nlohmann::json& jsonResponse, const LDAPConfigData& confData, const std::string& ldapType) { - std::string service = - (ldapType == "LDAP") ? "LDAPService" : "ActiveDirectoryService"; + std::string service = (ldapType == "LDAP") ? "LDAPService" + : "ActiveDirectoryService"; nlohmann::json& ldap = jsonResponse[ldapType]; @@ -265,9 +265,8 @@ inline void handleRoleMapPatch( messages::internalError(asyncResp->res); return; } - asyncResp->res - .jsonValue[serverType]["RemoteRoleMapping"][index] = - nullptr; + asyncResp->res.jsonValue[serverType]["RemoteRoleMapping"] + [index] = nullptr; }, ldapDbusService, roleMapObjData[index].first, "xyz.openbmc_project.Object.Delete", "Delete"); @@ -361,8 +360,8 @@ inline void handleRoleMapPatch( { BMCWEB_LOG_DEBUG << "setRoleMappingProperties: Creating new Object"; - std::string pathString = - "RemoteRoleMapping/" + std::to_string(index); + std::string pathString = "RemoteRoleMapping/" + + std::to_string(index); if (!localRole) { @@ -423,7 +422,6 @@ template inline void getLDAPConfigData(const std::string& ldapType, CallbackFunc&& callback) { - constexpr std::array interfaces = { ldapEnableInterface, ldapConfigInterface}; @@ -509,7 +507,6 @@ inline void getLDAPConfigData(const std::string& ldapType, } else if (interface.first == ldapConfigInterfaceStr) { - for (const auto& property : interface.second) { const std::string* strValue = @@ -712,9 +709,8 @@ inline void messages::internalError(asyncResp->res); return; } - asyncResp->res - .jsonValue[ldapServerElementName]["Authentication"]["Username"] = - username; + asyncResp->res.jsonValue[ldapServerElementName]["Authentication"] + ["Username"] = username; BMCWEB_LOG_DEBUG << "Updated the username"; }, ldapDbusService, ldapConfigObject, propertyInterface, "Set", @@ -745,9 +741,8 @@ inline void messages::internalError(asyncResp->res); return; } - asyncResp->res - .jsonValue[ldapServerElementName]["Authentication"]["Password"] = - ""; + asyncResp->res.jsonValue[ldapServerElementName]["Authentication"] + ["Password"] = ""; BMCWEB_LOG_DEBUG << "Updated the password"; }, ldapDbusService, ldapConfigObject, propertyInterface, "Set", @@ -1588,8 +1583,8 @@ inline void handleAccountCollectionGet( if (userCanSeeAllAccounts || (thisUser == user && userCanSeeSelf)) { nlohmann::json::object_t member; - member["@odata.id"] = - "/redfish/v1/AccountService/Accounts/" + user; + member["@odata.id"] = "/redfish/v1/AccountService/Accounts/" + + user; memberArray.push_back(std::move(member)); } } @@ -2016,7 +2011,6 @@ inline void inline void requestAccountServiceRoutes(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/AccountService/") .privileges(redfish::privileges::headAccountService) .methods(boost::beast::http::verb::head)( diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp index cdeb2103a8..3cb6a3fe03 100644 --- a/redfish-core/lib/certificate_service.hpp +++ b/redfish-core/lib/certificate_service.hpp @@ -24,23 +24,23 @@ namespace redfish { namespace certs { -constexpr char const* certInstallIntf = "xyz.openbmc_project.Certs.Install"; -constexpr char const* certReplaceIntf = "xyz.openbmc_project.Certs.Replace"; -constexpr char const* objDeleteIntf = "xyz.openbmc_project.Object.Delete"; -constexpr char const* certPropIntf = "xyz.openbmc_project.Certs.Certificate"; -constexpr char const* dbusPropIntf = "org.freedesktop.DBus.Properties"; -constexpr char const* dbusObjManagerIntf = "org.freedesktop.DBus.ObjectManager"; -constexpr char const* httpsServiceName = +constexpr const char* certInstallIntf = "xyz.openbmc_project.Certs.Install"; +constexpr const char* certReplaceIntf = "xyz.openbmc_project.Certs.Replace"; +constexpr const char* objDeleteIntf = "xyz.openbmc_project.Object.Delete"; +constexpr const char* certPropIntf = "xyz.openbmc_project.Certs.Certificate"; +constexpr const char* dbusPropIntf = "org.freedesktop.DBus.Properties"; +constexpr const char* dbusObjManagerIntf = "org.freedesktop.DBus.ObjectManager"; +constexpr const char* httpsServiceName = "xyz.openbmc_project.Certs.Manager.Server.Https"; -constexpr char const* ldapServiceName = +constexpr const char* ldapServiceName = "xyz.openbmc_project.Certs.Manager.Client.Ldap"; -constexpr char const* authorityServiceName = +constexpr const char* authorityServiceName = "xyz.openbmc_project.Certs.Manager.Authority.Ldap"; -constexpr char const* baseObjectPath = "/xyz/openbmc_project/certs"; -constexpr char const* httpsObjectPath = +constexpr const char* baseObjectPath = "/xyz/openbmc_project/certs"; +constexpr const char* httpsObjectPath = "/xyz/openbmc_project/certs/server/https"; -constexpr char const* ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap"; -constexpr char const* authorityObjectPath = +constexpr const char* ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap"; +constexpr const char* authorityObjectPath = "/xyz/openbmc_project/certs/authority/ldap"; } // namespace certs @@ -517,8 +517,8 @@ inline void handleReplaceCertificateAction( "bmc", "NetworkProtocol", "HTTPS", "Certificates", std::ref(id))) { - objectPath = - sdbusplus::message::object_path(certs::httpsObjectPath) / id; + objectPath = sdbusplus::message::object_path(certs::httpsObjectPath) / + id; name = "HTTPS certificate"; service = certs::httpsServiceName; } @@ -526,8 +526,8 @@ inline void handleReplaceCertificateAction( "AccountService", "LDAP", "Certificates", std::ref(id))) { - objectPath = - sdbusplus::message::object_path(certs::ldapObjectPath) / id; + objectPath = sdbusplus::message::object_path(certs::ldapObjectPath) / + id; name = "LDAP certificate"; service = certs::ldapServiceName; } diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 95632901af..e4e7b5af85 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -429,8 +429,8 @@ inline void const dbus::utility::ManagedObjectType& dbusData, boost::container::flat_set& ipv6Config) { - const std::string ipPathStart = - "/xyz/openbmc_project/network/" + ethifaceId; + const std::string ipPathStart = "/xyz/openbmc_project/network/" + + ethifaceId; // Since there might be several IPv6 configurations aligned with // single ethernet interface, loop over all of them @@ -527,8 +527,8 @@ inline void const dbus::utility::ManagedObjectType& dbusData, boost::container::flat_set& ipv4Config) { - const std::string ipPathStart = - "/xyz/openbmc_project/network/" + ethifaceId; + const std::string ipPathStart = "/xyz/openbmc_project/network/" + + ethifaceId; // Since there might be several IPv4 configurations aligned with // single ethernet interface, loop over all of them @@ -917,8 +917,8 @@ inline void handleMTUSizePatch(const std::string& ifaceId, const size_t mtuSize, const std::shared_ptr& asyncResp) { - sdbusplus::message::object_path objPath = - "/xyz/openbmc_project/network/" + ifaceId; + sdbusplus::message::object_path objPath = "/xyz/openbmc_project/network/" + + ifaceId; crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code& ec) { if (ec) @@ -1263,8 +1263,8 @@ inline void handleIPv4StaticPatch( for (nlohmann::json& thisJson : input) { - std::string pathString = - "IPv4StaticAddresses/" + std::to_string(entryIdx); + std::string pathString = "IPv4StaticAddresses/" + + std::to_string(entryIdx); if (!thisJson.is_null() && !thisJson.empty()) { @@ -1379,8 +1379,8 @@ inline void handleIPv4StaticPatch( deleteAndCreateIPAddress(IpVersion::IpV4, ifaceId, nicIpEntry->id, prefixLength, *gw, *addr, asyncResp); - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv4Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv4Data.cend()); } else { @@ -1415,8 +1415,8 @@ inline void handleIPv4StaticPatch( } if (nicIpEntry != ipv4Data.cend()) { - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv4Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv4Data.cend()); } entryIdx++; } @@ -1461,8 +1461,8 @@ inline void handleIPv6StaticAddressesPatch( getNextStaticIpEntry(ipv6Data.cbegin(), ipv6Data.cend()); for (const nlohmann::json& thisJson : input) { - std::string pathString = - "IPv6StaticAddresses/" + std::to_string(entryIdx); + std::string pathString = "IPv6StaticAddresses/" + + std::to_string(entryIdx); if (!thisJson.is_null() && !thisJson.empty()) { @@ -1522,8 +1522,8 @@ inline void handleIPv6StaticAddressesPatch( deleteAndCreateIPAddress(IpVersion::IpV6, ifaceId, nicIpEntry->id, prefix, "", *addr, asyncResp); - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv6Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv6Data.cend()); } else { @@ -1557,8 +1557,8 @@ inline void handleIPv6StaticAddressesPatch( } if (nicIpEntry != ipv6Data.cend()) { - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv6Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv6Data.cend()); } entryIdx++; } diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp index c418504ee3..82004e0960 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -162,7 +162,6 @@ inline void requestRoutesEventService(App& app) inline void requestRoutesSubmitTestEvent(App& app) { - BMCWEB_ROUTE( app, "/redfish/v1/EventService/Actions/EventService.SubmitTestEvent/") .privileges(redfish::privileges::postEventService) @@ -210,8 +209,8 @@ inline void requestRoutesEventDestinationCollection(App& app) for (const std::string& id : subscripIds) { nlohmann::json::object_t member; - member["@odata.id"] = - "/redfish/v1/EventService/Subscriptions/" + id; + member["@odata.id"] = "/redfish/v1/EventService/Subscriptions/" + + id; memberArray.push_back(std::move(member)); } }); diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp index 1799159baf..be89fbc3c2 100644 --- a/redfish-core/lib/fabric_adapters.hpp +++ b/redfish-core/lib/fabric_adapters.hpp @@ -25,7 +25,6 @@ inline void handleAdapterError(const boost::system::error_code& ec, crow::Response& res, const std::string& adapterId) { - if (ec.value() == boost::system::errc::io_error) { messages::resourceNotFound(res, "#FabricAdapter.v1_4_0.FabricAdapter", diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp index 643ce7ff60..ef858a1451 100644 --- a/redfish-core/lib/health.hpp +++ b/redfish-core/lib/health.hpp @@ -82,7 +82,6 @@ struct HealthPopulate : std::enable_shared_from_this // managers inventory is all the inventory, don't skip any if (!isManagersHealth && !isSelf) { - // We only want to look at this association if either the path // of this association is an inventory item, or one of the // endpoints in this association is a child diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp index 1c27223d32..e524145ed8 100644 --- a/redfish-core/lib/hypervisor_system.hpp +++ b/redfish-core/lib/hypervisor_system.hpp @@ -327,8 +327,8 @@ void getHypervisorIfaceData(const std::string& ethIfaceId, return; } - bool found = - extractHypervisorInterfaceData(ethIfaceId, resp, ethData, ipv4Data); + bool found = extractHypervisorInterfaceData(ethIfaceId, resp, ethData, + ipv4Data); if (!found) { BMCWEB_LOG_INFO << "Hypervisor Interface not found"; diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 5159ae1a31..aeb1d191bf 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -56,14 +56,14 @@ namespace redfish { -constexpr char const* crashdumpObject = "com.intel.crashdump"; -constexpr char const* crashdumpPath = "/com/intel/crashdump"; -constexpr char const* crashdumpInterface = "com.intel.crashdump"; -constexpr char const* deleteAllInterface = +constexpr const char* crashdumpObject = "com.intel.crashdump"; +constexpr const char* crashdumpPath = "/com/intel/crashdump"; +constexpr const char* crashdumpInterface = "com.intel.crashdump"; +constexpr const char* deleteAllInterface = "xyz.openbmc_project.Collection.DeleteAll"; -constexpr char const* crashdumpOnDemandInterface = +constexpr const char* crashdumpOnDemandInterface = "com.intel.crashdump.OnDemand"; -constexpr char const* crashdumpTelemetryInterface = +constexpr const char* crashdumpTelemetryInterface = "com.intel.crashdump.Telemetry"; enum class DumpCreationProgress @@ -274,8 +274,8 @@ inline static bool } } // Timestamp has no index - auto [ptr, ec] = - std::from_chars(tsStr.data(), tsStr.data() + tsStr.size(), timestamp); + auto [ptr, ec] = std::from_chars(tsStr.data(), tsStr.data() + tsStr.size(), + timestamp); if (ec != std::errc()) { messages::resourceNotFound(asyncResp->res, "LogEntry", entryID); @@ -489,8 +489,8 @@ inline void "#LogEntryCollection.LogEntryCollection"; asyncResp->res.jsonValue["@odata.id"] = std::move(odataIdStr); asyncResp->res.jsonValue["Name"] = dumpType + " Dump Entries"; - asyncResp->res.jsonValue["Description"] = - "Collection of " + dumpType + " Dump Entries"; + asyncResp->res.jsonValue["Description"] = "Collection of " + dumpType + + " Dump Entries"; nlohmann::json& entriesArray = asyncResp->res.jsonValue["Members"]; entriesArray = nlohmann::json::array(); @@ -552,16 +552,16 @@ inline void if (dumpType == "BMC") { thisEntry["DiagnosticDataType"] = "Manager"; - thisEntry["AdditionalDataURI"] = - entriesPath + entryID + "/attachment"; + thisEntry["AdditionalDataURI"] = entriesPath + entryID + + "/attachment"; thisEntry["AdditionalDataSizeBytes"] = size; } else if (dumpType == "System") { thisEntry["DiagnosticDataType"] = "OEM"; thisEntry["OEMDiagnosticDataType"] = "System"; - thisEntry["AdditionalDataURI"] = - entriesPath + entryID + "/attachment"; + thisEntry["AdditionalDataURI"] = entriesPath + entryID + + "/attachment"; thisEntry["AdditionalDataSizeBytes"] = size; } entriesArray.push_back(std::move(thisEntry)); @@ -854,8 +854,8 @@ inline void createDumpTaskCallback( nlohmann::json retMessage = messages::success(); taskData->messages.emplace_back(retMessage); - std::string headerLoc = - "Location: " + dumpEntryPath + http_helpers::urlEncode(dumpId); + std::string headerLoc = "Location: " + dumpEntryPath + + http_helpers::urlEncode(dumpId); taskData->payload->httpHeaders.emplace_back(std::move(headerLoc)); BMCWEB_LOG_DEBUG << createdObjPath.str @@ -1424,8 +1424,8 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app) firstEntry = false; nlohmann::json::object_t bmcLogEntry; - LogParseError status = - fillEventLogEntryJson(idStr, logEntry, bmcLogEntry); + LogParseError status = fillEventLogEntryJson(idStr, logEntry, + bmcLogEntry); if (status == LogParseError::messageIdNotInRegistry) { continue; @@ -3898,9 +3898,9 @@ static void getPostCodeForBoot(const std::shared_ptr& aResp, endCount = entryCount + postcode.size(); if (skip < endCount && (top + skip) > entryCount) { - uint64_t thisBootSkip = - std::max(static_cast(skip), entryCount) - - entryCount; + uint64_t thisBootSkip = std::max(static_cast(skip), + entryCount) - + entryCount; uint64_t thisBootTop = std::min(static_cast(top + skip), endCount) - entryCount; diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index 6e1427b344..134ecb65d8 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -163,7 +163,6 @@ inline void requestRoutesManagerResetAction(App& app) */ inline void requestRoutesManagerResetToDefaultsAction(App& app) { - /** * Function handles ResetToDefaults POST method request. * @@ -288,7 +287,6 @@ inline void const std::vector& supportedProfiles, const std::shared_ptr& asyncResp) { - crow::connections::systemBus->async_method_call( [asyncResp, currentProfile, supportedProfiles]( const boost::system::error_code& ec, @@ -440,7 +438,6 @@ inline void // pid and fans are off the same configuration else if (intfPair.first == pidConfigurationIface) { - if (classPtr == nullptr) { BMCWEB_LOG_ERROR << "Pid Class Field illegal"; @@ -569,7 +566,6 @@ inline void if (intfPair.first == pidConfigurationIface || intfPair.first == stepwiseConfigurationIface) { - if (propertyPair.first == "Zones") { const std::vector* inputs = @@ -782,7 +778,6 @@ inline CreatePIDRet createPidInterface( dbus::utility::DBusPropertiesMap& output, std::string& chassis, const std::string& profile) { - // common deleter if (it.value() == nullptr) { @@ -1027,7 +1022,6 @@ inline CreatePIDRet createPidInterface( if (chassisContainer) { - std::string chassisId; if (!redfish::json_util::readJson(*chassisContainer, response->res, "@odata.id", chassisId)) @@ -1116,7 +1110,6 @@ inline CreatePIDRet createPidInterface( { for (std::string& value : *inputs) { - std::replace(value.begin(), value.end(), '_', ' '); } output.emplace_back("Inputs", std::move(*inputs)); @@ -1328,12 +1321,10 @@ struct GetPIDValues : std::enable_shared_from_this struct SetPIDValues : std::enable_shared_from_this { - SetPIDValues(const std::shared_ptr& asyncRespIn, nlohmann::json& data) : asyncResp(asyncRespIn) { - std::optional pidControllers; std::optional fanControllers; std::optional fanZones; @@ -1508,12 +1499,12 @@ struct SetPIDValues : std::enable_shared_from_this std::replace(dbusObjName.begin(), dbusObjName.end(), ' ', '_'); BMCWEB_LOG_DEBUG << "looking for " << name; - auto pathItr = - std::find_if(managedObj.begin(), managedObj.end(), - [&dbusObjName](const auto& obj) { + auto pathItr = std::find_if(managedObj.begin(), + managedObj.end(), + [&dbusObjName](const auto& obj) { return boost::algorithm::ends_with(obj.first.str, "/" + dbusObjName); - }); + }); dbus::utility::DBusPropertiesMap output; output.reserve(16); // The pid interface length @@ -2107,7 +2098,6 @@ inline void requestRoutesManager(App& app) if (interfaceName == "xyz.openbmc_project.Inventory.Decorator.Asset") { - sdbusplus::asio::getAllProperties( *crow::connections::systemBus, connectionName, path, "xyz.openbmc_project.Inventory.Decorator.Asset", diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp index 44784726ef..c57d387390 100644 --- a/redfish-core/lib/memory.hpp +++ b/redfish-core/lib/memory.hpp @@ -243,15 +243,14 @@ inline void getPersistentMemoryProperties( if (volatileSizeInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["VolatileSizeMiB"] = (*volatileSizeInKiB) >> 10; } if (pmSizeInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["NonVolatileSizeMiB"] = - (*pmSizeInKiB) >> 10; + aResp->res.jsonValue[jsonPtr]["NonVolatileSizeMiB"] = (*pmSizeInKiB) >> + 10; } if (cacheSizeInKB != nullptr) @@ -364,30 +363,26 @@ inline void getPersistentMemoryProperties( if (dataLockCapable != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["DataLockCapable"] = - *dataLockCapable; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["DataLockCapable"] = *dataLockCapable; } if (passphraseCapable != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseCapable"] = - *passphraseCapable; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["PassphraseCapable"] = *passphraseCapable; } if (maxPassphraseCount != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["MaxPassphraseCount"] = - *maxPassphraseCount; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["MaxPassphraseCount"] = *maxPassphraseCount; } if (passphraseLockLimit != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseLockLimit"] = - *passphraseLockLimit; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["PassphraseLockLimit"] = *passphraseLockLimit; } } @@ -593,9 +588,8 @@ inline void if (locationCode != nullptr) { - aResp->res - .jsonValue[jsonPtr]["Location"]["PartLocation"]["ServiceLabel"] = - *locationCode; + aResp->res.jsonValue[jsonPtr]["Location"]["PartLocation"] + ["ServiceLabel"] = *locationCode; } getPersistentMemoryProperties(aResp, properties, jsonPtr); diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp index 41464bc9e6..907f6cf93d 100644 --- a/redfish-core/lib/message_registries.hpp +++ b/redfish-core/lib/message_registries.hpp @@ -115,8 +115,8 @@ inline void handleMessageRoutesMessageRegistryFileGet( asyncResp->res.jsonValue["@odata.type"] = "#MessageRegistryFile.v1_1_0.MessageRegistryFile"; asyncResp->res.jsonValue["Name"] = registry + " Message Registry File"; - asyncResp->res.jsonValue["Description"] = - dmtf + registry + " Message Registry File Location"; + asyncResp->res.jsonValue["Description"] = dmtf + registry + + " Message Registry File Location"; asyncResp->res.jsonValue["Id"] = header->registryPrefix; asyncResp->res.jsonValue["Registry"] = header->id; nlohmann::json::array_t languages; diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp index 2e97fa08ca..b184889cc4 100644 --- a/redfish-core/lib/metric_report_definition.hpp +++ b/redfish-core/lib/metric_report_definition.hpp @@ -233,8 +233,8 @@ inline bool getChassisSensorNodeFromMetrics( { const std::vector& uris = metric.second; - std::optional error = - getChassisSensorNode(uris, matched); + std::optional error = getChassisSensorNode(uris, + matched); if (error) { messages::propertyValueIncorrect(asyncResp->res, error->uri, diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index 2621fd6030..d06e21a5a7 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -485,7 +485,6 @@ inline void handleManagersNetworkProtocolPatch( App& app, const crow::Request& req, const std::shared_ptr& asyncResp) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp index 631b5c1c36..f2aceccf61 100644 --- a/redfish-core/lib/pcie.hpp +++ b/redfish-core/lib/pcie.hpp @@ -31,7 +31,7 @@ namespace redfish { -static constexpr char const* inventoryPath = "/xyz/openbmc_project/inventory"; +static constexpr const char* inventoryPath = "/xyz/openbmc_project/inventory"; static constexpr std::array pcieDeviceInterface = { "xyz.openbmc_project.Inventory.Item.PCIeDevice"}; @@ -430,8 +430,8 @@ inline void addPCIeFunctionList( { // Check if this function exists by // looking for a device ID - std::string devIDProperty = - "Function" + std::to_string(functionNum) + "DeviceId"; + std::string devIDProperty = "Function" + std::to_string(functionNum) + + "DeviceId"; const std::string* property = nullptr; for (const auto& propEntry : pcieDevProperties) { diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp index 2b9ef2b766..b588ac0021 100644 --- a/redfish-core/lib/pcie_slots.hpp +++ b/redfish-core/lib/pcie_slots.hpp @@ -124,7 +124,6 @@ inline void if (lanes != nullptr) { - slot["Lanes"] = *lanes; } diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp index 5d7bbb7d2d..a0eadf56f9 100644 --- a/redfish-core/lib/power.hpp +++ b/redfish-core/lib/power.hpp @@ -121,7 +121,6 @@ inline void setPowerCapOverride( } inline void requestRoutesPower(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/Chassis//Power/") .privileges(redfish::privileges::getPower) .methods(boost::beast::http::verb::get)( @@ -178,8 +177,8 @@ inline void requestRoutesPower(App& app) len = end - (lastPos + 1); } - std::string interfaceChassisName = - chassis.substr(lastPos + 1, len); + std::string interfaceChassisName = chassis.substr(lastPos + 1, + len); if (interfaceChassisName == sensorAsyncResp->chassisId) { found = true; diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp index 4566e4bd8f..205578c947 100644 --- a/redfish-core/lib/processor.hpp +++ b/redfish-core/lib/processor.hpp @@ -1058,7 +1058,6 @@ inline void handleProcessorCollectionHead( inline void requestRoutesOperatingConfigCollection(App& app) { - BMCWEB_ROUTE( app, "/redfish/v1/Systems/system/Processors//OperatingConfigs/") .privileges(redfish::privileges::getOperatingConfigCollection) diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp index 35d5d5cff2..e55314a67f 100644 --- a/redfish-core/lib/redfish_sessions.hpp +++ b/redfish-core/lib/redfish_sessions.hpp @@ -48,7 +48,6 @@ inline void const std::shared_ptr& asyncResp, const std::string& /*sessionId*/) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; @@ -138,7 +137,6 @@ inline void handleSessionCollectionHead( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; @@ -246,7 +244,6 @@ inline void handleSessionServiceHead( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; diff --git a/redfish-core/lib/redfish_util.hpp b/redfish-core/lib/redfish_util.hpp index a742ca69bd..2e4c6e5a38 100644 --- a/redfish-core/lib/redfish_util.hpp +++ b/redfish-core/lib/redfish_util.hpp @@ -160,8 +160,8 @@ void getPortStatusAndPath( const std::string& unitState = std::get(unit); - bool isProtocolEnabled = - ((unitState == "running") || (unitState == "listening")); + bool isProtocolEnabled = ((unitState == "running") || + (unitState == "listening")); socketData.emplace_back(socketPath, std::string(kv.first), isProtocolEnabled); diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp index 8ea46d81f6..a9b81e423b 100644 --- a/redfish-core/lib/redfish_v1.hpp +++ b/redfish-core/lib/redfish_v1.hpp @@ -110,8 +110,8 @@ inline void jsonSchemaGet(App& app, const crow::Request& req, } nlohmann::json& json = asyncResp->res.jsonValue; - json["@odata.id"] = - crow::utility::urlFromPieces("redfish", "v1", "JsonSchemas", schema); + json["@odata.id"] = crow::utility::urlFromPieces("redfish", "v1", + "JsonSchemas", schema); json["@odata.type"] = "#JsonSchemaFile.v1_0_2.JsonSchemaFile"; json["Name"] = schema + " Schema File"; json["Description"] = schema + " Schema File Location"; @@ -128,8 +128,8 @@ inline void jsonSchemaGet(App& app, const crow::Request& req, nlohmann::json::array_t locationArray; nlohmann::json::object_t locationEntry; locationEntry["Language"] = "en"; - locationEntry["PublicationUri"] = - "http://redfish.dmtf.org/schemas/v1/" + schema + ".json"; + locationEntry["PublicationUri"] = "http://redfish.dmtf.org/schemas/v1/" + + schema + ".json"; locationEntry["Uri"] = crow::utility::urlFromPieces( "redfish", "v1", "JsonSchemas", schema, std::string(schema) + ".json"); diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 0772da559f..e04eac671f 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -756,8 +756,8 @@ inline void objectPropertiesToJson( } sensorJson["Status"]["State"] = getState(inventoryItem); - sensorJson["Status"]["Health"] = - getHealth(sensorJson, propertiesDict, inventoryItem); + sensorJson["Status"]["Health"] = getHealth(sensorJson, propertiesDict, + inventoryItem); // Parameter to set to override the type we get from dbus, and force it to // int, regardless of what is available. This is used for schemas like fan, @@ -959,7 +959,6 @@ inline void objectInterfacesToJson( const dbus::utility::DBusInteracesMap& interfacesDict, nlohmann::json& sensorJson, InventoryItem* inventoryItem) { - for (const auto& [interface, valuesDict] : interfacesDict) { objectPropertiesToJson(sensorName, sensorType, chassisSubNode, @@ -1113,10 +1112,10 @@ inline void populateFanRedundancy( } } - size_t minNumNeeded = - collection->empty() - ? 0 - : collection->size() - *allowedFailures; + size_t minNumNeeded = collection->empty() + ? 0 + : collection->size() - + *allowedFailures; nlohmann::json& jResp = sensorsAsyncResp->asyncResp->res .jsonValue["Redundancy"]; @@ -1262,8 +1261,8 @@ inline void addInventoryItem( const std::string& invItemObjPath, const std::string& sensorObjPath) { // Look for inventory item in vector - InventoryItem* inventoryItem = - findInventoryItem(inventoryItems, invItemObjPath); + InventoryItem* inventoryItem = findInventoryItem(inventoryItems, + invItemObjPath); // If inventory item doesn't exist in vector, add it if (inventoryItem == nullptr) @@ -1456,8 +1455,8 @@ static void getInventoryItemsData( static_cast(objDictEntry.first); // If this object path is one of the specified inventory items - InventoryItem* inventoryItem = - findInventoryItem(inventoryItems, objPath); + InventoryItem* inventoryItem = findInventoryItem(inventoryItems, + objPath); if (inventoryItem != nullptr) { // Store inventory data in InventoryItem diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp index 0388ccd69e..7182317540 100644 --- a/redfish-core/lib/storage.hpp +++ b/redfish-core/lib/storage.hpp @@ -737,7 +737,7 @@ inline void chassisDriveCollectionGet( asyncResp->res.jsonValue["Members@odata.count"] = resp.size(); }); // end association lambda - } // end Iterate over all retrieved ObjectPaths + } // end Iterate over all retrieved ObjectPaths }); } @@ -755,7 +755,6 @@ inline void buildDrive(const std::shared_ptr& asyncResp, const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { - if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; @@ -803,7 +802,6 @@ inline void const std::string& driveName, const std::vector& resp) { - for (const std::string& drivePath : resp) { sdbusplus::message::object_path path(drivePath); diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index c9d31d1764..19e5e648a5 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -139,7 +139,6 @@ inline void getProcessorProperties( const std::vector>& properties) { - BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties."; // TODO: Get Model @@ -185,7 +184,6 @@ inline void getProcessorSummary(const std::shared_ptr& aResp, const std::string& service, const std::string& path) { - auto getCpuPresenceState = [aResp](const boost::system::error_code& ec3, const bool cpuPresenceCheck) { if (ec3) @@ -2792,11 +2790,11 @@ inline void requestRoutesSystemsCollection(App& app) */ inline void doNMI(const std::shared_ptr& asyncResp) { - constexpr char const* serviceName = "xyz.openbmc_project.Control.Host.NMI"; - constexpr char const* objectPath = "/xyz/openbmc_project/control/host0/nmi"; - constexpr char const* interfaceName = + constexpr const char* serviceName = "xyz.openbmc_project.Control.Host.NMI"; + constexpr const char* objectPath = "/xyz/openbmc_project/control/host0/nmi"; + constexpr const char* interfaceName = "xyz.openbmc_project.Control.Host.NMI"; - constexpr char const* method = "NMI"; + constexpr const char* method = "NMI"; crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code& ec) { @@ -2995,7 +2993,6 @@ inline void afterPortRequest( */ inline void requestRoutesSystems(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/") .privileges(redfish::privileges::headComputerSystem) .methods(boost::beast::http::verb::head)( diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp index 4edfe182d6..167a0c7d40 100644 --- a/redfish-core/lib/task.hpp +++ b/redfish-core/lib/task.hpp @@ -198,8 +198,8 @@ struct TaskData : std::enable_shared_from_this static void sendTaskEvent(std::string_view state, size_t index) { - std::string origin = - "/redfish/v1/TaskService/Tasks/" + std::to_string(index); + std::string origin = "/redfish/v1/TaskService/Tasks/" + + std::to_string(index); std::string resType = "Task"; // TaskState enums which should send out an event are: // "Starting" = taskResumed diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 650ba95622..59b2b3b8b5 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -212,7 +212,6 @@ static void iface == "xyz.openbmc_project.Software.ActivationProgress") { - const uint8_t* progress = nullptr; for (const auto& property : values) { @@ -538,8 +537,8 @@ inline void uploadImageFile(crow::Response& res, std::string_view body) std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc); // set the permission of the file to 640 - std::filesystem::perms permission = - std::filesystem::perms::owner_read | std::filesystem::perms::group_read; + std::filesystem::perms permission = std::filesystem::perms::owner_read | + std::filesystem::perms::group_read; std::filesystem::permissions(filepath, permission); out << body; @@ -616,7 +615,7 @@ inline void continue; } - for (auto const& param : + for (const auto& param : boost::beast::http::param_list{it->value().substr(index)}) { if (param.first != "name" || param.second.empty()) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp index 96fd03798e..373881e605 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -794,7 +794,6 @@ inline void doEjectAction(const std::shared_ptr& asyncResp, const std::string& service, const std::string& name, bool legacy) { - // Legacy mount requires parameter with image if (legacy) { @@ -952,7 +951,6 @@ inline void handleManagersVirtualMediaActionEject( for (const auto& object : subtree) { - VmMode mode = parseObjectPathAndGetMode(object.first, resName); if (mode != VmMode::Invalid) { diff --git a/src/boost_asio.cpp b/src/boost_asio.cpp index eb3b7262c3..bf00c8ff26 100644 --- a/src/boost_asio.cpp +++ b/src/boost_asio.cpp @@ -1 +1 @@ -#include \ No newline at end of file +#include diff --git a/src/boost_asio_ssl.cpp b/src/boost_asio_ssl.cpp index cb6377da31..d98d7b5e60 100644 --- a/src/boost_asio_ssl.cpp +++ b/src/boost_asio_ssl.cpp @@ -1 +1 @@ -#include \ No newline at end of file +#include diff --git a/src/boost_beast.cpp b/src/boost_beast.cpp index 149761046f..01b7c8f89a 100644 --- a/src/boost_beast.cpp +++ b/src/boost_beast.cpp @@ -1 +1 @@ -#include \ No newline at end of file +#include diff --git a/src/boost_url.cpp b/src/boost_url.cpp index ce55e9b9c3..95ec218eb5 100644 --- a/src/boost_url.cpp +++ b/src/boost_url.cpp @@ -1,2 +1,2 @@ -#include \ No newline at end of file +#include diff --git a/src/ssl_key_handler_test.cpp b/src/ssl_key_handler_test.cpp index 818137c408..a2b0f55ad3 100644 --- a/src/ssl_key_handler_test.cpp +++ b/src/ssl_key_handler_test.cpp @@ -1 +1 @@ -// TODO(ed) WRITE TESTS FOR THIS \ No newline at end of file +// TODO(ed) WRITE TESTS FOR THIS diff --git a/test/http/verb_test.cpp b/test/http/verb_test.cpp index 76dd8d0fb1..aff6ec7405 100644 --- a/test/http/verb_test.cpp +++ b/test/http/verb_test.cpp @@ -53,4 +53,4 @@ TEST(HttpVerbToStringTest, ValidCase) HttpVerb httpVerb = static_cast(verbIndex); EXPECT_EQ(httpVerbToString(httpVerb), verbMap[httpVerb]); } -} \ No newline at end of file +} diff --git a/test/include/dbus_utility_test.cpp b/test/include/dbus_utility_test.cpp index 71978d01ba..c6b02c66ee 100644 --- a/test/include/dbus_utility_test.cpp +++ b/test/include/dbus_utility_test.cpp @@ -45,4 +45,4 @@ TEST(GetNthStringFromPath, InvalidIndexReturnsFalse) EXPECT_FALSE(getNthStringFromPath(path, -1, result)); } } // namespace -} // namespace dbus::utility \ No newline at end of file +} // namespace dbus::utility diff --git a/test/include/google/google_service_root_test.cpp b/test/include/google/google_service_root_test.cpp index 32d4e526fb..b4a476b2dd 100644 --- a/test/include/google/google_service_root_test.cpp +++ b/test/include/google/google_service_root_test.cpp @@ -36,4 +36,4 @@ TEST(HandleGoogleV1Get, OnSuccess) } } // namespace -} // namespace crow::google_api \ No newline at end of file +} // namespace crow::google_api diff --git a/test/include/human_sort_test.cpp b/test/include/human_sort_test.cpp index be21a198b0..78d2d2220c 100644 --- a/test/include/human_sort_test.cpp +++ b/test/include/human_sort_test.cpp @@ -55,4 +55,4 @@ TEST(AlphaNum, LessTest) "Alpha 2"}; EXPECT_THAT(sorted, ElementsAreArray({"Alpha 2", "Alpha 10"})); } -} // namespace \ No newline at end of file +} // namespace diff --git a/test/redfish-core/include/privileges_test.cpp b/test/redfish-core/include/privileges_test.cpp index 2d0da021eb..b7f7cbcc42 100644 --- a/test/redfish-core/include/privileges_test.cpp +++ b/test/redfish-core/include/privileges_test.cpp @@ -60,8 +60,8 @@ TEST(PrivilegeTest, PrivilegeCheckForSingleCaseFailure) TEST(PrivilegeTest, PrivilegeCheckForANDCaseSuccess) { - auto userPrivileges = - Privileges{"Login", "ConfigureManager", "ConfigureSelf"}; + auto userPrivileges = Privileges{"Login", "ConfigureManager", + "ConfigureSelf"}; OperationMap entityPrivileges{ {boost::beast::http::verb::get, {{"Login", "ConfigureManager", "ConfigureSelf"}}}}; @@ -135,4 +135,4 @@ TEST(PrivilegeTest, GetActivePrivilegeNames) expectedPrivileges[4])); } } // namespace -} // namespace redfish \ No newline at end of file +} // namespace redfish diff --git a/test/redfish-core/include/redfish_aggregator_test.cpp b/test/redfish-core/include/redfish_aggregator_test.cpp index 2d19cee705..055d1371cd 100644 --- a/test/redfish-core/include/redfish_aggregator_test.cpp +++ b/test/redfish-core/include/redfish_aggregator_test.cpp @@ -248,8 +248,8 @@ void assertProcessResponse(unsigned result) jsonResp["Name"] = "Test"; crow::Response resp; - resp.body() = - jsonResp.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + resp.body() = jsonResp.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); resp.addHeader("Content-Type", "application/json"); resp.addHeader("Allow", "GET"); resp.addHeader("Location", "/redfish/v1/Chassis/TestChassis"); @@ -658,8 +658,8 @@ TEST(processContainsSubordinateResponse, addLinks) jsonValue["Test"]["@odata.id"] = "/redfish/v1/Test"; jsonValue["TelemetryService"]["@odata.id"] = "/redfish/v1/TelemetryService"; jsonValue["UpdateService"]["@odata.id"] = "/redfish/v1/UpdateService"; - resp.body() = - jsonValue.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + resp.body() = jsonValue.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); auto asyncResp = std::make_shared(); asyncResp->res.result(200); @@ -701,8 +701,8 @@ TEST(processContainsSubordinateResponse, localNotOK) jsonValue["Test"]["@odata.id"] = "/redfish/v1/Test"; jsonValue["TelemetryService"]["@odata.id"] = "/redfish/v1/TelemetryService"; jsonValue["UpdateService"]["@odata.id"] = "/redfish/v1/UpdateService"; - resp.body() = - jsonValue.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + resp.body() = jsonValue.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp, resp); @@ -769,8 +769,8 @@ TEST(processContainsSubordinateResponse, noValidLinks) nlohmann::json jsonValue; resp.addHeader("Content-Type", "application/json"); jsonValue["@odata.id"] = "/redfish/v1"; - resp.body() = - jsonValue.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + resp.body() = jsonValue.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp, resp); @@ -788,8 +788,8 @@ TEST(processContainsSubordinateResponse, noValidLinks) jsonValue["Test"]["@odata.id"] = "/redfish/v1/Test"; jsonValue["TelemetryService"]["@odata.id"] = "/redfish/v1/TelemetryService"; jsonValue["UpdateService"]["@odata.id"] = "/redfish/v1/UpdateService"; - resp.body() = - jsonValue.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + resp.body() = jsonValue.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp, resp); diff --git a/test/redfish-core/include/utils/hex_utils_test.cpp b/test/redfish-core/include/utils/hex_utils_test.cpp index 8fd4638d09..d96e4d4681 100644 --- a/test/redfish-core/include/utils/hex_utils_test.cpp +++ b/test/redfish-core/include/utils/hex_utils_test.cpp @@ -80,4 +80,4 @@ TEST(HexStringToBytes, Failure) EXPECT_THAT(hexStringToBytes("012"), IsEmpty()); } -} // namespace \ No newline at end of file +} // namespace diff --git a/test/redfish-core/include/utils/query_param_test.cpp b/test/redfish-core/include/utils/query_param_test.cpp index d049314d75..8c75241d77 100644 --- a/test/redfish-core/include/utils/query_param_test.cpp +++ b/test/redfish-core/include/utils/query_param_test.cpp @@ -232,7 +232,7 @@ TEST(GetSelectParam, TrieNodesRespectAllProperties) SelectTrie getTrie(std::span properties) { SelectTrie trie; - for (auto const& property : properties) + for (const auto& property : properties) { EXPECT_TRUE(trie.insertNode(property)); } diff --git a/test/redfish-core/lib/chassis_test.cpp b/test/redfish-core/lib/chassis_test.cpp index a04385984e..8f181632ba 100644 --- a/test/redfish-core/lib/chassis_test.cpp +++ b/test/redfish-core/lib/chassis_test.cpp @@ -42,7 +42,6 @@ void assertChassisResetActionInfoGet(const std::string& chassisId, TEST(HandleChassisResetActionInfoGet, StaticAttributesAreExpected) { - auto response = std::make_shared(); std::error_code err; crow::Request request{{boost::beast::http::verb::get, "/whatever", 11}, @@ -57,4 +56,4 @@ TEST(HandleChassisResetActionInfoGet, StaticAttributesAreExpected) } } // namespace -} // namespace redfish \ No newline at end of file +} // namespace redfish -- cgit v1.2.3