fix: resolve S3267 and a batch of test-project SonarCloud issues#4991
Merged
arturcic merged 3 commits intoJun 29, 2026
Conversation
- Collapse the inner commit-scan foreach+if to Any() (removes item when a matching commit exists; also avoids repeated Remove calls) - Replace the fallback branch-grouping foreach+if with Where(returnedBranches.Add) Behaviour-preserving. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add CultureInfo.InvariantCulture to the 16 DateTimeOffset.Parse calls across the test projects (VariableProviderTests, BuildAgents.Tests agents, WixFileTests), and import System.Globalization where missing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
arturcic
force-pushed
the
fix/sonar-s3267-repositorystore
branch
from
June 29, 2026 19:46
7f194ef to
be0c632
Compare
- S3260: seal private test helper classes (MockBuildAgent, BuildAgent, MockCommit) - S1450: localise single-method fields (DroneTests.sp, GitVersionTaskDirectoryTests.gitDirectory) - S1118: protected constructor on TestBase - S1104/S3881: encapsulate GitVersionContextBuilder.ServicesProvider as a property and seal the class with the simple sealed-disposable pattern - S3400: replace ExecutableHelper.GetDotNetExecutable() with a const - S1186: remove empty DynamicRepositoryTests teardown - S6562: pass DateTimeKind.Utc in CommitDateTests - S6610: use the char EndsWith overload in DateFormatterTests Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Thank you @arturcic for your contribution! |
|
Member
Author
|
🎉 This issue has been resolved in version 6.8.0 🎉 Your GitReleaseManager bot 📦🚀 |
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.



Follow-up SonarCloud cleanup after #4990: a production fix plus a batch of test-project findings. Code fixes here; analyzer false-positives were dispositioned on SonarCloud.
Production (GitVersion.Core)
RepositoryStore.GetCommitBranches) —foreach+ifsimplified toAny(...)/Where(returnedBranches.Add)Test projects
CultureInfo.InvariantCulturetoDateTimeOffset.ParseMockBuildAgent,BuildAgent,MockCommit)DroneTests.sp,GitVersionTaskDirectoryTests.gitDirectory)protectedconstructor onTestBaseGitVersionContextBuilder.ServicesProvideras a property; seal the class + simple sealed-disposable patternExecutableHelper.GetDotNetExecutable()→constDynamicRepositoryTeststeardownDateTimeKind.UtcinCommitDateTestsEndsWithoverload inDateFormatterTestsDispositioned on SonarCloud (not code)
MockEngine/MockTaskItemS2325 ×5 (interface implementations can't be static);BuildServerBaseTestsS1172 ×2 (overrideparams can't be removed);MergeMessageBaseVersionStrategyTestsS2259 (guarded by ShouldlyShouldNotBeNull);GenerateGitVersionInformationTestS3241 (callers do chain off the return)Verification
dotnet build ./src/GitVersion.slnx— 0 warnings / 0 errorsdotnet format --verify-no-changes— clean🤖 Generated with Claude Code