Skip to content

refactor: clarify optional checks, reduce copies, and tighten macro scopes - #5936

Merged
ReenigneArcher merged 19 commits into
masterfrom
codex/sonar-explicit-types
Oct 15, 2026
Merged

ReenigneArcher merged 19 commits into
masterfrom
codex/sonar-explicit-types

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Description

Resolve 100 existing findings from the complete 814-finding master baseline at f86c4c9: 95 across 13 complete rule groups, plus the five Avahi error-description TODOs requested for this PR. Each rule cleanup is committed separately.

The changes clarify optional presence checks and template constraints, avoid redundant copies and ineffective moves, use keyed insertion without constructing duplicate entries, and improve macro scope, parameter names, comments, and switch layout. Existing enums and logging behavior are preserved. Avahi error comments now describe the DNS update errors and sentinel accurately. The Windows 10 API target is set before headers can select an SDK default, with a TODO to revisit the Windows 11 minimum target.

Rule Baseline findings Change
cpp:S959 16 Macro cleanup within the definition scope
cpp:S7172 14 Explicit optional presence checks
cpp:S6991 11 Platform directives outside gtest macro arguments
cpp:S6030 10 Keyed insertion with try_emplace
cpp:S1186 8 Explanations for intentionally empty hooks and callbacks
cpp:S125 7 Obsolete code fragments removed from comments
cpp:S5415 7 Ineffective moves removed
cpp:S1238 5 Large input parameters passed by const reference
cpp:S6195 5 Utility specializations expressed with requires clauses
cpp:S1117 4 Wayland parameters distinguished from stored state
cpp:S4524 3 Switch default groups placed last
cpp:S7032 3 Pairing lookup results declared in their branches
cpp:S6177 2 Local using-enum declarations for existing scoped enums
cpp:S1135 5 All error-description TODOs in src/platform/linux/publish.cpp completed

cpp:S5421 remains excluded. All 31 cpp:S3642 enum findings and 10 cpp:S6190 logging findings are deferred. The remaining cpp:S1135 findings outside the requested Avahi comments are outside this cleanup; the Windows target TODO is explicitly retained for later work.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

  • Follow-up preprocessor checks confirmed identical configuration tokens with and without DOXYGEN, and identical Windows header declarations for NTDDI_WIN10 versus 0x0A000000. The formatter, strict Doxygen, and diff checks passed again.
  • Required formatter and strict Doxygen validation passed, with zero documentation warnings. git diff --check passed.
  • UCRT64 build passed: cmake --build cmake-build-release --target sunshine test_sunshine sunshinesvc -j 4, including NVENC SDK 11.0, 12.0, 13.0, and 13.1.
  • Full gtest suite passed: 849 passed, 12 skipped, 0 failed (861 tests). Skips cover platform/hardware limits and the existing expected-failure external-command path.
  • The subsequent SDK callback signature correction rebuilt the changed test object and relinked test_sunshine using the existing UCRT64 compiler/link commands; all 26 focused NVENC tests passed.
  • gcov confirms all six changed pairing lookup/decoding statements executed. This is focused statement coverage, not a whole-patch or branch coverage claim.
  • Regression coverage covers duplicate configuration entries, mailbox reuse, const-reference type contracts, NVIDIA zero/absent restoration values, undo-file paths, preparation-command construction, packet byte-view lifetime, template sentinel selection, optional endian conversions, preset GUIDs and boundary fallbacks, colorspace fallback, and HTTP pairing-phase dispatch.

Comments, renames, local enum imports, and switch label placement preserve behavior and are checked through compilation, existing tests, focused mapping tests, and Doxygen. Hardware-dependent Linux capture and NVIDIA driver restoration cannot be fully exercised on this Windows host; no 100% whole-patch coverage claim is made.

Sonar analysis completed for 6c92ced with zero unintended introduced findings. The sole remaining PR finding is the explicitly requested cpp:S1135 Windows API-target TODO in src/platform/windows/misc.cpp; it is deliberately retained, so the quality gate is ERROR. All 100 implemented baseline sites have been reconciled with the source. PR-scoped analysis does not prove whole-branch rule closure.

Hosted platform checks for the follow-up head are still running; local validation is recorded above.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

This pull request was generated by Codex using GPT-6.1 Sol, extra high thinking level.

Resolve cpp:S6991 by constructing platform-specific parameter arrays before instantiating the test suites.
Resolve all 14 cpp:S7172 findings while preserving zero and negative property values. Cover zero versus absent NVIDIA undo values.
Resolve all five cpp:S1238 findings and enforce the public input-only signatures with compile-time regression checks.
Resolve all seven cpp:S125 findings, preserving useful explanations as prose or Doxygen documentation.
Resolve all ten cpp:S6030 findings and verify first-value configuration semantics and mailbox channel reuse.
@ReenigneArcher

Copy link
Copy Markdown
Member Author

