From 24cbf6f833fcd85f165322c8df6a484b21303569 Mon Sep 17 00:00:00 2001 From: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com> Date: Mon, 13 Jul 2026 17:31:55 -0400 Subject: [PATCH] chore(sonar): change NOSONAR comment style (#5410) --- src/config.cpp | 2 +- src/httpcommon.cpp | 5 ++--- src/nvhttp.cpp | 2 +- src/platform/linux/vaapi.cpp | 2 +- tests/unit/test_confighttp.cpp | 8 ++++---- tests/unit/test_process.cpp | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index e1dab3516..bca7d076b 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1004,7 +1004,7 @@ namespace config { * @param name Setting name. * @param output Parsed string list. */ - void string_list_f(std::unordered_map &vars, const std::string &name, std::vector &output) { // NOSONAR(cpp:S6045) - transparent hasher not available for unordered_map in this codebase + void string_list_f(std::unordered_map &vars, const std::string &name, std::vector &output) { // NOSONAR(cpp:S6045): transparent hasher not available for unordered_map in this codebase std::string temp; string_f(vars, name, temp); diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp index de261f5b9..e238afe23 100644 --- a/src/httpcommon.cpp +++ b/src/httpcommon.cpp @@ -207,8 +207,7 @@ namespace http { * @brief Send a static file response for a Web UI request. */ bool download_file(const std::string &url, const std::string &file, long ssl_version) { - // sonar complains about weak ssl and tls versions; however sonar cannot detect the fix - CURL *curl = curl_easy_init(); // NOSONAR + CURL *curl = curl_easy_init(); if (!curl) { BOOST_LOG(error) << "Couldn't create CURL instance"; return false; @@ -227,7 +226,7 @@ namespace http { return false; } - curl_easy_setopt(curl, CURLOPT_SSLVERSION, ssl_version); // NOSONAR + curl_easy_setopt(curl, CURLOPT_SSLVERSION, ssl_version); curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); diff --git a/src/nvhttp.cpp b/src/nvhttp.cpp index 585cc68e1..e260141a7 100644 --- a/src/nvhttp.cpp +++ b/src/nvhttp.cpp @@ -175,7 +175,7 @@ namespace nvhttp { std::atomic session_id_counter; ///< Monotonic counter used to allocate GameStream session IDs. // Set by TLS verify callback, read by launch/resume handler (single-threaded HTTPS server) - std::string last_verified_client_cert; ///< Last client certificate accepted by the TLS verify callback. // NOSONAR(cpp:S5421) - intentionally mutable global + std::string last_verified_client_cert; ///< Last client certificate accepted by the TLS verify callback. // NOSONAR(cpp:S5421): intentionally mutable global /** * @brief Case-insensitive map used for HTTP headers and query parameters. diff --git a/src/platform/linux/vaapi.cpp b/src/platform/linux/vaapi.cpp index 22843fe20..b00d7b2e3 100644 --- a/src/platform/linux/vaapi.cpp +++ b/src/platform/linux/vaapi.cpp @@ -749,7 +749,7 @@ namespace va { std::unique_ptr make_avcodec_encode_device(int width, int height, int offset_x, int offset_y, bool vram) { auto render_device = platf::resolve_render_device(); - file_t file = ::open(render_device.c_str(), O_RDWR); // NOSONAR(cpp:S1874) - `_sopen_s` not available + file_t file = ::open(render_device.c_str(), O_RDWR); // NOSONAR(cpp:S1874): `_sopen_s` not available if (file.el < 0) { char string[1024]; BOOST_LOG(error) << "Couldn't open "sv << render_device << ": " << strerror_r(errno, string, sizeof(string)); diff --git a/tests/unit/test_confighttp.cpp b/tests/unit/test_confighttp.cpp index 8516448ec..54a71b089 100644 --- a/tests/unit/test_confighttp.cpp +++ b/tests/unit/test_confighttp.cpp @@ -89,7 +89,7 @@ X4wnh1bwdiidqpcgyuKossLOPxbS786WmsesaAWPnpoY6M8aija+ALwNNuWWmyMg * * This fixture creates a real server to test the actual confighttp functions. */ -class ConfigHttpTest: public BaseTest { // NOSONAR(cpp:S3656) - protected members are intentional for test fixture subclassing +class ConfigHttpTest: public BaseTest { // NOSONAR(cpp:S3656): protected members are intentional for test fixture subclassing protected: std::unique_ptr> server; std::unique_ptr> client; @@ -132,7 +132,7 @@ protected: }; // Create test web directory in temp - test_web_dir = std::filesystem::temp_directory_path() / "sunshine_test_confighttp"; // NOSONAR(cpp:S5443) - safe for tests + test_web_dir = std::filesystem::temp_directory_path() / "sunshine_test_confighttp"; // NOSONAR(cpp:S5443): safe for tests std::filesystem::create_directories(test_web_dir / "web"); // Create test HTML file in WEB_DIR, creating parent directories with proper permissions @@ -753,14 +753,14 @@ TEST_F(ConfigHttpTest, GetLocaleReturnsJson) { * ├── file_beta.txt * └── test_exec[.exe] (executable file) */ -class BrowseDirectoryTest: public ConfigHttpTest { // NOSONAR(cpp:S3656) - protected members are intentional for test fixture subclassing +class BrowseDirectoryTest: public ConfigHttpTest { // NOSONAR(cpp:S3656): protected members are intentional for test fixture subclassing protected: std::filesystem::path browse_test_dir; void SetUp() override { ConfigHttpTest::SetUp(); - browse_test_dir = std::filesystem::temp_directory_path() / "sunshine_browse_test"; // NOSONAR(cpp:S5443) - safe for tests + browse_test_dir = std::filesystem::temp_directory_path() / "sunshine_browse_test"; // NOSONAR(cpp:S5443): safe for tests // Remove any leftover directory from a previous interrupted run if (std::filesystem::exists(browse_test_dir)) { diff --git a/tests/unit/test_process.cpp b/tests/unit/test_process.cpp index 0e4caf525..37265db69 100644 --- a/tests/unit/test_process.cpp +++ b/tests/unit/test_process.cpp @@ -19,7 +19,7 @@ protected: void SetUp() override { BaseTest::SetUp(); // Create test directory - test_dir = fs::temp_directory_path() / "sunshine_process_png_test"; // NOSONAR(cpp:S5443) - safe for tests + test_dir = fs::temp_directory_path() / "sunshine_process_png_test"; // NOSONAR(cpp:S5443): safe for tests fs::create_directories(test_dir); }