Skip to content

Commit 2f49a03

Browse files
committed
Fix Codacy suggestions
1 parent 0477aec commit 2f49a03

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Algorithms.Tests/Strings/Similarity/OptimalStringAlignmentTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,19 @@ public void Calculate_MultipleOperations_ReturnsCorrectDistance()
7575
public void Calculate_FirstStringNull_ThrowsArgumentNullException()
7676
{
7777
string? nullString = null;
78-
#pragma warning disable CS8604 // Possible null reference argument.
78+
#nullable disable
7979
Action act = () => OptimalStringAlignment.Calculate(nullString, "example");
80-
#pragma warning restore CS8604 // Possible null reference argument.
80+
#nullable restore
8181
act.Should().Throw<ArgumentNullException>().WithMessage("*firstString*");
8282
}
8383

8484
[Test]
8585
public void Calculate_SecondStringNull_ThrowsArgumentNullException()
8686
{
8787
string? nullString = null;
88-
#pragma warning disable CS8604 // Possible null reference argument.
88+
#nullable disable
8989
Action act = () => OptimalStringAlignment.Calculate("example", nullString);
90-
#pragma warning restore CS8604 // Possible null reference argument.
90+
#nullable restore
9191
act.Should().Throw<ArgumentNullException>().WithMessage("*secondString*");
9292
}
9393
}

Algorithms/Strings/Similarity/OptimalStringAlignment.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace Algorithms.Strings.Similarity
4545
/// This algorithm has a time complexity of O(n * m), where n and m are the lengths of the two input strings.
4646
/// It is efficient for moderate-sized strings but may become computationally expensive for very long strings.
4747
/// </remarks>
48-
public class OptimalStringAlignment
48+
public static class OptimalStringAlignment
4949
{
5050
/// <summary>
5151
/// Calculates the Optimal String Alignment distance between two strings.
@@ -56,8 +56,8 @@ public class OptimalStringAlignment
5656
/// <exception cref="ArgumentNullException">Thrown when either of the input strings is null.</exception>
5757
public static double Calculate(string firstString, string secondString)
5858
{
59-
ArgumentNullException.ThrowIfNull(firstString, nameof(firstString));
60-
ArgumentNullException.ThrowIfNull(secondString, nameof(secondString));
59+
ArgumentNullException.ThrowIfNull(nameof(firstString));
60+
ArgumentNullException.ThrowIfNull(nameof(secondString));
6161

6262
if (firstString == secondString)
6363
{

0 commit comments

Comments
 (0)