This pull request was generated by Codex using GPT-6.1 Sol, extra high thinking level.

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.07692% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.48%. Comparing base (f86c4c9) to head (6c92ced).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/config.cpp 3.03% 30 Missing and 2 partials ⚠️
src/platform/linux/wayland.cpp 20.00% 16 Missing ⚠️
...tform/windows/nvprefs/nvapi_opensource_wrapper.cpp 0.00% 15 Missing ⚠️
src/platform/linux/kmsgrab.cpp 0.00% 8 Missing ⚠️
src/platform/common.h 57.14% 3 Missing ⚠️
src/stream.cpp 0.00% 1 Missing and 2 partials ⚠️
src/video.h 40.00% 3 Missing ⚠️
src/rtsp.cpp 0.00% 1 Missing and 1 partial ⚠️
src/nvhttp.cpp 90.00% 0 Missing and 1 partial ⚠️
src/platform/linux/misc.cpp 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5936      +/-   ##
==========================================
+ Coverage   45.21%   45.48%   +0.27%     
==========================================
  Files         139      139              
  Lines       30024    30067      +43     
  Branches    12965    12965              
==========================================
+ Hits        13574    13677     +103     
+ Misses      14599    13514    -1085     
- Partials     1851     2876    +1025     
Flag Coverage Δ
Alpine-aarch64 29.64% <31.88%> (+0.09%) ⬆️
Alpine-x86_64 29.75% <31.88%> (+0.09%) ⬆️
Archlinux 27.33% <31.42%> (+0.09%) ⬆️
FreeBSD-amd64 29.59% <30.50%> (+0.10%) ⬆️
Homebrew-macos-15 46.67% <36.00%> (+0.04%) ⬆️
Homebrew-macos-26 47.06% <40.00%> (+0.08%) ⬆️
Homebrew-ubuntu-24.04 30.73% <38.23%> (+0.07%) ⬆️
Linux-AppImage-aarch64 32.49% <40.57%> (+0.13%) ⬆️
Linux-AppImage-x86_64 32.73% <43.47%> (+0.13%) ⬆️
PowerShell 100.00% <ø> (ø)
Web-UI 56.65% <ø> (ø)
Windows-AMD64 38.73% <40.38%> (+0.60%) ⬆️
Windows-ARM64 32.90% <25.49%> (+0.44%) ⬆️
macOS-arm64 38.47% <43.33%> (+0.11%) ⬆️
macOS-x86_64 39.06% <43.33%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/config.h 65.00% <100.00%> (+46.25%) ⬆️
src/crypto.cpp 82.74% <ø> (ø)
src/nvhttp.h 96.15% <ø> (ø)
src/platform/linux/graphics.cpp 1.67% <ø> (ø)
src/platform/linux/graphics.h 0.00% <ø> (ø)
src/platform/linux/publish.cpp 0.00% <ø> (ø)
src/platform/linux/x11grab.cpp 45.97% <ø> (ø)
src/platform/windows/misc.cpp 34.52% <ø> (ø)
src/platform/windows/nvprefs/driver_settings.h 100.00% <ø> (ø)
src/platform/windows/nvprefs/undo_file.cpp 36.26% <100.00%> (+36.26%) ⬆️
... and 20 more

... and 24 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f86c4c9...6c92ced. Read the comment docs.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Last Updated 2026-10-15 16:03:25 UTC
Source Run CI Run #6308
Commit 6c92ced5d4c50f6a2ef951220bb3a156b20c4303

Screenshot Comparison

PR #5936 screenshots vs screenshots baseline.

Matrix: AppImage-aarch64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: AppImage-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-AMD64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-ARM64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-arm64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

@ReenigneArcher ReenigneArcher added this to the sonar milestone Oct 15, 2026
Resolve all 16 cpp:S959 findings by matching Doxygen macro guards, using explicit NVAPI return types, and removing the obsolete NTDDI override.
Complete the remaining two cpp:S7172 baseline findings in encoder options and Wayland plane export.
Resolve all seven cpp:S5415 findings without changing ownership contracts. Cover preparation-command values and non-owning packet replacement views with focused regression tests.
Preserve the existing Windows 10 API target without redefining NTDDI_VERSION after headers have selected declarations. Leave the requested TODO to revisit the Windows 11 minimum API target.
@ReenigneArcher ReenigneArcher changed the title refactor: resolve 104 Sonar findings across eight rules refactor: resolve 100 Sonar findings while preserving enums and logging Oct 15, 2026
@ReenigneArcher
ReenigneArcher force-pushed the codex/sonar-explicit-types branch from b60b500 to 756851c Compare October 15, 2026 13:53
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue
1 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ReenigneArcher ReenigneArcher changed the title refactor: resolve 100 Sonar findings while preserving enums and logging refactor: clarify optional checks, reduce copies, and tighten macro scopes Oct 15, 2026
@ReenigneArcher
ReenigneArcher merged commit c732a81 into master Oct 15, 2026
79 of 84 checks passed
@ReenigneArcher
ReenigneArcher deleted the codex/sonar-explicit-types branch October 15, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant