Skip to content

Conversation

@mapitman
Copy link
Owner

Closes #18

This PR reorganizes the codebase from a flat structure into logical folders with matching namespaces.

Folder Structure

Main Project (src/RipSharp)

  • Core/: Program.cs, AppConfig.cs, RipOptions.cs, appsettings.yaml
  • Abstractions/: All interface files (11 interfaces)
  • Services/: DiscRipper, DiscScanner, DiscTypeDetector, EncoderService, ProcessRunner
  • Metadata/: MetadataService, metadata providers, TitleVariationGenerator
  • MakeMkv/: MakeMkv integration classes
  • Models/: DiscInfo, TitleInfo, MediaStream, ContentMetadata, MediaFileAnalysis
  • Utilities/: FileNaming, DurationFormatter, console helpers

Test Project (src/RipSharp.Tests)

Mirrored folder structure:

  • Core/: RipOptionsTests
  • Metadata/: MetadataServiceTests, provider tests, TitleVariationGenerator tests
  • MakeMkv/: MakeMkvProtocolTests
  • Services/: DiscTypeDetectorTests
  • Utilities/: FileNamingTests, DurationFormatterTests

Key Changes

Code Organization

  • Updated all namespace declarations to match folder structure (RipSharp.{Folder})
  • Added GlobalUsings.cs to both main and test projects for cleaner imports
  • All file moves done with git mv to preserve history

Model Renaming (Better Clarity)

  • MetadataInfoContentMetadata (metadata about media content)
  • StreamInfoMediaStream (audio/video/subtitle stream)
  • FileAnalysisMediaFileAnalysis (media file analysis)

Test Improvements

  • Converted all xUnit Assert.* calls to AwesomeAssertions fluent syntax
  • Added global using for AwesomeAssertions in test GlobalUsings.cs
  • Organized test files to mirror main project structure

Verification

  • ✅ Solution builds successfully
  • ✅ All 112 tests pass
  • ✅ No functional changes, purely organizational refactoring

- Created folder structure: Core, Abstractions, Services, Metadata, MakeMkv, Models, Utilities
- Updated all namespace declarations to match folder structure
- Renamed Metadata class to MetadataInfo to avoid namespace conflict
- Added GlobalUsings.cs to both main and test projects for cleaner imports
- All 112 tests pass successfully
- No functional changes, purely organizational refactoring
- MetadataInfo → ContentMetadata (metadata about media content)
- StreamInfo → MediaStream (audio/video/subtitle stream)
- FileAnalysis → MediaFileAnalysis (media file analysis)

All 112 tests pass successfully
Mirrored main project structure:
- Core/: RipOptionsTests
- Metadata/: MetadataServiceTests, provider tests, TitleVariationGenerator tests
- MakeMkv/: MakeMkvProtocolTests
- Services/: DiscTypeDetectorTests
- Utilities/: FileNamingTests, DurationFormatterTests

Updated namespaces to match folder structure.
All 112 tests pass successfully.
Replaced xUnit Assert.* calls with fluent AwesomeAssertions syntax:
- Assert.True/False → .Should().BeTrue/BeFalse()
- Assert.Equal → .Should().Equal()
- Assert.Contains → .Should().Contain()
- Assert.Null → .Should().BeNull()
- Assert.True(x >= y) → .Should().BeGreaterThanOrEqualTo()
- Assert.True(x <= y) → .Should().BeLessThanOrEqualTo()
- Assert.True(x > y) → .Should().BeGreaterThan()
- Assert.True(range) → .Should().BeInRange()

Added global using for AwesomeAssertions in test GlobalUsings.cs.
All 112 tests pass successfully.
Removed Arrange/Act/Assert comments as they were adding clutter
without providing significant value.

All 112 tests pass successfully.
Copilot AI review requested due to automatic review settings January 11, 2026 19:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reorganizes the RipSharp codebase from a flat structure into a logical folder hierarchy with matching namespaces, improving code organization and maintainability. The refactoring includes model renames for better clarity and test improvements using fluent assertions.

