This repository was archived by the owner on May 27, 2026. It is now read-only.
fix: resolve 4 SonarQube code quality issues#6
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Conversation
Fixed issues: - AYfoIqPIwRyr12UHVtuJ for csharpsquid:S4487 rule - AYfoIqOlwRyr12UHVtuC for csharpsquid:S2187 rule - AYfoIqOlwRyr12UHVtuH for csharpsquid:S3415 rule - AYfoIqKwwRyr12UHVtuB for csharpsquid:S2187 rule Generated by SonarQube Agent (task: 141e4bac-387a-4faa-9515-f84e190ac7a9)
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Removes unnecessary [TestFixture] attributes from test classes that use xUnit-style tests instead of NUnit attributes, corrects the argument order in Assert.AreEqual calls to match the expected-first convention, and removes an unused private field. These changes eliminate false positives in static analysis and improve code quality compliance.
View Project in SonarCloud
Fixed Issues
csharpsquid:S2187 - Add some tests to this class. • BLOCKER • View issue
Location:
src/Cake.NUnitRetry.Tests/NUnit3DeserializerTests.cs:12Why is this an issue?
To ensure proper testing, it is important to include test cases in a test class. If a test class does not have any test cases, it can give the wrong impression that the class being tested has been thoroughly tested, when in reality, it has not.
What changed
Removes the [TestFixture] attribute from the NUnit3DeserializerTests class. The static analysis warning reported that a class marked with [TestFixture] must contain test methods annotated with [Test], [TestCase], [TestCaseSource], or [Theory]. Since this class uses xUnit-style tests (not NUnit attributes on methods), removing the [TestFixture] attribute eliminates the false requirement for NUnit-style test methods and resolves the 'Add some tests to this class' warning.
csharpsquid:S3415 - Make sure these 2 arguments are in the correct order: expected value, actual value. • MAJOR • View issue
Location:
src/Cake.NUnitRetry.Tests/NUnit3DeserializerTests.cs:53Why is this an issue?
The standard assertions library methods such as
AreEqualandAreSamein MSTest and NUnit, orEqualandSamein XUnit, expect the first argument to be the expected value and the second argument to be the actual value.What changed
Swaps the argument order in all Assert.AreEqual calls so that the hard-coded expected value comes first and the actual value (from results object) comes second. Previously, the actual value was passed as the first argument and the expected value as the second, which is the reverse of the correct convention. This fixes the 'Make sure these 2 arguments are in the correct order: expected value, actual value' warning for all five assertion statements.
csharpsquid:S2187 - Add some tests to this class. • BLOCKER • View issue
Location:
src/Cake.NUnitRetry.Tests/TestListWriterTests.cs:12Why is this an issue?
To ensure proper testing, it is important to include test cases in a test class. If a test class does not have any test cases, it can give the wrong impression that the class being tested has been thoroughly tested, when in reality, it has not.
What changed
Removes the [TestFixture] attribute from the outer class TestListWriterTests, which was flagged because it had no test methods directly within it. The class itself is a container for nested test fixture classes, so it should not be annotated with [TestFixture].
csharpsquid:S4487 - Remove this unread private field '_environment' or refactor the code to use its value. • CRITICAL • View issue
Location:
src/Cake.NUnitRetry/XmlResultUpdater.cs:13Why is this an issue?
Private fields which are written but never read are a case of "dead store". Changing the value of such a field is useless and most probably indicates an error in the code.
What changed
Removes the private field '_environment' that was written but never read, directly fixing the dead store code smell where the field was assigned in the constructor but never used anywhere in the class.
SonarQube Remediation Agent uses AI. Check for mistakes.