Skip to content

Refactor LanguageTag and LanguageTagBuilder for improved documentation and validation#77

Merged
ptr727 merged 6 commits intodevelopfrom
logfix
Feb 1, 2026
Merged

Refactor LanguageTag and LanguageTagBuilder for improved documentation and validation#77
ptr727 merged 6 commits intodevelopfrom
logfix

Conversation

@ptr727
Copy link
Owner

@ptr727 ptr727 commented Jan 31, 2026

  • Updated XML documentation in LanguageTag.cs to clarify return values and parsing behavior.
  • Enhanced LanguageTagBuilder methods to specify that they set subtags without validation.
  • Improved normalization and validation methods in LanguageTagParser to ensure null checks are handled properly.
  • Added remarks in LogOptions to clarify the effects of setting logger factory and logger after creation.
  • Streamlined async file handling in Rfc5646Data to use 'using' statements for better resource management.
  • Updated tests to inherit from SingleInstanceFixture for consistent test execution and resource management.
  • Refined exception handling in Program.cs to ensure proper logging and cleanup on errors.
  • General code cleanup and consistency improvements across various files.

ptr727 and others added 2 commits January 30, 2026 05:40
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ptr727 <2061579+ptr727@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n and validation

- Updated XML documentation in LanguageTag.cs to clarify return values and parsing behavior.
- Enhanced LanguageTagBuilder methods to specify that they set subtags without validation.
- Improved normalization and validation methods in LanguageTagParser to ensure null checks are handled properly.
- Added remarks in LogOptions to clarify the effects of setting logger factory and logger after creation.
- Streamlined async file handling in Rfc5646Data to use 'using' statements for better resource management.
- Updated tests to inherit from SingleInstanceFixture for consistent test execution and resource management.
- Refined exception handling in Program.cs to ensure proper logging and cleanup on errors.
- General code cleanup and consistency improvements across various files.
Copilot AI review requested due to automatic review settings January 31, 2026 18:22
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 refactors the LanguageTags library to improve documentation, validation, and code quality. It includes updates to XML documentation for better clarity, enhanced error handling, async resource management improvements, migration from xUnit v2 to v3, and general code cleanup across the codebase.

Changes:

  • Enhanced XML documentation across all public APIs with more detailed parameter descriptions, return value documentation, and usage remarks
  • Improved validation and normalization methods in LanguageTagParser to ensure proper null checking with ArgumentNullException
  • Updated test infrastructure to use xUnit v3 with assembly-level fixtures and removed unnecessary null-forgiving operators
  • Streamlined async file handling using using statements instead of ConfiguredAsyncDisposable
  • Enhanced exception handling and logging in the LanguageTagsCreate CLI tool

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
LanguageTags/LanguageTag.cs Updated XML documentation to clarify parsing behavior and return values
LanguageTags/LanguageTagBuilder.cs Enhanced method documentation to specify that builder methods set values without validation
LanguageTags/LanguageTagParser.cs Changed Normalize(LanguageTag) to return non-nullable and added ArgumentNullException checks
LanguageTags/LogOptions.cs Added remarks explaining caching behavior of logger factory and logger properties
LanguageTags/Rfc5646Data.cs Replaced ConfiguredAsyncDisposable with using statements and added XML documentation
LanguageTags/Iso6392Data.cs Replaced ConfiguredAsyncDisposable with using statements and improved documentation
LanguageTags/Iso6393Data.cs Replaced ConfiguredAsyncDisposable with using statements and improved documentation
LanguageTags/LanguageLookup.cs Added parameter documentation to helper methods
LanguageTags/Extensions.cs Simplified logging extension method calls
LanguageTags/*DataGen.cs Added GeneratedCode attributes and XML documentation to generated code
LanguageTags/LanguageTags.csproj Moved GenerateDocumentationFile property and updated Microsoft.SourceLink.GitHub version
LanguageTags/.editorconfig Added suppression for missing XML documentation warnings
LanguageTagsTests/Fixture.cs Refactored to use xUnit v3 AssemblyFixture pattern with SingleInstanceFixture base class
LanguageTagsTests/*.cs Updated test classes to inherit from SingleInstanceFixture and removed null-forgiving operators
LanguageTagsTests/LanguageTagsTests.csproj Migrated from xunit v2.9.3 to xunit.v3 v3.2.2 and updated xunit.analyzers
LanguageTagsTests/.editorconfig Added suppressions for test-specific analyzer warnings
LanguageTagsCreate/Program.cs Added try-catch-finally for better exception handling and resource cleanup
LanguageTagsCreate/LoggerFactory.cs Improved logger initialization to reuse configured Log.Logger when available
LanguageTagsCreate/CreateTagData.cs Replaced ConfiguredAsyncDisposable with using statements
LanguageTagsCreate/HttpClientFactory.cs Simplified null checks using property pattern matching
LanguageTagsCreate/Extensions.cs Simplified logging extension method calls
LanguageTagsCreate/CommandLine.cs Minor formatting improvement for frozen set initialization
CODESTYLE.md Enhanced documentation guidelines with more detailed examples
.editorconfig Updated modifier order and added ReSharper settings
LanguageTags.code-workspace Added new words to spell checker dictionary

…handling and logging

- Removed unused logger options from LoadDataAsync methods in Iso6392Data, Iso6393Data, and Rfc5646Data classes.
- Enhanced error handling by throwing InvalidDataException when no data is found during loading.
- Updated Find methods in Iso6392Data, Iso6393Data, and Rfc5646Data to throw ArgumentNullException for null inputs.
- Modified LanguageTag and LanguageTagBuilder classes to streamline normalization methods.
- Improved logging options handling in LogOptions class, ensuring proper fallback mechanisms.
- Updated tests for Iso6392Tests, Iso6393Tests, Rfc5646Tests to validate new error handling and logging behavior.
- Removed redundant normalization tests from LanguageTagBuilderTests.
- Removed Options class as it was no longer needed for logging configuration.
- Updated Rfc5646Data, Iso6392Data, and Iso6393Data classes to use async methods for loading and saving data.
- Changed method names from LoadDataAsync and LoadJsonAsync to FromDataAsync and FromJsonAsync for consistency.
- Implemented logging directly within data classes using ILogger.
- Updated tests to reflect changes in method names and removed references to the Options class.
- Revised README to document breaking changes and new usage patterns.
Copilot AI review requested due to automatic review settings February 1, 2026 16:59
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

Copilot reviewed 36 out of 37 changed files in this pull request and generated 5 comments.

@ptr727 ptr727 merged commit ad8a5c4 into develop Feb 1, 2026
8 checks passed
@ptr727 ptr727 deleted the logfix branch February 1, 2026 17:20
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