[Run.Plugin.Calculator] Enable analyzer and fix warnings (#16998)

This commit is contained in:
CleanCodeDeveloper
2022-03-14 16:46:08 +01:00
committed by GitHub
parent 3e9c7f83c8
commit 79b2cdca7b
3 changed files with 8 additions and 8 deletions

View File

@@ -32,7 +32,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
var engine = new CalculateEngine(); var engine = new CalculateEngine();
// Act // Act
Assert.ThrowsException<ArgumentNullException>(() => engine.Interpret(input)); Assert.ThrowsException<ArgumentNullException>(() => engine.Interpret(input, CultureInfo.CurrentCulture));
} }
[DataTestMethod] [DataTestMethod]
@@ -46,7 +46,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
var engine = new CalculateEngine(); var engine = new CalculateEngine();
// Act // Act
var result = engine.Interpret(input); var result = engine.Interpret(input, CultureInfo.CurrentCulture);
// Assert // Assert
Assert.AreEqual(default(CalculateResult), result); Assert.AreEqual(default(CalculateResult), result);

View File

@@ -21,12 +21,10 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
public const int RoundingDigits = 10; public const int RoundingDigits = 10;
public CalculateResult Interpret(string input) /// <summary>
{ /// Interpret
// Using CurrentCulture this is user facing /// </summary>
return Interpret(input, CultureInfo.CurrentCulture); /// <param name="cultureInfo">Use CultureInfo.CurrentCulture if something is user facing</param>
}
public CalculateResult Interpret(string input, CultureInfo cultureInfo) public CalculateResult Interpret(string input, CultureInfo cultureInfo)
{ {
if (!CalculateHelper.InputValid(input)) if (!CalculateHelper.InputValid(input))

View File

@@ -13,6 +13,8 @@
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<NeutralLanguage>en-US</NeutralLanguage> <NeutralLanguage>en-US</NeutralLanguage>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">