From b8d8b55a3752a3dfb2e5ba0bf20adc4c3ea2e96b Mon Sep 17 00:00:00 2001 From: Sergei Shirokov Date: Tue, 3 Dec 2024 11:32:06 +0200 Subject: [PATCH] sonar fixes #verification #sonar #docs --- include/libcyphal/application/node/get_info_provider.hpp | 6 +++++- include/libcyphal/application/node/heartbeat_producer.hpp | 6 +++++- include/libcyphal/application/node/registry_provider.hpp | 6 +++++- include/libcyphal/transport/can/msg_rx_session.hpp | 2 +- include/libcyphal/transport/can/svc_rx_sessions.hpp | 2 +- include/libcyphal/transport/udp/msg_rx_session.hpp | 2 +- include/libcyphal/transport/udp/svc_rx_sessions.hpp | 2 +- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/libcyphal/application/node/get_info_provider.hpp b/include/libcyphal/application/node/get_info_provider.hpp index 368ad5199..dd1ed6f35 100644 --- a/include/libcyphal/application/node/get_info_provider.hpp +++ b/include/libcyphal/application/node/get_info_provider.hpp @@ -32,7 +32,11 @@ namespace node /// /// Internally, it uses the 'GetInfo' service server to handle incoming requests. /// -class GetInfoProvider final +/// No Sonar cpp:S3624 "Customize this class' destructor to participate in resource management." +/// We need custom move constructor to reset up the request callback, +/// but at the destructor level, we don't need to do anything. +/// +class GetInfoProvider final // NOSONAR cpp:S3624 { using Service = uavcan::node::GetInfo_1_0; diff --git a/include/libcyphal/application/node/heartbeat_producer.hpp b/include/libcyphal/application/node/heartbeat_producer.hpp index 188d2d077..95c36d182 100644 --- a/include/libcyphal/application/node/heartbeat_producer.hpp +++ b/include/libcyphal/application/node/heartbeat_producer.hpp @@ -34,7 +34,11 @@ namespace node /// /// Internally, it uses the 'Heartbeat' message publisher to periodically publish heartbeat messages. /// -class HeartbeatProducer final +/// No Sonar cpp:S3624 "Customize this class' destructor to participate in resource management." +/// We need custom move constructor to reset up the publishing callback, +/// but at the destructor level, we don't need to do anything. +/// +class HeartbeatProducer final // NOSONAR cpp:S3624 { public: /// @brief Defines the message type for the Heartbeat. diff --git a/include/libcyphal/application/node/registry_provider.hpp b/include/libcyphal/application/node/registry_provider.hpp index 38b903f93..109fe6578 100644 --- a/include/libcyphal/application/node/registry_provider.hpp +++ b/include/libcyphal/application/node/registry_provider.hpp @@ -30,7 +30,11 @@ namespace node /// /// Internally, it uses the registry 'List' and 'Access' service servers to handle incoming requests. /// -class RegistryProvider final +/// No Sonar cpp:S3624 "Customize this class' destructor to participate in resource management." +/// We need custom move constructor to reset up the request callback, +/// but at the destructor level, we don't need to do anything. +/// +class RegistryProvider final // NOSONAR cpp:S3624 { using ListService = uavcan::_register::List_1_0; using AccessService = uavcan::_register::Access_1_0; diff --git a/include/libcyphal/transport/can/msg_rx_session.hpp b/include/libcyphal/transport/can/msg_rx_session.hpp index 17998a940..689954ac4 100644 --- a/include/libcyphal/transport/can/msg_rx_session.hpp +++ b/include/libcyphal/transport/can/msg_rx_session.hpp @@ -38,7 +38,7 @@ namespace detail /// @brief A class to represent a message subscriber RX session. /// -class MessageRxSession final : IRxSessionDelegate, public IMessageRxSession +class MessageRxSession final : private IRxSessionDelegate, public IMessageRxSession { /// @brief Defines private specification for making interface unique ptr. /// diff --git a/include/libcyphal/transport/can/svc_rx_sessions.hpp b/include/libcyphal/transport/can/svc_rx_sessions.hpp index f9c339696..818023561 100644 --- a/include/libcyphal/transport/can/svc_rx_sessions.hpp +++ b/include/libcyphal/transport/can/svc_rx_sessions.hpp @@ -45,7 +45,7 @@ namespace detail /// Could be either `CanardTransferKindRequest` or `CanardTransferKindResponse`. /// template -class SvcRxSession final : IRxSessionDelegate, public Interface_ +class SvcRxSession final : private IRxSessionDelegate, public Interface_ { /// @brief Defines private specification for making interface unique ptr. /// diff --git a/include/libcyphal/transport/udp/msg_rx_session.hpp b/include/libcyphal/transport/udp/msg_rx_session.hpp index 95e755eba..6b5311eee 100644 --- a/include/libcyphal/transport/udp/msg_rx_session.hpp +++ b/include/libcyphal/transport/udp/msg_rx_session.hpp @@ -38,7 +38,7 @@ namespace detail /// @brief A class to represent a message subscriber RX session. /// -class MessageRxSession final : IMsgRxSessionDelegate, public IMessageRxSession +class MessageRxSession final : private IMsgRxSessionDelegate, public IMessageRxSession { /// @brief Defines private specification for making interface unique ptr. /// diff --git a/include/libcyphal/transport/udp/svc_rx_sessions.hpp b/include/libcyphal/transport/udp/svc_rx_sessions.hpp index a90b0b062..d2777327c 100644 --- a/include/libcyphal/transport/udp/svc_rx_sessions.hpp +++ b/include/libcyphal/transport/udp/svc_rx_sessions.hpp @@ -43,7 +43,7 @@ namespace detail /// Could be either `RequestRxParams` or `ResponseRxParams`. /// template -class SvcRxSession final : IRxSessionDelegate, public Interface_ +class SvcRxSession final : private IRxSessionDelegate, public Interface_ { /// @brief Defines private specification for making interface unique ptr. ///