diff options
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | http/routing.hpp | 10 | ||||
-rw-r--r-- | http/utility.hpp | 3 | ||||
-rw-r--r-- | include/openbmc_dbus_rest.hpp | 4 | ||||
-rw-r--r-- | redfish-core/include/event_service_manager.hpp | 3 | ||||
-rw-r--r-- | redfish-core/include/privileges.hpp | 3 | ||||
-rw-r--r-- | redfish-core/include/redfish.hpp | 2 | ||||
-rw-r--r-- | redfish-core/include/server_sent_events.hpp | 3 | ||||
-rw-r--r-- | redfish-core/lib/certificate_service.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/health.hpp | 6 | ||||
-rw-r--r-- | redfish-core/lib/managers.hpp | 3 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/task.hpp | 2 |
13 files changed, 26 insertions, 18 deletions
diff --git a/.clang-tidy b/.clang-tidy index d892bddf9e..bed3fadfd8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -222,6 +222,7 @@ cppcoreguidelines-pro-type-union-access, cppcoreguidelines-pro-type-vararg, cppcoreguidelines-slicing, cppcoreguidelines-special-member-functions, +google-explicit-constructor, misc-misplaced-const, #misc-no-recursion, misc-redundant-expression, diff --git a/http/routing.hpp b/http/routing.hpp index db25433170..3a7b9c2f62 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -30,7 +30,7 @@ namespace crow class BaseRule { public: - BaseRule(const std::string& thisRule) : rule(thisRule) + explicit BaseRule(const std::string& thisRule) : rule(thisRule) {} virtual ~BaseRule() = default; @@ -224,7 +224,7 @@ struct Wrapped template <typename Req, typename... Args> struct ReqHandlerWrapper { - ReqHandlerWrapper(Func fIn) : f(std::move(fIn)) + explicit ReqHandlerWrapper(Func fIn) : f(std::move(fIn)) {} void operator()(const Request& req, @@ -328,7 +328,7 @@ class WebSocketRule : public BaseRule using self_t = WebSocketRule; public: - WebSocketRule(const std::string& ruleIn) : BaseRule(ruleIn) + explicit WebSocketRule(const std::string& ruleIn) : BaseRule(ruleIn) {} void validate() override @@ -467,7 +467,7 @@ struct RuleParameterTraits class DynamicRule : public BaseRule, public RuleParameterTraits<DynamicRule> { public: - DynamicRule(const std::string& ruleIn) : BaseRule(ruleIn) + explicit DynamicRule(const std::string& ruleIn) : BaseRule(ruleIn) {} void validate() override @@ -545,7 +545,7 @@ class TaggedRule : public: using self_t = TaggedRule<Args...>; - TaggedRule(const std::string& ruleIn) : BaseRule(ruleIn) + explicit TaggedRule(const std::string& ruleIn) : BaseRule(ruleIn) {} void validate() override diff --git a/http/utility.hpp b/http/utility.hpp index 0b1743f228..7b0af130a6 100644 --- a/http/utility.hpp +++ b/http/utility.hpp @@ -655,7 +655,8 @@ class UrlSegmentMatcherVisitor return std::string_view(segment.data(), segment.size()) == expected; } - UrlSegmentMatcherVisitor(const boost::urls::string_value& segmentIn) : + explicit UrlSegmentMatcherVisitor( + const boost::urls::string_value& segmentIn) : segment(segmentIn) {} diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index 76410237bc..0e2af700f6 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -436,7 +436,7 @@ inline void getObjectAndEnumerate( // Structure for storing data on an in progress action struct InProgressActionData { - InProgressActionData(crow::Response& resIn) : res(resIn) + explicit InProgressActionData(crow::Response& resIn) : res(resIn) {} ~InProgressActionData() { @@ -1781,7 +1781,7 @@ inline void handleGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, struct AsyncPutRequest { - AsyncPutRequest(const std::shared_ptr<bmcweb::AsyncResp>& resIn) : + explicit AsyncPutRequest(const std::shared_ptr<bmcweb::AsyncResp>& resIn) : asyncResp(resIn) {} ~AsyncPutRequest() diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index 3c476988fd..1785828444 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -374,7 +374,8 @@ class Subscription : public persistent_data::UserSubscription // Subscription constructor } - Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : + explicit Subscription( + const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : eventSeqNum(1) { sseConn = std::make_shared<crow::ServerSentEvents>(adaptor); diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp index 160816fd93..f20cedee15 100644 --- a/redfish-core/include/privileges.hpp +++ b/redfish-core/include/privileges.hpp @@ -198,7 +198,8 @@ class Privileges } private: - Privileges(const std::bitset<maxPrivilegeCount>& p) : privilegeBitset{p} + explicit Privileges(const std::bitset<maxPrivilegeCount>& p) : + privilegeBitset{p} {} std::bitset<maxPrivilegeCount> privilegeBitset = 0; }; diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp index c961b2db05..8c05dd7f86 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp @@ -62,7 +62,7 @@ class RedfishService * * @param[in] app Crow app on which Redfish will initialize */ - RedfishService(App& app) + explicit RedfishService(App& app) { requestAccountServiceRoutes(app); requestRoutesRoles(app); diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp index 6663f66c61..16d8e186d8 100644 --- a/redfish-core/include/server_sent_events.hpp +++ b/redfish-core/include/server_sent_events.hpp @@ -256,7 +256,8 @@ class ServerSentEvents : public std::enable_shared_from_this<ServerSentEvents> ServerSentEvents(ServerSentEvents&&) = delete; ServerSentEvents& operator=(ServerSentEvents&&) = delete; - ServerSentEvents(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : + explicit ServerSentEvents( + const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : sseConn(adaptor) { startSSE(); diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp index b931c7db75..2fc606d645 100644 --- a/redfish-core/lib/certificate_service.hpp +++ b/redfish-core/lib/certificate_service.hpp @@ -155,7 +155,7 @@ class CertificateFile CertificateFile& operator=(const CertificateFile&) = delete; CertificateFile(CertificateFile&&) = delete; CertificateFile& operator=(CertificateFile&&) = delete; - CertificateFile(const std::string& certString) + explicit CertificateFile(const std::string& certString) { std::array<char, 18> dirTemplate = {'/', 't', 'm', 'p', '/', 'C', 'e', 'r', 't', 's', '.', 'X', diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp index 04281bf903..cf84c9306a 100644 --- a/redfish-core/lib/health.hpp +++ b/redfish-core/lib/health.hpp @@ -31,8 +31,10 @@ namespace redfish struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> { // By default populate status to "/Status" of |asyncResp->res.jsonValue|. - HealthPopulate(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) : - asyncResp(asyncRespIn), statusPtr("/Status") + explicit HealthPopulate( + const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) : + asyncResp(asyncRespIn), + statusPtr("/Status") {} // Takes a JSON pointer rather than a reference. This is pretty useful when diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index f15fb0b10d..bda5a1a2dc 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -1168,7 +1168,8 @@ inline CreatePIDRet createPidInterface( struct GetPIDValues : std::enable_shared_from_this<GetPIDValues> { - GetPIDValues(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) : + explicit GetPIDValues( + const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) : asyncResp(asyncRespIn) {} diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index ca842d913d..8b97b7c79e 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -307,7 +307,7 @@ enum class LedState class InventoryItem { public: - InventoryItem(const std::string& objPath) : objectPath(objPath) + explicit InventoryItem(const std::string& objPath) : objectPath(objPath) { // Set inventory item name to last node of object path sdbusplus::message::object_path path(objectPath); diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp index b1b1d22fb3..dcad059655 100644 --- a/redfish-core/lib/task.hpp +++ b/redfish-core/lib/task.hpp @@ -39,7 +39,7 @@ constexpr bool completed = true; struct Payload { - Payload(const crow::Request& req) : + explicit Payload(const crow::Request& req) : targetUri(req.url), httpOperation(req.methodString()), httpHeaders(nlohmann::json::array()) |