diff --git a/build/InspectCode.cake b/build/InspectCode.cake
index 2e7a1d1b28..c8f4f37c94 100644
--- a/build/InspectCode.cake
+++ b/build/InspectCode.cake
@@ -1,5 +1,5 @@
-#addin "nuget:?package=CodeFileSanity&version=0.0.33"
-#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2019.3.2"
+#addin "nuget:?package=CodeFileSanity&version=0.0.36"
+#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2020.1.3"
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
diff --git a/osu.Android.props b/osu.Android.props
index 07be3ab0d2..596e5bfa8b 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -52,6 +52,6 @@
-
+
diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs
index 9351e17419..5f74883803 100644
--- a/osu.Desktop/OsuGameDesktop.cs
+++ b/osu.Desktop/OsuGameDesktop.cs
@@ -59,7 +59,7 @@ namespace osu.Desktop
try
{
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("osu"))
- stableInstallPath = key?.OpenSubKey(@"shell\open\command")?.GetValue(string.Empty).ToString().Split('"')[1].Replace("osu!.exe", "");
+ stableInstallPath = key?.OpenSubKey(@"shell\open\command")?.GetValue(string.Empty).ToString()?.Split('"')[1].Replace("osu!.exe", "");
if (checkExists(stableInstallPath))
return stableInstallPath;
diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs
index ade8460dd7..dd50b05c75 100644
--- a/osu.Desktop/Updater/SquirrelUpdateManager.cs
+++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs
@@ -48,7 +48,7 @@ namespace osu.Desktop.Updater
try
{
- if (updateManager == null) updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
+ updateManager ??= await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
var info = await updateManager.CheckForUpdate(!useDeltaPatching);
if (info.ReleasesToApply.Count == 0)
diff --git a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
index 5cd2f1f581..918ed77683 100644
--- a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
+++ b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
@@ -35,8 +35,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills
{
var catchCurrent = (CatchDifficultyHitObject)current;
- if (lastPlayerPosition == null)
- lastPlayerPosition = catchCurrent.LastNormalizedPosition;
+ lastPlayerPosition ??= catchCurrent.LastNormalizedPosition;
float playerPosition = Math.Clamp(
lastPlayerPosition.Value,
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs
index f5b20fd1c5..a69646507a 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs
@@ -61,7 +61,9 @@ namespace osu.Game.Rulesets.Osu.Tests
private DrawableSlider slider;
[SetUpSteps]
- public override void SetUpSteps() { }
+ public override void SetUpSteps()
+ {
+ }
[TestCase(0)]
[TestCase(1)]
@@ -132,10 +134,9 @@ namespace osu.Game.Rulesets.Osu.Tests
checkPositionChange(16600, sliderRepeat, positionDecreased);
}
- private void retrieveDrawableSlider(int index) => AddStep($"retrieve {(index + 1).ToOrdinalWords()} slider", () =>
- {
- slider = (DrawableSlider)Player.DrawableRuleset.Playfield.AllHitObjects.ElementAt(index);
- });
+ private void retrieveDrawableSlider(int index) =>
+ AddStep($"retrieve {(index + 1).ToOrdinalWords()} slider", () =>
+ slider = (DrawableSlider)Player.DrawableRuleset.Playfield.AllHitObjects.ElementAt(index));
private void ensureSnakingIn(double startTime) => checkPositionChange(startTime, sliderEnd, positionIncreased);
private void ensureNoSnakingIn(double startTime) => checkPositionChange(startTime, sliderEnd, positionRemainsSame);
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs
index 8a0ef22c4a..2c41e6b0e9 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs
@@ -135,8 +135,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
fp.Alpha = 0;
fp.Scale = new Vector2(1.5f * osuEnd.Scale);
- if (firstTransformStartTime == null)
- firstTransformStartTime = fadeInTime;
+ firstTransformStartTime ??= fadeInTime;
fp.AnimationStartTime = fadeInTime;
diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
index 249a8caba9..0151678db3 100644
--- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
+++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
@@ -174,7 +174,7 @@ namespace osu.Game.Tests.Beatmaps.IO
// arbitrary write to non-hashed file
using (var sw = new FileInfo(Directory.GetFiles(extractedFolder, "*.mp3").First()).AppendText())
- sw.WriteLine("text");
+ await sw.WriteLineAsync("text");
using (var zip = ZipArchive.Create())
{
@@ -335,7 +335,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var breakTemp = TestResources.GetTestBeatmapForImport();
MemoryStream brokenOsu = new MemoryStream();
- MemoryStream brokenOsz = new MemoryStream(File.ReadAllBytes(breakTemp));
+ MemoryStream brokenOsz = new MemoryStream(await File.ReadAllBytesAsync(breakTemp));
File.Delete(breakTemp);
@@ -651,7 +651,7 @@ namespace osu.Game.Tests.Beatmaps.IO
using (var resourceForkFile = File.CreateText(resourceForkFilePath))
{
- resourceForkFile.WriteLine("adding content so that it's not empty");
+ await resourceForkFile.WriteLineAsync("adding content so that it's not empty");
}
try
diff --git a/osu.Game.Tests/Chat/MessageFormatterTests.cs b/osu.Game.Tests/Chat/MessageFormatterTests.cs
index fbb0416c45..600c820ce1 100644
--- a/osu.Game.Tests/Chat/MessageFormatterTests.cs
+++ b/osu.Game.Tests/Chat/MessageFormatterTests.cs
@@ -428,22 +428,27 @@ namespace osu.Game.Tests.Chat
Assert.AreEqual(5, result.Links.Count);
Link f = result.Links.Find(l => l.Url == "https://osu.ppy.sh/wiki/wiki links");
+ Assert.That(f, Is.Not.Null);
Assert.AreEqual(44, f.Index);
Assert.AreEqual(10, f.Length);
f = result.Links.Find(l => l.Url == "http://www.simple-test.com");
+ Assert.That(f, Is.Not.Null);
Assert.AreEqual(10, f.Index);
Assert.AreEqual(11, f.Length);
f = result.Links.Find(l => l.Url == "http://google.com");
+ Assert.That(f, Is.Not.Null);
Assert.AreEqual(97, f.Index);
Assert.AreEqual(4, f.Length);
f = result.Links.Find(l => l.Url == "https://osu.ppy.sh");
+ Assert.That(f, Is.Not.Null);
Assert.AreEqual(78, f.Index);
Assert.AreEqual(18, f.Length);
f = result.Links.Find(l => l.Url == "\uD83D\uDE12");
+ Assert.That(f, Is.Not.Null);
Assert.AreEqual(101, f.Index);
Assert.AreEqual(3, f.Length);
}
diff --git a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs
index 90bf419644..57f0d7e957 100644
--- a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs
+++ b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs
@@ -183,11 +183,8 @@ namespace osu.Game.Tests.Scores.IO
{
var beatmapManager = osu.Dependencies.Get();
- if (score.Beatmap == null)
- score.Beatmap = beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First();
-
- if (score.Ruleset == null)
- score.Ruleset = new OsuRuleset().RulesetInfo;
+ score.Beatmap ??= beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First();
+ score.Ruleset ??= new OsuRuleset().RulesetInfo;
var scoreManager = osu.Dependencies.Get();
await scoreManager.Import(score, archive);
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs
index 061039b297..c5374d50ab 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System.Diagnostics;
using System.Reflection;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
@@ -45,7 +46,12 @@ namespace osu.Game.Tests.Visual.UserInterface
});
foreach (var p in typeof(OsuIcon).GetProperties(BindingFlags.Public | BindingFlags.Static))
- flow.Add(new Icon($"{nameof(OsuIcon)}.{p.Name}", (IconUsage)p.GetValue(null)));
+ {
+ var propValue = p.GetValue(null);
+ Debug.Assert(propValue != null);
+
+ flow.Add(new Icon($"{nameof(OsuIcon)}.{p.Name}", (IconUsage)propValue));
+ }
AddStep("toggle shadows", () => flow.Children.ForEach(i => i.SpriteIcon.Shadow = !i.SpriteIcon.Shadow));
AddStep("change icons", () => flow.Children.ForEach(i => i.SpriteIcon.Icon = new IconUsage((char)(i.SpriteIcon.Icon.Icon + 1))));
diff --git a/osu.Game.Tournament.Tests/LadderTestScene.cs b/osu.Game.Tournament.Tests/LadderTestScene.cs
index b962d035ab..2f4373679c 100644
--- a/osu.Game.Tournament.Tests/LadderTestScene.cs
+++ b/osu.Game.Tournament.Tests/LadderTestScene.cs
@@ -24,8 +24,7 @@ namespace osu.Game.Tournament.Tests
[BackgroundDependencyLoader]
private void load()
{
- if (Ladder.Ruleset.Value == null)
- Ladder.Ruleset.Value = rulesetStore.AvailableRulesets.First();
+ Ladder.Ruleset.Value ??= rulesetStore.AvailableRulesets.First();
Ruleset.BindTo(Ladder.Ruleset);
}
diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs
index 8be66ff98c..e10154b722 100644
--- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs
+++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs
@@ -47,8 +47,7 @@ namespace osu.Game.Tournament.Screens.Drawings
this.storage = storage;
- if (TeamList == null)
- TeamList = new StorageBackedTeamList(storage);
+ TeamList ??= new StorageBackedTeamList(storage);
if (!TeamList.Teams.Any())
{
diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs
index 29908e8e7c..b01c93ae03 100644
--- a/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs
+++ b/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs
@@ -14,7 +14,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{
private readonly TeamScore score;
- public bool ShowScore { set => score.FadeTo(value ? 1 : 0, 200); }
+ public bool ShowScore
+ {
+ set => score.FadeTo(value ? 1 : 0, 200);
+ }
public TeamDisplay(TournamentTeam team, TeamColour colour, Bindable currentTeamScore, int pointsToWin)
: base(team)
diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs
index 3e60a03f92..da55ba53ea 100644
--- a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs
+++ b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs
@@ -21,7 +21,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private TeamDisplay teamDisplay;
- public bool ShowScore { set => teamDisplay.ShowScore = value; }
+ public bool ShowScore
+ {
+ set => teamDisplay.ShowScore = value;
+ }
public TeamScoreDisplay(TeamColour teamColour)
{
diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs
index d17b93bf5d..718c8ee644 100644
--- a/osu.Game.Tournament/TournamentGameBase.cs
+++ b/osu.Game.Tournament/TournamentGameBase.cs
@@ -66,11 +66,8 @@ namespace osu.Game.Tournament
ladder = JsonConvert.DeserializeObject(sr.ReadToEnd());
}
- if (ladder == null)
- ladder = new LadderInfo();
-
- if (ladder.Ruleset.Value == null)
- ladder.Ruleset.Value = RulesetStore.AvailableRulesets.First();
+ ladder ??= new LadderInfo();
+ ladder.Ruleset.Value ??= RulesetStore.AvailableRulesets.First();
Ruleset.BindTo(ladder.Ruleset);
diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index 422464c4bb..2cf3a21975 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -246,8 +246,7 @@ namespace osu.Game.Beatmaps
if (working == null)
{
- if (beatmapInfo.Metadata == null)
- beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
+ beatmapInfo.Metadata ??= beatmapInfo.BeatmapSet.Metadata;
workingCache.Add(working = new BeatmapManagerWorkingBeatmap(Files.Store,
new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager));
diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
index 388abf4648..be5cd78dc8 100644
--- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
@@ -425,8 +425,7 @@ namespace osu.Game.Beatmaps.Formats
private void handleHitObject(string line)
{
// If the ruleset wasn't specified, assume the osu!standard ruleset.
- if (parser == null)
- parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
+ parser ??= new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
var obj = parser.Parse(line);
if (obj != null)
diff --git a/osu.Game/IO/Serialization/Converters/TypedListConverter.cs b/osu.Game/IO/Serialization/Converters/TypedListConverter.cs
index f98fa05821..50b28ea74b 100644
--- a/osu.Game/IO/Serialization/Converters/TypedListConverter.cs
+++ b/osu.Game/IO/Serialization/Converters/TypedListConverter.cs
@@ -41,12 +41,24 @@ namespace osu.Game.IO.Serialization.Converters
var list = new List();
var obj = JObject.Load(reader);
+
+ if (obj["$lookup_table"] == null)
+ return list;
+
var lookupTable = serializer.Deserialize>(obj["$lookup_table"].CreateReader());
+ if (lookupTable == null)
+ return list;
+
+ if (obj["$items"] == null)
+ return list;
foreach (var tok in obj["$items"])
{
var itemReader = tok.CreateReader();
+ if (tok["$type"] == null)
+ throw new JsonException("Expected $type token.");
+
var typeName = lookupTable[(int)tok["$type"]];
var instance = (T)Activator.CreateInstance(Type.GetType(typeName));
serializer.Populate(itemReader, instance);
diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs
index 4945f7f185..4ea5c192fe 100644
--- a/osu.Game/Online/API/APIAccess.cs
+++ b/osu.Game/Online/API/APIAccess.cs
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ExceptionExtensions;
+using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Configuration;
@@ -250,7 +251,7 @@ namespace osu.Game.Online.API
{
try
{
- return JObject.Parse(req.GetResponseString()).SelectToken("form_error", true).ToObject();
+ return JObject.Parse(req.GetResponseString()).SelectToken("form_error", true).AsNonNull().ToObject();
}
catch
{
diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs
index 9350887feb..3b336fef4f 100644
--- a/osu.Game/Online/Chat/ChannelManager.cs
+++ b/osu.Game/Online/Chat/ChannelManager.cs
@@ -108,8 +108,7 @@ namespace osu.Game.Online.Chat
/// An optional target channel. If null, will be used.
public void PostMessage(string text, bool isAction = false, Channel target = null)
{
- if (target == null)
- target = CurrentChannel.Value;
+ target ??= CurrentChannel.Value;
if (target == null)
return;
@@ -192,8 +191,7 @@ namespace osu.Game.Online.Chat
/// An optional target channel. If null, will be used.
public void PostCommand(string text, Channel target = null)
{
- if (target == null)
- target = CurrentChannel.Value;
+ target ??= CurrentChannel.Value;
if (target == null)
return;
@@ -396,8 +394,7 @@ namespace osu.Game.Online.Chat
fetchInitalMessages(channel);
}
- if (CurrentChannel.Value == null)
- CurrentChannel.Value = channel;
+ CurrentChannel.Value ??= channel;
return channel;
}
diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs
index 4fbeac1db9..f8810c778f 100644
--- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs
+++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs
@@ -73,8 +73,7 @@ namespace osu.Game.Online.Chat
[BackgroundDependencyLoader(true)]
private void load(ChannelManager manager)
{
- if (ChannelManager == null)
- ChannelManager = manager;
+ ChannelManager ??= manager;
}
protected virtual StandAloneDrawableChannel CreateDrawableChannel(Channel channel) =>
diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs
index 5e44562144..3e7311092e 100644
--- a/osu.Game/OsuGameBase.cs
+++ b/osu.Game/OsuGameBase.cs
@@ -164,7 +164,7 @@ namespace osu.Game
dependencies.Cache(SkinManager = new SkinManager(Storage, contextFactory, Host, Audio, new NamespacedResourceStore(Resources, "Skins/Legacy")));
dependencies.CacheAs(SkinManager);
- if (API == null) API = new APIAccess(LocalConfig);
+ API ??= new APIAccess(LocalConfig);
dependencies.CacheAs(API);
@@ -311,11 +311,10 @@ namespace osu.Game
{
base.SetHost(host);
- if (Storage == null) // may be non-null for certain tests
- Storage = new OsuStorage(host);
+ // may be non-null for certain tests
+ Storage ??= new OsuStorage(host);
- if (LocalConfig == null)
- LocalConfig = new OsuConfigManager(Storage);
+ LocalConfig ??= new OsuConfigManager(Storage);
}
private readonly List fileImporters = new List();
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
index a72f182450..cb6abb7cc6 100644
--- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
@@ -68,8 +68,7 @@ namespace osu.Game.Overlays.Chat.Tabs
if (!Items.Contains(channel))
AddItem(channel);
- if (Current.Value == null)
- Current.Value = channel;
+ Current.Value ??= channel;
}
///
diff --git a/osu.Game/Rulesets/Mods/ModEasy.cs b/osu.Game/Rulesets/Mods/ModEasy.cs
index 7cf9656810..c6f3930029 100644
--- a/osu.Game/Rulesets/Mods/ModEasy.cs
+++ b/osu.Game/Rulesets/Mods/ModEasy.cs
@@ -35,7 +35,9 @@ namespace osu.Game.Rulesets.Mods
private BindableNumber health;
- public void ReadFromDifficulty(BeatmapDifficulty difficulty) { }
+ public void ReadFromDifficulty(BeatmapDifficulty difficulty)
+ {
+ }
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
diff --git a/osu.Game/Rulesets/Mods/ModHardRock.cs b/osu.Game/Rulesets/Mods/ModHardRock.cs
index 58c9a58408..0e589735c1 100644
--- a/osu.Game/Rulesets/Mods/ModHardRock.cs
+++ b/osu.Game/Rulesets/Mods/ModHardRock.cs
@@ -17,7 +17,9 @@ namespace osu.Game.Rulesets.Mods
public override string Description => "Everything just got a bit harder...";
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust) };
- public void ReadFromDifficulty(BeatmapDifficulty difficulty) { }
+ public void ReadFromDifficulty(BeatmapDifficulty difficulty)
+ {
+ }
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs
index e2cc98813a..1d60b266e3 100644
--- a/osu.Game/Rulesets/Objects/HitObject.cs
+++ b/osu.Game/Rulesets/Objects/HitObject.cs
@@ -133,8 +133,7 @@ namespace osu.Game.Rulesets.Objects
{
Kiai = controlPointInfo.EffectPointAt(StartTime + control_point_leniency).KiaiMode;
- if (HitWindows == null)
- HitWindows = CreateHitWindows();
+ HitWindows ??= CreateHitWindows();
HitWindows?.SetDifficulty(difficulty.OverallDifficulty);
}
diff --git a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs
index bc9401a095..d574991fa0 100644
--- a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs
+++ b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs
@@ -181,8 +181,7 @@ namespace osu.Game.Rulesets.UI
private void setClock()
{
// in case a parent gameplay clock isn't available, just use the parent clock.
- if (parentGameplayClock == null)
- parentGameplayClock = Clock;
+ parentGameplayClock ??= Clock;
Clock = GameplayClock;
ProcessCustomClock = false;
diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs
index a40f436a6e..7b37c267bc 100644
--- a/osu.Game/Scoring/ScoreInfo.cs
+++ b/osu.Game/Scoring/ScoreInfo.cs
@@ -115,9 +115,7 @@ namespace osu.Game.Scoring
get => User?.Username;
set
{
- if (User == null)
- User = new User();
-
+ User ??= new User();
User.Username = value;
}
}
@@ -129,9 +127,7 @@ namespace osu.Game.Scoring
get => User?.Id ?? 1;
set
{
- if (User == null)
- User = new User();
-
+ User ??= new User();
User.Id = value ?? 1;
}
}
diff --git a/osu.Game/Screens/Edit/Timing/Section.cs b/osu.Game/Screens/Edit/Timing/Section.cs
index ccf1582486..603fb77f31 100644
--- a/osu.Game/Screens/Edit/Timing/Section.cs
+++ b/osu.Game/Screens/Edit/Timing/Section.cs
@@ -57,7 +57,7 @@ namespace osu.Game.Screens.Edit.Timing
{
checkbox = new OsuCheckbox
{
- LabelText = typeof(T).Name.Replace(typeof(ControlPoint).Name, string.Empty)
+ LabelText = typeof(T).Name.Replace(nameof(Beatmaps.ControlPoints.ControlPoint), string.Empty)
}
}
},
diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
index 300418441e..2742ef3404 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
@@ -34,8 +34,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
[BackgroundDependencyLoader]
private void load()
{
- if (filter == null)
- filter = new Bindable();
+ filter ??= new Bindable();
}
protected override void LoadComplete()
diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs
index 2d714d1794..e174c46610 100644
--- a/osu.Game/Screens/Select/BeatmapCarousel.cs
+++ b/osu.Game/Screens/Select/BeatmapCarousel.cs
@@ -607,10 +607,7 @@ namespace osu.Game.Screens.Select
// todo: remove the need for this.
foreach (var b in beatmapSet.Beatmaps)
- {
- if (b.Metadata == null)
- b.Metadata = beatmapSet.Metadata;
- }
+ b.Metadata ??= beatmapSet.Metadata;
var set = new CarouselBeatmapSet(beatmapSet)
{
diff --git a/osu.Game/Users/Drawables/DrawableAvatar.cs b/osu.Game/Users/Drawables/DrawableAvatar.cs
index 09750c5bfe..42d2dbb1c6 100644
--- a/osu.Game/Users/Drawables/DrawableAvatar.cs
+++ b/osu.Game/Users/Drawables/DrawableAvatar.cs
@@ -43,7 +43,7 @@ namespace osu.Game.Users.Drawables
Texture texture = null;
if (user != null && user.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}");
- if (texture == null) texture = textures.Get(@"Online/avatar-guest");
+ texture ??= textures.Get(@"Online/avatar-guest");
ClickableArea clickableArea;
Add(clickableArea = new ClickableArea
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 8213719c01..1d3bafbfd6 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index fd13455c63..ad7850599b 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -70,7 +70,7 @@
-
+
@@ -80,7 +80,7 @@
-
+
diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings
index b9fc3de734..85d5fce29a 100644
--- a/osu.sln.DotSettings
+++ b/osu.sln.DotSettings
@@ -60,6 +60,7 @@
WARNING
WARNING
WARNING
+ WARNING
WARNING
WARNING
WARNING
@@ -105,6 +106,8 @@
HINT
WARNING
WARNING
+ WARNING
+ WARNING
WARNING
WARNING
WARNING
@@ -138,6 +141,7 @@
WARNING
WARNING
WARNING
+ WARNING
WARNING
WARNING
WARNING
@@ -196,6 +200,7 @@
WARNING
WARNING
HINT
+ WARNING
DO_NOT_SHOW
DO_NOT_SHOW
DO_NOT_SHOW
@@ -222,6 +227,7 @@
WARNING
WARNING
WARNING
+ WARNING
True
WARNING