fix(ci): enable clang-tidy bugprone-unhandled-self-assignment / cert-oop54-cpp (#26767)

Signed-off-by: kuralme <kuralme@protonmail.com>
This commit is contained in:
Ege Kural 2026-03-16 17:59:06 -04:00 committed by GitHub
parent ed58a83a5c
commit 113853f631
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 3 deletions

View File

@ -141,8 +141,6 @@ Checks: '*,
-cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-goto,
-hicpp-avoid-goto, -hicpp-avoid-goto,
-bugprone-branch-clone, -bugprone-branch-clone,
-bugprone-unhandled-self-assignment,
-cert-oop54-cpp,
-performance-enum-size, -performance-enum-size,
-readability-avoid-nested-conditional-operator, -readability-avoid-nested-conditional-operator,
-cppcoreguidelines-prefer-member-initializer, -cppcoreguidelines-prefer-member-initializer,

View File

@ -92,6 +92,11 @@ public:
// copy assignment // copy assignment
Subscription &operator=(const Subscription &other) Subscription &operator=(const Subscription &other)
{ {
// Check for self-assignment
if (this == &other) {
return *this;
}
unsubscribe(); unsubscribe();
_orb_id = other._orb_id; _orb_id = other._orb_id;
_instance = other._instance; _instance = other._instance;

View File

@ -87,6 +87,11 @@ public:
void operator=(const LatLonAlt &lla) void operator=(const LatLonAlt &lla)
{ {
// Protect against self-assignment
if (this == &lla) {
return;
}
_latitude_rad = lla.latitude_rad(); _latitude_rad = lla.latitude_rad();
_longitude_rad = lla.longitude_rad(); _longitude_rad = lla.longitude_rad();
_altitude = lla.altitude(); _altitude = lla.altitude();

View File

@ -59,6 +59,11 @@ public:
// Separate function needed otherwise the default copy constructor matches before the deep copy implementation // Separate function needed otherwise the default copy constructor matches before the deep copy implementation
Self &operator=(const Self &other) Self &operator=(const Self &other)
{ {
// Protect against self-assignment
if (this == &other) {
return *this;
}
return this->operator=<M, N>(other); return this->operator=<M, N>(other);
} }

View File

@ -62,7 +62,7 @@ public:
} }
} }
void fuseBias(Vector2f bias, Vector2f bias_var) void fuseBias(const Vector2f &bias, const Vector2f &bias_var)
{ {
if ((_sensor_ref != _sensor) && _is_sensor_fusion_active) { if ((_sensor_ref != _sensor) && _is_sensor_fusion_active) {
_bias[0].fuseBias(bias(0), bias_var(0)); _bias[0].fuseBias(bias(0), bias_var(0));