Conversation
Implemented the class `DurationTimeParser`, which provides methods to parse formatted duration strings into `TimeSpan`. Added extensive unit tests to validate functionality.
This fixed the SonarQube issue csharpsquid:S1192 - String literals should not be duplicated.
Fix SonarQube code coverage detection The code coverage reports were necessary to name with the `CoverletOutput` parameter, otherwise files were generated starting with `TestResults` whereby this is should be the directory and not part of the code coverage report file name. In addition, the SonarQube prepare step was updated to point SonarQube to the correct coverage report files. Because this library is targets multiple frameworks, each of its test runs creates a dedicated code coverage report file, hence a wildcard (asterisk) was necessary to used to tell SonarQube to fetch all of those files and merge them by itself.
Optimize and speedup build runs Switched to the Ubuntu runner, because the Windows runner needs much more time in setting it up and there're no dependencies which would a Windows require for building. In addition the SonarQube setup was simplify to avoid relative paths for running the sonar scanner. This should result a little speed up too. Furthermore, the build configuration was optimized by using the artifact upload action v4 instead of v6 which requires Node.js and not letting any command run in PowerShell, because the bash is by default available on an Ubuntu runner. As well a SonarQube marked security issue [Avoid expanding secrets in run block (githubactions:S7636)](https://next.sonarqube.com/sonarqube/coding_rules?open=githubactions%3AS7636&rule_key=githubactions%3AS7636) was fixed by providing the SonarQube token as pipeline environment variable instead of expanding it during runtime.
Add benchmarking project for `DurationTimeParser` Introduced a new `DurationMancer.Benchmarks` project utilizing BenchmarkDotNet for performance benchmarking. Added various benchmarks for standard, human-readable, and edge-case duration formats. Excluded the benchmarks project in general and for SonarQube from code coverage reports and analysis. Added a GitHub Actions workflow to automate benchmarking runs using BenchmarkDotNet. Updated the README to include benchmark results for various .NET versions and duration parsing scenarios. Added benchmark results for .NET versions and parsing scenarios to README file.
Optimize regex usage + improve parsing performance Removed redundant `RegexOptions.Compiled` flag from the `GeneratedRegex` attribute because the source generator produces by default an already optimized RegEx at compile time. Replaced `.Value` with `.ValueSpan` to minimize string allocation and enhance performance during parsing. Cached frequently accessed `Group` instances to avoid redundant lookups. Updated exception handling in parsing methods to specify relevant exceptions (`FormatException` and `OverflowException`). Improved README formatting and grammar. Added usage examples for both human-readable and standard duration formats. Updated benchmark results to reflect changes in performance.
Add `Parse` method to `DurationTimeParser` Introduced a `Parse` method to validate and convert input strings to `TimeSpan`, throwing relevant exceptions (`ArgumentNullException`, `FormatException`) for invalid cases. This method was introduced for not passive coding approaches to satisfy this possible need of developers too. Added comprehensive unit tests to cover the new method `Parse` functionality. To avoid input value redundancy and enhance reusability, all values were extracted to use-case dedicated classes. Extend benchmarks Furthermore, benchmarks for the method `Parse` were added. In addition, the usage examples in the README file were fixed and a reference to the Benchmark page in the Wiki added. The later was done to keep the README small and focused on the easy get started. Added benchmarks for the new method `Parse` and hide not needed columns "Job" and "Alloc Ratio" in results.
Remove empty test class and add badges to README Removed an unused, empty test class from the codebase to improve clarity. Updated the `README` file by adding relevant badges for project status and metrics.
Exclude benchmarks project from rider code coverage
Added a release pipeline to automate NuGet package publishing. This workflow handles versioning, building, testing, packaging, and publishing to NuGet.org, as well as creating a GitHub Releases with relevant artifacts.
Adjusted branch triggers in the build workflow to include `main`, `release/*`, and `develop` branches for both pushes and pull requests.
Enable symbol package generation (#12) Added `IncludeSymbols` and `SymbolPackageFormat` properties to `Directory.Build.props` to enable generation of `.snupkg` symbol packages for better debugging and NuGet symbol support.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.