Skip to content

Commit

Permalink
#sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed May 9, 2024
1 parent b820c2c commit a2f7721
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
4 changes: 3 additions & 1 deletion include/libcyphal/transport/can/delegate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ class TransportDelegate
ServicePortRemoved
};

// NOSONAR below b/c Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
//
explicit TransportDelegate(cetl::pmr::memory_resource& memory)
: memory_{memory}
, canard_instance_(::canardInit(allocateMemoryForCanard, freeCanardMemory))
, canard_instance_{::canardInit(allocateMemoryForCanard, freeCanardMemory)} // NOSONAR
{
canard_instance().user_reference = this;
}
Expand Down
2 changes: 1 addition & 1 deletion include/libcyphal/transport/can/msg_rx_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MessageRxSession final : public IMessageRxSession, private IRxSessionDeleg
MessageRxSession(Spec, TransportDelegate& delegate, const MessageRxParams& params)
: delegate_{delegate}
, params_{params}
, subscription_{}
, subscription_{} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
{
const std::int8_t result = ::canardRxSubscribe(&delegate.canard_instance(),
CanardTransferKindMessage,
Expand Down
2 changes: 1 addition & 1 deletion include/libcyphal/transport/can/msg_tx_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MessageTxSession final : public IMessageTxSession
MessageTxSession(Spec, TransportDelegate& delegate, const MessageTxParams& params)
: delegate_{delegate}
, params_{params}
, send_timeout_{std::chrono::seconds{1}}
, send_timeout_{std::chrono::seconds{1}} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
{
}

Expand Down
2 changes: 1 addition & 1 deletion include/libcyphal/transport/can/svc_rx_sessions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SvcRxSession final : public Interface_, private IRxSessionDelegate
SvcRxSession(Spec, TransportDelegate& delegate, const Params& params)
: delegate_{delegate}
, params_{params}
, subscription_{}
, subscription_{} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
{
const int8_t result = ::canardRxSubscribe(&delegate.canard_instance(),
TransferKind,
Expand Down
4 changes: 2 additions & 2 deletions include/libcyphal/transport/can/svc_tx_sessions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SvcRequestTxSession final : public IRequestTxSession
SvcRequestTxSession(Spec, TransportDelegate& delegate, const RequestTxParams& params)
: delegate_{delegate}
, params_{params}
, send_timeout_{std::chrono::seconds{1}}
, send_timeout_{std::chrono::seconds{1}} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
{
}

Expand Down Expand Up @@ -162,7 +162,7 @@ class SvcResponseTxSession final : public IResponseTxSession
SvcResponseTxSession(Spec, TransportDelegate& delegate, const ResponseTxParams& params)
: delegate_{delegate}
, params_{params}
, send_timeout_{std::chrono::seconds{1}}
, send_timeout_{std::chrono::seconds{1}} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
{
}

Expand Down
6 changes: 3 additions & 3 deletions include/libcyphal/transport/can/transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ class TransportImpl final : public ICanTransport, private TransportDelegate
const CanardNodeID canard_node_id)
: TransportDelegate{memory}
, media_array_{std::move(media_array)}
, should_reconfigure_filters_{false}
, total_message_ports_{0}
, total_service_ports_{0}
, should_reconfigure_filters_{false} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
, total_message_ports_{0} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
, total_service_ports_{0} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
{
// TODO: Use it!
(void) multiplexer;
Expand Down
8 changes: 4 additions & 4 deletions include/libcyphal/transport/contiguous_payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class ContiguousPayload final
public:
ContiguousPayload(cetl::pmr::memory_resource& mr, const PayloadFragments payload_fragments)
: mr_{mr}
, payload_{nullptr}
, payload_size_{0}
, allocated_buffer_{nullptr}
, payload_{nullptr} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
, payload_size_{0} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
, allocated_buffer_{nullptr} // NOSONAR : Sonar's cpp:S134 conflicts with AUTOSAR A12-1-2
{
using Fragment = cetl::span<const cetl::byte>;

Expand Down Expand Up @@ -104,7 +104,7 @@ class ContiguousPayload final
private:
// MARK: Data members:

// Below nolint is to comply with AUTOSAR A11-0-2: in this class we do ALL initialization in the constructor.
// Below nolint is to comply with AUTOSAR A12-1-2: in this class we do ALL initialization in the constructor.
// NOLINTBEGIN(cppcoreguidelines-use-default-member-init,modernize-use-default-member-init)
cetl::pmr::memory_resource& mr_;
const cetl::byte* payload_;
Expand Down

0 comments on commit a2f7721

Please sign in to comment.