Skip to content

Remove Unreachable Branches and Unused Members Found by Coverage - #1189

Merged
ptr727 merged 2 commits into
developfrom
feature/remove-unused-code
Nov 3, 2026
Merged

ptr727 merged 2 commits into
developfrom
feature/remove-unused-code

Conversation

@ptr727

@ptr727 ptr727 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Removes code that no input reaches or that has no caller, as found by the coverage work (#1171). Behavior is unchanged. This is the work #1185 tracks.

Removed:

  • TrackProps.SetLanguage:
    • The GetIetfFromIso empty-result branch. GetIetfFromIso always returns a value, und for an unknown tag.
    • SetLanguage now returns void, since it never returned false, and Create's guard on it is gone.
    • The two GetIsoFromIetf empty-result branches stay. GetIsoFromIetf returns null for an IETF tag whose ISO 639-3 language has no ISO 639-2 code, such as pcm. A new theory covers both branches.
  • TrackProps.GetFlags(), the no-argument overload.
  • MediaProps.RemoveCoverArt(). Cover art removal runs through ProcessFile.RemoveCoverArt(ref bool) and ProcessDriver.
  • SidecarFile.IsSidecarFile(string) and GetMkvName(string). The FileInfo overloads are the ones in use.
  • MediaTool.LogFailedResult(int, string, string, string). Every caller uses the BufferedCommandResult overload.
  • Builder members with no caller, matched by argument shape:
    • HandBrake: input seek, and the three-argument output Add.
    • FfMpeg: Progress, input and output seek, NoVideo, MapMetadata.
    • MkvMerge: output seek and TestSnippets.
    • FfProbe: Format, Input, seek, QuickScan.

Plugins use none of the removed members, and the plugin loader looks only for IProcessPlugin. README "Process Plugins" already says the public API a plugin calls can change in any release.

The comments label is on because one existing comment line, "ReMux will conditionally check for SetIetfLanguageTags", is re-indented.

Local strict review: the first pass raised 1 finding. My premise that the language lookup never returns empty was wrong for GetIsoFromIetf. I confirmed it with a probe, restored those branches, and added a test. The second pass raised none.

Verification: the .NET Format chain is clean, and the unit suite passes (540 tests).

🤖 Generated with Claude Code

ptr727 and others added 2 commits November 2, 2026 18:54
The coverage work found code no input reaches. The language lookup
returns "und" for an unknown tag and never an empty string, so the
empty-lookup branches in TrackProps.SetLanguage never ran, and
SetLanguage never failed. The builder seek, metadata, format, and input
overloads, the unused LogFailedResult overload, the string overloads of
SidecarFile.IsSidecarFile and GetMkvName, MediaProps.RemoveCoverArt, and
TrackProps.GetFlags() have no caller. Behavior is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GetIsoFromIetf returns null for an IETF tag whose ISO 639-3 language has
no ISO 639-2 code, such as pcm, so its empty-result branches do run.
Only GetIetfFromIso always returns a value. Restore the two ISO branches
and cover them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 3, 2026
Copilot AI lite review requested due to automatic review settings November 3, 2026 03:07
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: cd98ee04-8087-481e-b984-fe662197badf
Commits

Reviewing files that changed from the base of the PR and between d778eb4 and 889434d.

Files selected for processing: 9
  • PlexCleaner/FfMpegBuilder.cs
  • PlexCleaner/FfProbeBuilder.cs
  • PlexCleaner/HandBrakeBuilder.cs
  • PlexCleaner/MediaProps.cs
  • PlexCleaner/MediaTool.cs
  • PlexCleaner/MkvMergeBuilder.cs
  • PlexCleaner/SidecarFile.cs
  • PlexCleaner/TrackProps.cs
  • PlexCleanerTests/TrackPropsCreateTests.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@ptr727

ptr727 commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 889434ddee391c8629d0bdead37a2eac23326815, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Remove unused members and unreachable language branch

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Remove unused builder methods, overloads, and cover-art helpers identified during coverage work.
• Simplify track language handling without changing its reachable behavior.
• Test both reachable ISO lookup failure paths.
Diagram

graph TD
  Processing["Media processing"] --> Builders["Command builders"] --> Tools["Media tools"] --> Parsed["Parsed tracks"] --> Track["Track properties"] --> Lookup["Language lookup"]
  Tests["Regression tests"] --> Track
Loading
High-Level Assessment

Direct removal is appropriate for members with no callers and no plugin use. Retaining compatibility shims would preserve unused API surface; the PR keeps the reachable ISO lookup checks and tests them.

Files changed (9) +45 / -204

Refactor (8) +15 / -204
FfMpegBuilder.csRemove unused FFmpeg builder options +0/-33

Remove unused FFmpeg builder options

• Removes unused progress, seek, no-video, and metadata-mapping methods. The builder methods still used to construct commands remain.

PlexCleaner/FfMpegBuilder.cs

FfProbeBuilder.csRemove unused FFprobe builder options +0/-22

Remove unused FFprobe builder options

• Removes unused format, input, seek-start, and quick-scan methods while retaining the used interval options.

PlexCleaner/FfProbeBuilder.cs

HandBrakeBuilder.csRemove unused HandBrake builder methods +0/-16

Remove unused HandBrake builder methods

• Removes input seek helpers and the unused conditional output Add overload.

PlexCleaner/HandBrakeBuilder.cs

MediaProps.csRemove unused cover-art removal method +0/-30

Remove unused cover-art removal method

• Deletes MediaProps.RemoveCoverArt; cover-art removal remains handled through ProcessFile.

PlexCleaner/MediaProps.cs

MediaTool.csRemove unused failure-logging overload +0/-33

Remove unused failure-logging overload

• Deletes the exit-code and stderr overload of LogFailedResult. The BufferedCommandResult overload remains.

PlexCleaner/MediaTool.cs

MkvMergeBuilder.csRemove unused MKV merge split helpers +0/-19

Remove unused MKV merge split helpers

• Removes output seek methods and TestSnippets, which had no callers.

PlexCleaner/MkvMergeBuilder.cs

SidecarFile.csRemove unused string-based sidecar overloads +0/-6

Remove unused string-based sidecar overloads

• Deletes the string overloads of IsSidecarFile and GetMkvName; the FileInfo overloads remain.

PlexCleaner/SidecarFile.cs

TrackProps.csSimplify language handling and remove unused flag enumeration +15/-45

Simplify language handling and remove unused flag enumeration

• Makes SetLanguage return void and removes its unreachable empty-result branch for ISO-to-IETF lookup. Retains both reachable IETF-to-ISO lookup failure branches and removes the unused parameterless GetFlags overload.

PlexCleaner/TrackProps.cs

Tests (1) +30 / -0
TrackPropsCreateTests.csCover IETF tags without an ISO equivalent +30/-0

Cover IETF tags without an ISO equivalent

• Adds a theory for 'pcm' with empty and 'und' ISO language values, verifying both lookup failure paths, remux action, and error logging. Marks the test class sequential for log capture.

PlexCleanerTests/TrackPropsCreateTests.cs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain, and the changes are narrowly scoped to removing unreachable or unused code while adding regression coverage for unmappable language tags.

No open issues 🎉

What changed in this PR

This pull request removes unreachable branches and unused members identified through coverage analysis while preserving existing behavior. It also adds regression coverage for IETF language tags without ISO 639-2 equivalents.

Changes:

  • Simplifies TrackProps.SetLanguage and removes its ineffective return-value guard.
  • Adds theory coverage for unmappable IETF language tags.
  • Removes unused sidecar, media, logging, and command-builder members.
  • Serializes logging-sensitive tests.
File Description
PlexCleanerTests/​TrackPropsCreateTests.cs Adds coverage for unmappable IETF language tags and serializes logging-sensitive tests.
PlexCleaner/​TrackProps.cs Removes unreachable language handling and the unused flags overload.
PlexCleaner/​SidecarFile.cs Removes unused string-based sidecar helper overloads.
PlexCleaner/​MkvMergeBuilder.cs Removes unused output seek and snippet helpers.
PlexCleaner/​MediaTool.cs Removes the unused string-based failure logging overload.
PlexCleaner/​MediaProps.cs Removes the unused cover-art removal method.
PlexCleaner/​HandBrakeBuilder.cs Removes unused input seek and three-argument output helpers.
PlexCleaner/​FfProbeBuilder.cs Removes unused format, input, seek, and quick-scan helpers.
PlexCleaner/​FfMpegBuilder.cs Removes unused progress, seek, video, and metadata helpers.

Review effort: Lite

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants