[Wox.Plugin] Enable analyzer and fix warnings (#16547)

This commit is contained in:
CleanCodeDeveloper
2022-03-08 17:46:36 +01:00
committed by GitHub
parent 9cf39654d9
commit ec3ea5c4ae
4 changed files with 7 additions and 5 deletions

View File

@@ -187,7 +187,7 @@ namespace Wox.Plugin.Common
if (string.IsNullOrEmpty(Path)) if (string.IsNullOrEmpty(Path))
{ {
throw new Exception("Browser path is null or empty."); throw new ArgumentOutOfRangeException(nameof(Path), "Browser path is null or empty.");
} }
} }
catch (Exception e) catch (Exception e)
@@ -217,7 +217,7 @@ namespace Wox.Plugin.Common
return stringBuilder.ToString(); return stringBuilder.ToString();
} }
throw new Exception("Could not load indirect string."); throw new ArgumentNullException(nameof(Path), "Could not load indirect string.");
} }
} }
} }

View File

@@ -801,9 +801,9 @@ namespace Wox.Plugin.Common.Win32
return !r1.Equals(r2); return !r1.Equals(r2);
} }
public bool Equals(RECT r) public bool Equals(RECT other)
{ {
return r.Left == Left && r.Top == Top && r.Right == Right && r.Bottom == Bottom; return other.Left == Left && other.Top == Top && other.Right == Right && other.Bottom == Bottom;
} }
public override bool Equals(object obj) public override bool Equals(object obj)

View File

@@ -18,7 +18,7 @@ namespace Wox.Plugin
{ {
if (obj == null) if (obj == null)
{ {
throw new NullReferenceException(); throw new ArgumentNullException(nameof(obj));
} }
else else
{ {

View File

@@ -14,6 +14,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>