From 425346b1f2a97b95f79f56a61a32a39f9417e9d5 Mon Sep 17 00:00:00 2001 From: CleanCodeDeveloper <16760760+CleanCodeDeveloper@users.noreply.github.com> Date: Wed, 9 Mar 2022 13:09:17 +0100 Subject: [PATCH] [Awake] Enable analyzer and fix warnings (#16899) * [Awake] Enable analyzer and fix warnings * Suppress "CA1051:Do not declare visible instance fields" for structs * Revert "Suppress "CA1051:Do not declare visible instance fields" for structs" This reverts commit bea215bffa7fac3f7ea4218b1b857108cfd8c396. * Suppress "CA1051:Do not declare visible instance fields" for structs * spellchecker --- .github/actions/spell-check/expect.txt | 1 + src/.editorconfig | 3 +++ src/modules/awake/Awake/Awake.csproj | 2 ++ src/modules/awake/Awake/Program.cs | 6 +++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index aba67a1fa5..49e863ed02 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -2052,6 +2052,7 @@ stringtable stringval Strmiids strsafe +structs strutil sttngs Stubless diff --git a/src/.editorconfig b/src/.editorconfig index 2b1e755923..b88e05361b 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -5,3 +5,6 @@ dotnet_diagnostic.SA1201.severity = none # CA1303: Do not pass literals as localized parameters dotnet_diagnostic.CA1303.severity = suggestion + +# CA1051: Do not declare visible instance fields +dotnet_code_quality.ca1051.exclude_structs = true diff --git a/src/modules/awake/Awake/Awake.csproj b/src/modules/awake/Awake/Awake.csproj index 6d46232f8d..c3916a2494 100644 --- a/src/modules/awake/Awake/Awake.csproj +++ b/src/modules/awake/Awake/Awake.csproj @@ -15,6 +15,8 @@ Microsoft Corporation $(Version).0 Images\Awake.ico + true + Recommended diff --git a/src/modules/awake/Awake/Program.cs b/src/modules/awake/Awake/Program.cs index 0009e0cec4..ec79cf6c95 100644 --- a/src/modules/awake/Awake/Program.cs +++ b/src/modules/awake/Awake/Program.cs @@ -36,9 +36,9 @@ namespace Awake // the pull request is issued. private static readonly string BuildId = "ARBITER_01312022"; - private static Mutex? _mutex = null; - private static FileSystemWatcher? _watcher = null; - private static SettingsUtils? _settingsUtils = null; + private static Mutex? _mutex; + private static FileSystemWatcher? _watcher; + private static SettingsUtils? _settingsUtils; public static Mutex LockMutex { get => _mutex; set => _mutex = value; }