From c22a07d9fc19f3598e6d3727c939c2f9443111bc Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 28 Dec 2021 11:21:59 -0800 Subject: [PATCH 1/8] Bump identifier typo inspection and fix remaining identifier names --- osu.Desktop/Windows/WindowsKey.cs | 3 +++ .../Skinning/OsuSkinConfiguration.cs | 2 ++ .../Online/Chat/MessageNotifierTest.cs | 2 +- .../Requests/GetUserRecentActivitiesRequest.cs | 2 ++ osu.sln.DotSettings | 16 +++++++++++++++- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs index f19d741107..c9d94cd05c 100644 --- a/osu.Desktop/Windows/WindowsKey.cs +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -14,6 +14,8 @@ namespace osu.Desktop.Windows private const int wh_keyboard_ll = 13; private const int wm_keydown = 256; + + // ReSharper disable once IdentifierTypo private const int wm_syskeyup = 261; //Resharper disable once NotAccessedField.Local @@ -69,6 +71,7 @@ namespace osu.Desktop.Windows } [DllImport(@"user32.dll", EntryPoint = @"SetWindowsHookExA")] + // ReSharper disable once IdentifierTypo private static extern IntPtr setWindowsHookEx(int idHook, LowLevelKeyboardProcDelegate lpfn, IntPtr hMod, int dwThreadId); [DllImport(@"user32.dll", EntryPoint = @"UnhookWindowsHookEx")] diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs index 6953e66b5c..7b9cf8e1d1 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs @@ -12,6 +12,8 @@ namespace osu.Game.Rulesets.Osu.Skinning CursorExpand, CursorRotate, HitCircleOverlayAboveNumber, + + // ReSharper disable once IdentifierTypo HitCircleOverlayAboveNumer, // Some old skins will have this typo SpinnerFrequencyModulate, SpinnerNoBlink diff --git a/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs b/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs index 2ec5b778d1..855de9b656 100644 --- a/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs +++ b/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs @@ -46,7 +46,7 @@ namespace osu.Game.Tests.Online.Chat } [Test] - public void TestContainsUsernameBetweenInterpunction() + public void TestContainsUsernameBetweenPunctuation() { Assert.IsTrue(MessageNotifier.CheckContainsUsername("Hello 'test'-message", "Test")); } diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index 123624d333..f2fa51bde7 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -22,6 +22,8 @@ namespace osu.Game.Online.API.Requests public enum RecentActivityType { Achievement, + + // ReSharper disable once IdentifierTypo BeatmapPlaycount, BeatmapsetApprove, BeatmapsetDelete, diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 90bf4f09eb..5f3a38557d 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -90,7 +90,7 @@ WARNING HINT DO_NOT_SHOW - HINT + WARNING HINT ERROR WARNING @@ -928,11 +928,19 @@ private void load() True True True + True + True + True True + True + True True True True + True True + True + True True True True @@ -949,8 +957,11 @@ private void load() True True True + True + True True True + True True True True @@ -965,6 +976,9 @@ private void load() True True True + True + True + True True True True From cdc148f78e08fe1929b4e1b8ddb59f8b683b194e Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 29 Dec 2021 14:07:36 -0800 Subject: [PATCH 2/8] Increase scope of identifier typo disables on special cases --- osu.Desktop/Windows/WindowsKey.cs | 4 ++-- .../Online/API/Requests/GetUserRecentActivitiesRequest.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs index c9d94cd05c..ec4d3f5d74 100644 --- a/osu.Desktop/Windows/WindowsKey.cs +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -2,10 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace osu.Desktop.Windows { + [SuppressMessage("ReSharper", "IdentifierTypo")] internal class WindowsKey { private delegate int LowLevelKeyboardProcDelegate(int nCode, int wParam, ref KdDllHookStruct lParam); @@ -15,7 +17,6 @@ namespace osu.Desktop.Windows private const int wh_keyboard_ll = 13; private const int wm_keydown = 256; - // ReSharper disable once IdentifierTypo private const int wm_syskeyup = 261; //Resharper disable once NotAccessedField.Local @@ -71,7 +72,6 @@ namespace osu.Desktop.Windows } [DllImport(@"user32.dll", EntryPoint = @"SetWindowsHookExA")] - // ReSharper disable once IdentifierTypo private static extern IntPtr setWindowsHookEx(int idHook, LowLevelKeyboardProcDelegate lpfn, IntPtr hMod, int dwThreadId); [DllImport(@"user32.dll", EntryPoint = @"UnhookWindowsHookEx")] diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index f2fa51bde7..62b27b31b4 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests @@ -19,11 +20,10 @@ namespace osu.Game.Online.API.Requests protected override string Target => $"users/{userId}/recent_activity"; } + [SuppressMessage("ReSharper", "IdentifierTypo")] public enum RecentActivityType { Achievement, - - // ReSharper disable once IdentifierTypo BeatmapPlaycount, BeatmapsetApprove, BeatmapsetDelete, From 2212bea17f46a36e21cb43a45978fcdde522636c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jan 2022 01:34:29 +0900 Subject: [PATCH 3/8] Fix test failures due to double `BeginPlaying` calls --- .../Visual/Background/TestSceneUserDimBackgrounds.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs index b1f642b909..5b2cf877ba 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs @@ -36,7 +36,7 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual.Background { [TestFixture] - public class TestSceneUserDimBackgrounds : OsuManualInputManagerTestScene + public class TestSceneUserDimBackgrounds : ScreenTestScene { private DummySongSelect songSelect; private TestPlayerLoader playerLoader; @@ -56,14 +56,12 @@ namespace osu.Game.Tests.Visual.Background Beatmap.SetDefault(); } - [SetUp] - public virtual void SetUp() => Schedule(() => + public override void SetUpSteps() { - var stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; - Child = stack; + base.SetUpSteps(); - stack.Push(songSelect = new DummySongSelect()); - }); + AddStep("push song select", () => Stack.Push(songSelect = new DummySongSelect())); + } /// /// User settings should always be ignored on song select screen. From 672c1d36dc29a7580c6fb8028ac95d1a120de5b4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 13 Jan 2022 05:52:04 +0900 Subject: [PATCH 4/8] Fix intermitten screen navigation tests --- .../Visual/Navigation/TestSceneScreenNavigation.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index d094d8b688..60aabf5639 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -251,8 +251,9 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestModSelectInput() { - TestPlaySongSelect songSelect = null; + AddUntilStep("Wait for toolbar to load", () => Game.Toolbar.IsLoaded); + TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show()); @@ -272,8 +273,9 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestBeatmapOptionsInput() { - TestPlaySongSelect songSelect = null; + AddUntilStep("Wait for toolbar to load", () => Game.Toolbar.IsLoaded); + TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show options overlay", () => songSelect.BeatmapOptionsOverlay.Show()); @@ -293,6 +295,8 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestSettingsViaHotkeyFromMainMenu() { + AddUntilStep("Wait for toolbar to load", () => Game.Toolbar.IsLoaded); + AddAssert("toolbar not displayed", () => Game.Toolbar.State.Value == Visibility.Hidden); AddStep("press settings hotkey", () => @@ -308,10 +312,11 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestToolbarHiddenByUser() { - AddStep("Enter menu", () => InputManager.Key(Key.Enter)); - AddUntilStep("Wait for toolbar to load", () => Game.Toolbar.IsLoaded); + AddStep("Enter menu", () => InputManager.Key(Key.Enter)); + AddUntilStep("Toolbar is visible", () => Game.Toolbar.State.Value == Visibility.Visible); + AddStep("Hide toolbar", () => { InputManager.PressKey(Key.ControlLeft); From 5185f6010e177c69b62f3a20de4bc73582c803b3 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 12 Jan 2022 15:46:20 -0800 Subject: [PATCH 5/8] Fix missed identifier typos --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 4 ++-- osu.sln.DotSettings | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 4ab513bf19..5531bf8b5a 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -533,9 +533,9 @@ namespace osu.Game.Rulesets.Objects.Drawables protected double CalculateSamplePlaybackBalance(double position) { float balanceAdjustAmount = positionalHitsoundsLevel.Value * 2; - double returnedvalue = balanceAdjustAmount * (position - 0.5f); + double returnedValue = balanceAdjustAmount * (position - 0.5f); - return returnedvalue; + return returnedValue; } /// diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index a9b2a652f9..fcb35907a3 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -946,6 +946,7 @@ private void load() True True True + True True True True @@ -957,6 +958,7 @@ private void load() True True True + True True True True @@ -986,6 +988,7 @@ private void load() True True True + True True True True @@ -993,8 +996,10 @@ private void load() True True True + True True True True True - True + True + True From 66773f6d7d26436ac4b0c751f70c17f09cd1fb95 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 12 Jan 2022 15:49:28 -0800 Subject: [PATCH 6/8] Use comments to disable identifier typos instead --- osu.Desktop/Windows/WindowsKey.cs | 5 ++--- .../Online/API/Requests/GetUserRecentActivitiesRequest.cs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs index ec4d3f5d74..fdca2028d3 100644 --- a/osu.Desktop/Windows/WindowsKey.cs +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -2,12 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable IdentifierTypo + namespace osu.Desktop.Windows { - [SuppressMessage("ReSharper", "IdentifierTypo")] internal class WindowsKey { private delegate int LowLevelKeyboardProcDelegate(int nCode, int wParam, ref KdDllHookStruct lParam); @@ -16,7 +16,6 @@ namespace osu.Desktop.Windows private const int wh_keyboard_ll = 13; private const int wm_keydown = 256; - private const int wm_syskeyup = 261; //Resharper disable once NotAccessedField.Local diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index 62b27b31b4..f2fa51bde7 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests @@ -20,10 +19,11 @@ namespace osu.Game.Online.API.Requests protected override string Target => $"users/{userId}/recent_activity"; } - [SuppressMessage("ReSharper", "IdentifierTypo")] public enum RecentActivityType { Achievement, + + // ReSharper disable once IdentifierTypo BeatmapPlaycount, BeatmapsetApprove, BeatmapsetDelete, From a18b2836262d4fb2c925ccc9d6d726f78fc3af44 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 12 Jan 2022 15:52:33 -0800 Subject: [PATCH 7/8] Revert identifier typo bump --- osu.sln.DotSettings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index fcb35907a3..c29d812fc5 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -91,7 +91,7 @@ WARNING HINT DO_NOT_SHOW - WARNING + HINT HINT ERROR WARNING From e1f5acd689c49fc2c5a100e2559a1c2d1b228fd2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jan 2022 12:37:57 +0900 Subject: [PATCH 8/8] Remove names from user dictionary --- .../Visual/Online/TestSceneUserPanel.cs | 33 +++++++++---------- osu.sln.DotSettings | 2 -- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index 52d5eb2c65..6c3678b0d2 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -20,8 +20,8 @@ namespace osu.Game.Tests.Visual.Online private readonly Bindable activity = new Bindable(); private readonly Bindable status = new Bindable(); - private UserGridPanel peppy; - private TestUserListPanel evast; + private UserGridPanel boundPanel1; + private TestUserListPanel boundPanel2; [Resolved] private IRulesetStore rulesetStore { get; set; } @@ -29,8 +29,6 @@ namespace osu.Game.Tests.Visual.Online [SetUp] public void SetUp() => Schedule(() => { - UserGridPanel flyte; - activity.Value = null; status.Value = null; @@ -56,14 +54,15 @@ namespace osu.Game.Tests.Visual.Online Colour = "99EB47", CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", }), - flyte = new UserGridPanel(new APIUser + new UserGridPanel(new APIUser { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", + Status = { Value = new UserStatusOnline() } }) { Width = 300 }, - peppy = new UserGridPanel(new APIUser + boundPanel1 = new UserGridPanel(new APIUser { Username = @"peppy", Id = 2, @@ -72,7 +71,7 @@ namespace osu.Game.Tests.Visual.Online IsSupporter = true, SupportLevel = 3, }) { Width = 300 }, - evast = new TestUserListPanel(new APIUser + boundPanel2 = new TestUserListPanel(new APIUser { Username = @"Evast", Id = 8195163, @@ -84,13 +83,11 @@ namespace osu.Game.Tests.Visual.Online }, }; - flyte.Status.Value = new UserStatusOnline(); + boundPanel1.Status.BindTo(status); + boundPanel1.Activity.BindTo(activity); - peppy.Status.BindTo(status); - peppy.Activity.BindTo(activity); - - evast.Status.BindTo(status); - evast.Activity.BindTo(activity); + boundPanel2.Status.BindTo(status); + boundPanel2.Activity.BindTo(activity); }); [Test] @@ -121,14 +118,14 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestUserActivityChange() { - AddAssert("visit message is visible", () => evast.LastVisitMessage.IsPresent); + AddAssert("visit message is visible", () => boundPanel2.LastVisitMessage.IsPresent); AddStep("set online status", () => status.Value = new UserStatusOnline()); - AddAssert("visit message is not visible", () => !evast.LastVisitMessage.IsPresent); + AddAssert("visit message is not visible", () => !boundPanel2.LastVisitMessage.IsPresent); AddStep("set choosing activity", () => activity.Value = new UserActivity.ChoosingBeatmap()); AddStep("set offline status", () => status.Value = new UserStatusOffline()); - AddAssert("visit message is visible", () => evast.LastVisitMessage.IsPresent); + AddAssert("visit message is visible", () => boundPanel2.LastVisitMessage.IsPresent); AddStep("set online status", () => status.Value = new UserStatusOnline()); - AddAssert("visit message is not visible", () => !evast.LastVisitMessage.IsPresent); + AddAssert("visit message is not visible", () => !boundPanel2.LastVisitMessage.IsPresent); } private UserActivity soloGameStatusForRuleset(int rulesetId) => new UserActivity.InSoloGame(null, rulesetStore.GetRuleset(rulesetId)); diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index c29d812fc5..2ff0f4d30b 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -939,10 +939,8 @@ private void load() True True True - True True True - True True True True