mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
Enabling static analysis on indexer plugin and fixing errors (#5220)
* Enabling code analysis, and treating warnings as errors * Error CA1724 The type name Settings conflicts in whole or in part with the namespace name 'Microsoft.PowerToys.Settings'. Change either name to eliminate the conflict. Microsoft.Plugin.Indexer C:\repos\powertoys\src\modules\launcher\Plugins\Microsoft.Plugin.Indexer\Settings.cs 9 Active * Removing keyword "Interface" from namespace to fix fxcop warnings * Fixing static analysis warnings on ContextMenuLoader * Fixing general exception warnings for static analysis * Fixing public list variables, non static methods, and general exception warning * Implementing IDisposable on OleDBSearch although in practice these objects were already being disposed. Also Validated we were not using user input directly for sql strings. * Removing VS generated comments from dispose methods as per PR feedback. * Setting translated text to use current culture as per PR feedback. * Explicity specifying 'internal' access modifier for Indexer 'Main' class, as per PR feedback * Updating to FxCop 3.0.0
This commit is contained in:
committed by
GitHub
parent
aa8c31e79b
commit
8f17f7297d
@@ -29,8 +29,9 @@ namespace Microsoft.Plugin.Indexer
|
||||
public ContextMenuLoader(PluginInitContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "We want to keep the process alive, and instead log and show an error message")]
|
||||
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
|
||||
{
|
||||
var contextMenus = new List<ContextMenuResult>();
|
||||
@@ -111,6 +112,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
}
|
||||
|
||||
// Function to add the context menu item to run as admin
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "We want to keep the process alive, and instead log the exeption message")]
|
||||
private ContextMenuResult CreateRunAsAdminContextMenu(SearchResult record)
|
||||
{
|
||||
return new ContextMenuResult
|
||||
@@ -152,7 +154,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "We want to keep the process alive, and instead log and show an error message")]
|
||||
private ContextMenuResult CreateOpenContainingFolderResult(SearchResult record)
|
||||
{
|
||||
return new ContextMenuResult
|
||||
@@ -182,7 +184,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
};
|
||||
}
|
||||
|
||||
public void LogException(string message, Exception e)
|
||||
public static void LogException(string message, Exception e)
|
||||
{
|
||||
Log.Exception($"|Microsoft.Plugin.Folder.ContextMenu|{message}", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user