Skip to content

Remove unreferenced private members#39

Open
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:cleanup/remove-dead-private-members
Open

Remove unreferenced private members#39
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:cleanup/remove-dead-private-members

Conversation

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor

Part of #38 (dead-code audit).

What

Remove 53 unreferenced private members flagged by the Roslyn analyzers (IDE0051 "unused
private member" plus the CS0169/CS0414 field diagnostics) — members with zero references
anywhere in the compilation:

  • DS4StateExposed: 27 implicitly-private pass-through property getters
    (bool Square { get { return _state.Square; } } …) — an abandoned partial "expose state"
    surface. The public API (Motion, etc.) is untouched.
  • Device classes (JoyConDevice, SwitchProDevice): dead named constants and an empty
    RunBluetoothSetup() stub.
  • Orphaned private helpers: Mapping.TValue / IfAxisIsNotModified / one dead EndMacro
    overload, ScpUtil.applyRatio (Color overload) / ClampInt / GetGyroOutModeString / …Type,
    Mouse.AddEmptyTrackballEntry, CurrentOutDeviceViewModel.DetermineDesired*,
    RecordBox.RevertListItemTemplate, and a few dead fields/constants (tempBusThread,
    macroEndIndex, prevBattery, DBT_DEVNODES_CHANGED, …).

Pure deletion — no behavior change.

Why

These are demonstrably dead: private scope makes the whole reference set the compilation
itself, and the analyzers report zero references. Removing them trims analyzer noise and dead
weight from the tree.

How verified

  • Diagnostics collected at build time (EnforceCodeStyleInBuild=true) over the full project.
  • Blast radius: x64 and x86 dotnet publish both succeed with zero compile errors — a
    wrongly-removed member would fail to compile. Each removal was additionally cross-checked
    against call sites (a name collision with a live Mapping.ClampInt in a different class was
    caught, and that method was kept).
  • Tests: DS4WindowsTests 11/12 pass — identical to untouched upstream/main. The single
    failure (CheckSettingsRead) is a pre-existing date-locale snapshot mismatch (Expected
    05/12 vs Actual 12/05), verified to fail identically on the unmodified baseline.

Build/test evidence (captured, branch f321b56, .NET 8 SDK 10.0.301, Windows)

RESTORE_EXIT=0
PUBLISH_X64_EXIT=0        # x64 dotnet publish — 0 compile errors
PUBLISH_X86_EXIT=0        # x86 dotnet publish — 0 compile errors
DS4WindowsTests (x64): Passed: 11, Failed: 1, Total: 12

The single test failure (CheckSettingsRead) fails identically on untouched
upstream/main (ba4bdcb): Expected:<05/12/2023 00:24:15> vs Actual:<12/05/2023 00:24:15> — a pre-existing en-GB date-locale snapshot mismatch, not introduced here.
For a pure-deletion change, "behavior unchanged" is the deliverable, and the clean
dual-platform compile + baseline-identical test result is the proof of it.

Scope

Deliberately limited to whole-declaration removals of unreferenced private members. Held
back for separate follow-ups: fields that are assigned-but-never-read (those need call-site
edits), and two members whose "unused" status looks like a latent wiring bug rather than cruft
(a commented-out auto-profile event subscription and an uncalled exclusive-mode failure
warning) — those are being raised separately rather than silently deleted.

Authored with Claude (Opus 4.8).

Roslyn analyzers (IDE0051/CS0169) flag 53 private members as never
referenced anywhere in the compilation. Remove them: the unused
pass-through getters in DS4StateExposed, dead named constants across
the device classes, and orphaned private helper methods. Pure
deletion, no behavior change.
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