User/ryanbod/enable codeanalysis for calculatorplugin (#5130)

* Turning on static analysis and removing warning for NoMages.

* Fixing static analysis errors in NumberTranslator.cs

* Fix: Severity Code Description Project File Line Suppression State
Error CA1810 Initialize all static fields in 'Main' when those fields are declared and remove the explicit static constructor Microsoft.Plugin.Calculator C:\Repos\PowerToys\src\modules\launcher\Plugins\Microsoft.Plugin.Calculator\Main.cs 30 Active

* Throwing exception if arguments are null to fix static analysis errors.

* Ignoring CA1031

* Logging exceptions for Calculator queries.
This commit is contained in:
ryanbodrug-microsoft
2020-07-22 12:42:30 -07:00
committed by GitHub
parent b59ec5e78b
commit 25d43354b3
3 changed files with 39 additions and 13 deletions

View File

@@ -23,6 +23,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -97,7 +98,13 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="Mages" Version="1.6.0" />
<PackageReference Include="Mages" Version="1.6.0" >
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>