[Wox.Infrastructure] Enable analyzer and fix warnings (#16996)

This commit is contained in:
CleanCodeDeveloper
2022-03-14 16:44:17 +01:00
committed by GitHub
parent 7365ba14d0
commit 561882c2f1
7 changed files with 15 additions and 10 deletions

View File

@@ -101,7 +101,9 @@ namespace Wox.Infrastructure
{
var fullStringToCompare = fullStringToCompareWithoutCase[compareStringIndex].ToString();
var querySubstring = currentQuerySubstring[currentQuerySubstringCharacterIndex].ToString();
#pragma warning disable CA1309 // Use ordinal string comparison (We are looking for a fuzzy match here)
compareResult = string.Compare(fullStringToCompare, querySubstring, CultureInfo.CurrentCulture, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace) != 0;
#pragma warning restore CA1309 // Use ordinal string comparison
}
else
{
@@ -262,12 +264,13 @@ namespace Wox.Infrastructure
}
}
// Using CurrentCultureIgnoreCase since this relates to queries input by user
#pragma warning disable CA1309 // Use ordinal string comparison (Using CurrentCultureIgnoreCase since this relates to queries input by user)
if (string.Equals(query, stringToCompare, StringComparison.CurrentCultureIgnoreCase))
{
var bonusForExactMatch = 10;
score += bonusForExactMatch;
}
#pragma warning restore CA1309 // Use ordinal string comparison
return score;
}