Skip to content

Commit 3c674d7

Browse files
Add Sonar config, remove NOSONAR thread tags
Add sonar-project.properties to set the Sonar project key and force C++17 for analysis. Remove inline NOSONAR suppressions on std::thread lambda usages in src/tray_qt.cpp and tests/unit/test_tray.cpp; the thread behavior is unchanged, only the comment-based suppressions were removed.
1 parent bf332f3 commit 3c674d7

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

sonar-project.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Sonar project analysis properties overrides
2+
sonar.projectKey=LizardByte_tray
3+
sonar.cfamily.reportingCppStandardOverride=c++17

src/tray_qt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace tray_qt {
100100
* @param timeout optional timeout for async run in ms
101101
*/
102102
void async_tray_notification_acknowledge_(const std::shared_ptr<notification_data> &notification, int timeout = 1000) {
103-
std::thread t([notification]() { // NOSONAR(cpp:S6168) - jthread is only available on C++20 onwards
103+
std::thread t([notification]() {
104104
std::scoped_lock lock(notification->mutex);
105105
if (notification->shown && notification->obj != nullptr && NOTIFY_IS_NOTIFICATION(notification->obj) && notify_notification_close(notification->obj, nullptr)) {
106106
notification->shown = false;
@@ -126,7 +126,7 @@ namespace tray_qt {
126126
* @param timeout optional timeout for async run in ms
127127
*/
128128
void async_tray_notification_show_(const std::shared_ptr<notification_data> &notification, int timeout = 1000) {
129-
std::thread t([notification]() { // NOSONAR(cpp:S6168) - jthread is only available on C++20 onwards
129+
std::thread t([notification]() {
130130
std::scoped_lock lock(notification->mutex);
131131
if (notification->obj != nullptr && NOTIFY_IS_NOTIFICATION(notification->obj) && notify_notification_show(notification->obj, nullptr)) {
132132
notification->shown = true;

tests/unit/test_tray.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class TrayTest: public BaseTest { // NOSONAR(cpp:S3656) - fixture members must
8686
// Capture a screenshot while the tray menu is open, then dismiss and exit.
8787
void captureMenuStateAndExit(const char *screenshotName) {
8888
std::atomic_bool exitRequested {false};
89-
std::thread capture_thread([this, screenshotName, &exitRequested]() { // NOSONAR(cpp:S6168) - std::jthread is unavailable on AppleClang 17/libc++ used in CI
89+
std::thread capture_thread([this, screenshotName, &exitRequested]() {
9090
EXPECT_TRUE(captureScreenshot(screenshotName));
9191
closeMenu();
9292
exitRequested.store(true, std::memory_order_release);

0 commit comments

Comments
 (0)