Skip to content

Commit

Permalink
Fix Codacy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalkwst committed Aug 21, 2024
1 parent 0477aec commit 2f49a03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ public void Calculate_MultipleOperations_ReturnsCorrectDistance()
public void Calculate_FirstStringNull_ThrowsArgumentNullException()
{
string? nullString = null;
#pragma warning disable CS8604 // Possible null reference argument.
#nullable disable
Action act = () => OptimalStringAlignment.Calculate(nullString, "example");
#pragma warning restore CS8604 // Possible null reference argument.
#nullable restore
act.Should().Throw<ArgumentNullException>().WithMessage("*firstString*");
}

[Test]
public void Calculate_SecondStringNull_ThrowsArgumentNullException()
{
string? nullString = null;
#pragma warning disable CS8604 // Possible null reference argument.
#nullable disable
Action act = () => OptimalStringAlignment.Calculate("example", nullString);
#pragma warning restore CS8604 // Possible null reference argument.
#nullable restore
act.Should().Throw<ArgumentNullException>().WithMessage("*secondString*");
}
}
Expand Down
6 changes: 3 additions & 3 deletions Algorithms/Strings/Similarity/OptimalStringAlignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Algorithms.Strings.Similarity
/// This algorithm has a time complexity of O(n * m), where n and m are the lengths of the two input strings.
/// It is efficient for moderate-sized strings but may become computationally expensive for very long strings.
/// </remarks>
public class OptimalStringAlignment
public static class OptimalStringAlignment
{
/// <summary>
/// Calculates the Optimal String Alignment distance between two strings.
Expand All @@ -56,8 +56,8 @@ public class OptimalStringAlignment
/// <exception cref="ArgumentNullException">Thrown when either of the input strings is null.</exception>
public static double Calculate(string firstString, string secondString)
{
ArgumentNullException.ThrowIfNull(firstString, nameof(firstString));
ArgumentNullException.ThrowIfNull(secondString, nameof(secondString));
ArgumentNullException.ThrowIfNull(nameof(firstString));
ArgumentNullException.ThrowIfNull(nameof(secondString));

if (firstString == secondString)
{
Expand Down

0 comments on commit 2f49a03

Please sign in to comment.