Changes:

  • Organized code into logical folders (Core, Abstractions, Services, Metadata, MakeMkv, Models, Utilities) with matching namespaces
  • Renamed models for clarity: MetadataInfo → ContentMetadata, StreamInfo → MediaStream, FileAnalysis → MediaFileAnalysis
  • Added GlobalUsings.cs files to both projects for cleaner imports, converted test assertions to AwesomeAssertions fluent syntax, and added .editorconfig for consistent code formatting

Reviewed changes

Copilot reviewed 55 out of 56 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/RipSharp/Utilities/FileNaming.cs Updated namespace to RipSharp.Utilities, changed parameter type from Metadata to ContentMetadata?
src/RipSharp/Utilities/DurationFormatter.cs Updated namespace to RipSharp.Utilities
src/RipSharp/Utilities/ConsoleUserPrompt.cs Updated namespace to RipSharp.Utilities, cleaned up trailing whitespace
src/RipSharp/Utilities/ConsoleProgressNotifier.cs Updated namespace to RipSharp.Utilities
src/RipSharp/Utilities/ConsoleColors.cs Updated namespace to RipSharp.Utilities
src/RipSharp/Services/ProcessRunner.cs Updated namespace to RipSharp.Services
src/RipSharp/Services/EncoderService.cs Updated namespace to RipSharp.Services, renamed StreamInfo to MediaStream and FileAnalysis to MediaFileAnalysis, made local function static
src/RipSharp/Services/DiscTypeDetector.cs Updated namespace to RipSharp.Services, cleaned up trailing whitespace
src/RipSharp/Services/DiscScanner.cs Updated namespace to RipSharp.Services
src/RipSharp/Services/DiscRipper.cs Updated namespace to RipSharp.Services, renamed Metadata to ContentMetadata, organized imports
src/RipSharp/Models/TitleInfo.cs Updated namespace to RipSharp.Models
src/RipSharp/Models/MediaStream.cs Updated namespace to RipSharp.Models, renamed class from StreamInfo to MediaStream
src/RipSharp/Models/MediaFileAnalysis.cs New file with namespace RipSharp.Models, renamed from FileAnalysis
src/RipSharp/Models/DiscInfo.cs Updated namespace to RipSharp.Models, cleaned up trailing whitespace
src/RipSharp/Models/ContentMetadata.cs Updated namespace to RipSharp.Models, renamed class from Metadata to ContentMetadata
src/RipSharp/Metadata/*.cs Updated all metadata-related files to RipSharp.Metadata namespace, renamed Metadata to ContentMetadata
src/RipSharp/MakeMkv/*.cs Updated all MakeMkv-related files to RipSharp.MakeMkv namespace
src/RipSharp/GlobalUsings.cs Added global using directives for all namespaces
src/RipSharp/Core/*.cs Updated all core files to RipSharp.Core namespace, cleaned up formatting
src/RipSharp/Abstractions/*.cs Moved all interface files to Abstractions folder with RipSharp.Abstractions namespace
src/RipSharp.Tests/**/*.cs Updated test file namespaces to mirror main project structure, converted xUnit Assert to AwesomeAssertions fluent syntax
src/RipSharp.Tests/GlobalUsings.cs Added global using directives for test files including AwesomeAssertions
.editorconfig Added comprehensive C# code style and formatting rules
Comments suppressed due to low confidence (3)

src/RipSharp/Services/DiscRipper.cs:49

  • The error message contains "ContentMetadata?" which appears to be a copy-paste error. The question mark from the type annotation should not be part of the error message. It should read "Metadata lookup failed" or "Content metadata lookup failed" instead.
    src/RipSharp/Utilities/FileNaming.cs:17
  • The parameter type was changed from ContentMetadata to ContentMetadata?, making it nullable, but the method body immediately dereferences it on line 17 without null checking (metadata.Title). This will throw a NullReferenceException if null is passed. Either add null checking in the method body or keep the parameter as non-nullable since the caller already uses the null-forgiving operator.
    src/RipSharp/Services/EncoderService.cs:52
  • This foreach loop immediately maps its iteration variable to another variable - consider mapping the sequence explicitly using '.Select(...)'.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mapitman mapitman merged commit 1719df3 into main Jan 11, 2026
7 checks passed
@mapitman mapitman deleted the feature/organize-folders-namespaces branch January 11, 2026 19:04
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.

Organize code into logical folders and namespaces

2 participants