Skip to content

Commit

Permalink
eliminated deprecatd NOSONAR cpp:S4963 #verification #sonar #docs
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Dec 3, 2024
1 parent 5732518 commit 25be9de
Show file tree
Hide file tree
Showing 27 changed files with 30 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ class EpollSingleThreadedExecutor final : public libcyphal::platform::SingleThre
using Base = SingleThreadedExecutor;
using Self = EpollSingleThreadedExecutor;

/// No Sonar cpp:S4963 b/c `AwaitableNode` supports move operation.
///
class AwaitableNode final : public CallbackNode // NOSONAR cpp:S4963
class AwaitableNode final : public CallbackNode
{
public:
AwaitableNode(Self& executor, Callback::Function&& function)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ class PollSingleThreadedExecutor final : public libcyphal::platform::SingleThrea
DoubleLinkedNode* next_node;
};

/// No Sonar cpp:S4963 b/c `AwaitableNode` supports move operation.
///
class AwaitableNode final : public CallbackNode, public DoubleLinkedNode // NOSONAR cpp:S4963
class AwaitableNode final : public CallbackNode, public DoubleLinkedNode
{
public:
AwaitableNode(Self& executor, Callback::Function&& function, DoubleLinkedNode& origin_node)
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/application/node/get_info_provider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ namespace node
///
/// Internally, it uses the 'GetInfo' service server to handle incoming requests.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here (namely capturing of `this` in the request callback).
///
class GetInfoProvider final // NOSONAR cpp:S4963
class GetInfoProvider final
{
using Service = uavcan::node::GetInfo_1_0;

Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/application/node/heartbeat_producer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ namespace node
///
/// Internally, it uses the 'Heartbeat' message publisher to periodically publish heartbeat messages.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here (namely capturing of `this` in the periodic callback).
///
class HeartbeatProducer final // NOSONAR cpp:S4963
class HeartbeatProducer final
{
public:
/// @brief Defines the message type for the Heartbeat.
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/application/node/registry_provider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ namespace node
///
/// Internally, it uses the registry 'List' and 'Access' service servers to handle incoming requests.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here (namely capturing of `this` in the request callback).
///
class RegistryProvider final // NOSONAR cpp:S4963
class RegistryProvider final
{
using ListService = uavcan::_register::List_1_0;
using AccessService = uavcan::_register::Access_1_0;
Expand Down
4 changes: 1 addition & 3 deletions include/libcyphal/application/registry/register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ enum class SetError : std::uint8_t

/// Defines interface for a register.
///
/// NOSONAR cpp:S4963 for below `class IRegister` - protected destructor is necessary.
///
class IRegister : public cavl::Node<IRegister> // NOSONAR cpp:S4963
class IRegister : public cavl::Node<IRegister>
{
// 1AD1885B-954B-48CF-BAC4-FA0A251D3FC0
// clang-format off
Expand Down
8 changes: 3 additions & 5 deletions include/libcyphal/common/cavl/cavl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ class Tree;
/// The size of this type is 4x pointer size (16 bytes on a 32-bit platform).
///
/// No Sonar cpp:S1448 b/c this is the main node entity without public members - maintainability is not a concern here.
/// No Sonar cpp:S4963 b/c `Node` supports move operation.
///
template <typename Derived>
class Node // NOSONAR cpp:S1448 cpp:S4963
class Node // NOSONAR cpp:S1448
{
// Polyfill for C++17's std::invoke_result_t.
template <typename F, typename... Args>
Expand Down Expand Up @@ -954,8 +953,7 @@ class Tree final // NOSONAR cpp:S3624
/// the same call stack) we may occasionally fail to detect a bona fide case of a race condition, but this is
/// acceptable because the purpose of this feature is to provide a mere best-effort data race detection.
///
/// No Sonar cpp:S4963 b/c of the RAII pattern.
class TraversalIndicatorUpdater final // NOSONAR cpp:S4963
class TraversalIndicatorUpdater final
{
public:
explicit TraversalIndicatorUpdater(const Tree& sup) noexcept
Expand Down Expand Up @@ -994,7 +992,7 @@ class Tree final // NOSONAR cpp:S3624
// including the root node whos `up` points to this origin node (see `isRoot` method).
Node<Derived> origin_node_{};

// No Sonar cpp:S4963 b/c of implicit modification by the `TraversalIndicatorUpdater` RAII class,
// No Sonar cpp:S3687 b/c of implicit modification by the `TraversalIndicatorUpdater` RAII class,
// even for `const` instance of the `Tree` class (hence the `mutable volatile` keywords).
mutable volatile bool traversal_in_progress_ = false; // NOSONAR cpp:S3687
};
Expand Down
4 changes: 1 addition & 3 deletions include/libcyphal/platform/single_threaded_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ class SingleThreadedExecutor : public IExecutor
}

protected:
/// No Sonar cpp:S4963 b/c `CallbackNode` supports move operation.
///
class CallbackNode : public cavl::Node<CallbackNode>, public Callback::Interface // NOSONAR cpp:S4963
class CallbackNode : public cavl::Node<CallbackNode>, public Callback::Interface
{
public:
CallbackNode(SingleThreadedExecutor& executor, Callback::Function&& function)
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/presentation/client_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ class SharedClient : public cavl::Node<SharedClient>, public SharedObject

}; // TimeoutNode

/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here.
///
class CallbackNode : public Node<CallbackNode>, public TimeoutNode // NOSONAR cpp:S4963
class CallbackNode : public Node<CallbackNode>, public TimeoutNode
{
public:
CallbackNode(const CallbackNode&) = delete;
Expand Down
7 changes: 2 additions & 5 deletions include/libcyphal/presentation/presentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,9 @@ struct IsFixedPortIdMessageTrait<T, true>
/// @brief Defines the main presentation layer class.
///
/// Instance of this class is supposed to be created once per transport instance (or even per application).
/// Main purpose of the presentation object is to create publishers, subscribers, and RPC clients and servers.
/// The main purpose of the presentation object is to create publishers, subscribers, and RPC clients and servers.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here.
///
class Presentation final : private detail::IPresentationDelegate // NOSONAR cpp:S4963
class Presentation final : private detail::IPresentationDelegate
{
public:
/// @brief Defines failure type of various `make...` methods of the presentation layer.
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/presentation/publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ namespace detail

/// @brief Defines internal base class for any concrete (final) message publisher.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here.
///
class PublisherBase // NOSONAR cpp:S4963
class PublisherBase
{
public:
/// @brief Defines failure type for a base publisher operations.
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/presentation/response_promise.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,8 @@ using ResponsePromiseFailure = libcyphal::detail::AppendType< //
/// either a deserializable type (like a Nunavut tool generated service response struct),
/// or `transport::ScatteredBuffer` for raw bytes (aka untyped) responses.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here (like `client_impl_` retain/release etc.).
///
template <typename ResponsePayload, typename Failure>
class ResponsePromiseBase : public detail::SharedClient::CallbackNode // NOSONAR cpp:S4963
class ResponsePromiseBase : public detail::SharedClient::CallbackNode
{
public:
/// @brief Defines successful response and its metadata.
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/presentation/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ namespace detail

/// @brief Defines internal base class for any concrete (final) RPC server.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here.
///
class ServerBase : ServerImpl::Callback // NOSONAR cpp:S4963
class ServerBase : ServerImpl::Callback
{
public:
/// @brief Defines failure type for a base server operations.
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/presentation/subscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ namespace detail

/// @brief Defines internal base class for any concrete (final) message subscriber.
///
/// No Sonar cpp:S4963 'The "Rule-of-Zero" should be followed'
/// b/c we do directly handle resources here.
///
class SubscriberBase : public SubscriberImpl::CallbackNode // NOSONAR cpp:S4963
class SubscriberBase : public SubscriberImpl::CallbackNode
{
public:
/// @brief Defines failure type for a base subscriber operations.
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/transport/can/can_transport_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ namespace detail

/// @brief Represents final implementation class of the CAN transport.
///
/// NOSONAR cpp:S4963 for below `class TransportImpl` - we do directly handle resources here;
/// namely: in destructor we have to flush TX queues (otherwise there will be memory leaks).
///
class TransportImpl final : private TransportDelegate, public ICanTransport // NOSONAR cpp:S4963
class TransportImpl final : private TransportDelegate, public ICanTransport
{
/// @brief Defines private specification for making interface unique ptr.
///
Expand Down
4 changes: 1 addition & 3 deletions include/libcyphal/transport/can/delegate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class TransportDelegate
public:
/// @brief RAII class to manage memory allocated by Canard library.
///
/// NOSONAR cpp:S4963 for below `class CanardMemory` - we do directly handle resources here.
///
class CanardMemory final : public ScatteredBuffer::IStorage // NOSONAR cpp:S4963
class CanardMemory final : public ScatteredBuffer::IStorage
{
public:
CanardMemory(TransportDelegate& delegate,
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/transport/can/msg_rx_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ namespace detail

/// @brief A class to represent a message subscriber RX session.
///
/// NOSONAR cpp:S4963 for below `class MessageRxSession` - we do directly handle resources here;
/// namely: in destructor we have to unsubscribe, as well as let transport delegate to know this fact.
///
class MessageRxSession final : IRxSessionDelegate, public IMessageRxSession // NOSONAR cpp:S4963
class MessageRxSession final : IRxSessionDelegate, public IMessageRxSession
{
/// @brief Defines private specification for making interface unique ptr.
///
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/transport/can/svc_rx_sessions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ namespace detail
/// @tparam TransferKind Kind of the service transfer.
/// Could be either `CanardTransferKindRequest` or `CanardTransferKindResponse`.
///
/// NOSONAR cpp:S4963 for below `class SvcRxSession` - we do directly handle resources here;
/// namely: in destructor we have to unsubscribe, as well as let transport delegate to know this fact.
///
template <typename Interface_, typename Params, CanardTransferKind TransferKind>
class SvcRxSession final : IRxSessionDelegate, public Interface_ // NOSONAR cpp:S4963
class SvcRxSession final : IRxSessionDelegate, public Interface_
{
/// @brief Defines private specification for making interface unique ptr.
///
Expand Down
2 changes: 1 addition & 1 deletion include/libcyphal/transport/contiguous_payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace detail
/// Probably could be deleted when libcanard will start support fragmented payloads (at `canardTxPush`).
/// See https://github.com/OpenCyphal/libcanard/issues/223
///
class ContiguousPayload final // NOSONAR : cpp:S4963 - we do directly handle resources here.
class ContiguousPayload final
{
public:
ContiguousPayload(cetl::pmr::memory_resource& mr, const PayloadFragments payload_fragments)
Expand Down
2 changes: 1 addition & 1 deletion include/libcyphal/transport/media_payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace transport
/// In use to pass payload data between the transport layer and its media.
/// It also manages memory ownership of the allocated payload buffer.
///
class MediaPayload final // NOSONAR : cpp:S4963 - we do directly handle resources here.
class MediaPayload final
{
public:
/// Constructs a new empty payload.
Expand Down
2 changes: 1 addition & 1 deletion include/libcyphal/transport/scattered_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace transport
/// The buffer is movable but not copyable because copying the contents of a buffer is considered wasteful.
/// The buffer behaves as if it's empty if the underlying implementation is moved away.
///
class ScatteredBuffer final // NOSONAR : cpp:S4963 - we do directly handle resources here.
class ScatteredBuffer final
{
public:
/// @brief Defines maximum size (aka footprint) of the storage variant.
Expand Down
4 changes: 1 addition & 3 deletions include/libcyphal/transport/udp/delegate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ class TransportDelegate
public:
/// @brief RAII class to manage memory allocated by Udpard library.
///
/// NOSONAR cpp:S4963 for below `class UdpardMemory` - we do directly handle resources here.
///
class UdpardMemory final : public ScatteredBuffer::IStorage // NOSONAR cpp:S4963
class UdpardMemory final : public ScatteredBuffer::IStorage
{
public:
UdpardMemory(TransportDelegate& delegate, UdpardRxTransfer& transfer)
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/transport/udp/msg_rx_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ namespace detail

/// @brief A class to represent a message subscriber RX session.
///
/// NOSONAR cpp:S4963 for below `class MessageRxSession` - we do directly handle resources here;
/// namely: in destructor we have to unsubscribe, as well as let transport delegate to know this fact.
///
class MessageRxSession final : IMsgRxSessionDelegate, public IMessageRxSession // NOSONAR cpp:S4963
class MessageRxSession final : IMsgRxSessionDelegate, public IMessageRxSession
{
/// @brief Defines private specification for making interface unique ptr.
///
Expand Down
4 changes: 1 addition & 3 deletions include/libcyphal/transport/udp/session_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ struct SocketState

/// @brief Defines a tree of sessions for the UDP transport.
///
/// No Sonar cpp:S4963 b/c we do directly handle resources here.
///
template <typename Node>
class SessionTree final // NOSONAR cpp:S4963
class SessionTree final
{
public:
using NodeRef = typename Node::ReferenceWrapper;
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/transport/udp/svc_rx_sessions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ namespace detail
/// @tparam Params Type of the session parameters.
/// Could be either `RequestRxParams` or `ResponseRxParams`.
///
/// NOSONAR cpp:S4963 for below `class SvcRxSession` - we do directly handle resources here;
/// namely: in destructor we have to unsubscribe, as well as let transport delegate to know this fact.
///
template <typename Interface_, typename Params, typename SessionEvent, bool IsRequest>
class SvcRxSession final : IRxSessionDelegate, public Interface_ // NOSONAR cpp:S4963
class SvcRxSession final : IRxSessionDelegate, public Interface_
{
/// @brief Defines private specification for making interface unique ptr.
///
Expand Down
5 changes: 1 addition & 4 deletions include/libcyphal/transport/udp/udp_transport_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ namespace detail

/// @brief Represents final implementation class of the UDP transport.
///
/// NOSONAR cpp:S4963 for below `class TransportImpl` - we do directly handle resources here;
/// namely: in destructor we have to flush TX queues (otherwise there will be memory leaks).
///
class TransportImpl final : private TransportDelegate, public IUdpTransport // NOSONAR cpp:S4963
class TransportImpl final : private TransportDelegate, public IUdpTransport
{
/// @brief Defines private specification for making interface unique ptr.
///
Expand Down
4 changes: 1 addition & 3 deletions test/unittest/virtual_time_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ class VirtualTimeScheduler final : public platform::SingleThreadedExecutor
using Self = VirtualTimeScheduler;
using Base = SingleThreadedExecutor;

/// No Sonar cpp:S4963 b/c `AwaitableNode` supports move operation.
///
class NamedCallbackNode final : public CallbackNode // NOSONAR cpp:S4963
class NamedCallbackNode final : public CallbackNode
{
public:
NamedCallbackNode(Self& executor, Callback::Function&& function, std::string name)
Expand Down

0 comments on commit 25be9de

Please sign in to comment.