1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 17:52:56 +08:00

Fix remaining obvious CI inspections

This commit is contained in:
Bartłomiej Dach 2023-06-24 16:07:01 +02:00
parent caf5673b68
commit e3a89a6273
No known key found for this signature in database
12 changed files with 26 additions and 16 deletions

View File

@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Mania.Edit
{
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods)
public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods)
: base(ruleset, beatmap, mods)
{
}

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
// derive strainTime for calculation
var osuCurrObj = (OsuDifficultyHitObject)current;
var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null;
var osuNextObj = (OsuDifficultyHitObject)current.Next(0);
var osuNextObj = (OsuDifficultyHitObject?)current.Next(0);
double strainTime = osuCurrObj.StrainTime;
double doubletapness = 1;

View File

@ -10,6 +10,7 @@ using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.Chat;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Users;
@ -32,7 +33,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestGenericActivity()
{
AddStep("Set activity", () => api.Activity.Value = new UserActivity.InLobby(null));
AddStep("Set activity", () => api.Activity.Value = new UserActivity.InLobby(new Room()));
AddStep("Run command", () => Add(new NowPlayingCommand(new Channel())));
@ -63,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online
[TestCase(false)]
public void TestLinkPresence(bool hasOnlineId)
{
AddStep("Set activity", () => api.Activity.Value = new UserActivity.InLobby(null));
AddStep("Set activity", () => api.Activity.Value = new UserActivity.InLobby(new Room()));
AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null)
{

View File

@ -9,8 +9,10 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using osu.Game.Tests.Beatmaps;
using osu.Game.Users;
@ -116,9 +118,9 @@ namespace osu.Game.Tests.Visual.Online
AddStep("solo (osu!catch)", () => activity.Value = soloGameStatusForRuleset(2));
AddStep("solo (osu!mania)", () => activity.Value = soloGameStatusForRuleset(3));
AddStep("choosing", () => activity.Value = new UserActivity.ChoosingBeatmap());
AddStep("editing beatmap", () => activity.Value = new UserActivity.EditingBeatmap(null));
AddStep("modding beatmap", () => activity.Value = new UserActivity.ModdingBeatmap(null));
AddStep("testing beatmap", () => activity.Value = new UserActivity.TestingBeatmap(null, null));
AddStep("editing beatmap", () => activity.Value = new UserActivity.EditingBeatmap(new BeatmapInfo()));
AddStep("modding beatmap", () => activity.Value = new UserActivity.ModdingBeatmap(new BeatmapInfo()));
AddStep("testing beatmap", () => activity.Value = new UserActivity.TestingBeatmap(new BeatmapInfo(), new OsuRuleset().RulesetInfo));
}
[Test]
@ -134,7 +136,7 @@ namespace osu.Game.Tests.Visual.Online
AddAssert("visit message is not visible", () => !boundPanel2.LastVisitMessage.IsPresent);
}
private UserActivity soloGameStatusForRuleset(int rulesetId) => new UserActivity.InSoloGame(null, rulesetStore.GetRuleset(rulesetId));
private UserActivity soloGameStatusForRuleset(int rulesetId) => new UserActivity.InSoloGame(new BeatmapInfo(), rulesetStore.GetRuleset(rulesetId)!);
private ScoreInfo createScore(string name) => new ScoreInfo(new TestBeatmap(Ruleset.Value).BeatmapInfo)
{

View File

@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual.Ranking
private BeatmapInfo createTestBeatmap([NotNull] RealmUser author)
{
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)).BeatmapInfo;
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)!).BeatmapInfo;
beatmap.Metadata.Author = author;
beatmap.Metadata.Title = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap title";

View File

@ -177,7 +177,7 @@ namespace osu.Game.Tournament.Screens.Schedule
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new TournamentSpriteTextWithBackground(match.NewValue.Round.Value?.Name.Value)
new TournamentSpriteTextWithBackground(match.NewValue.Round.Value?.Name.Value ?? string.Empty)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,

View File

@ -93,7 +93,7 @@ namespace osu.Game.Beatmaps.Formats
writer.WriteLine(FormattableString.Invariant($"PreviewTime: {beatmap.Metadata.PreviewTime}"));
writer.WriteLine(FormattableString.Invariant($"Countdown: {(int)beatmap.BeatmapInfo.Countdown}"));
writer.WriteLine(FormattableString.Invariant(
$"SampleSet: {toLegacySampleBank(((beatmap.ControlPointInfo as LegacyControlPointInfo)?.SamplePoints?.FirstOrDefault() ?? SampleControlPoint.DEFAULT).SampleBank)}"));
$"SampleSet: {toLegacySampleBank(((beatmap.ControlPointInfo as LegacyControlPointInfo)?.SamplePoints.FirstOrDefault() ?? SampleControlPoint.DEFAULT).SampleBank)}"));
writer.WriteLine(FormattableString.Invariant($"StackLeniency: {beatmap.BeatmapInfo.StackLeniency}"));
writer.WriteLine(FormattableString.Invariant($"Mode: {onlineRulesetID}"));
writer.WriteLine(FormattableString.Invariant($"LetterboxInBreaks: {(beatmap.BeatmapInfo.LetterboxInBreaks ? '1' : '0')}"));

View File

@ -35,6 +35,13 @@ namespace osu.Game.Graphics.Containers.Markdown
break;
case ListItemBlock listItemBlock:
// `ListBlock.Parent` is annotated as null-returning in xmldoc.
// Unfortunately code analysis sees that the type doesn't have NRT enabled and complains.
// This is fixed upstream in 0.24.0 (https://github.com/xoofx/markdig/commit/6684c8257cbbcba2d34457020876be289d3cd8b9),
// but markdig is a transitive dependency from framework, wherein we are locked to 0.23.0
// (https://github.com/ppy/osu-framework/blob/9746d7d06f48910c05a24687a25f435f30d12f8b/osu.Framework/osu.Framework.csproj#L52C1-L54)
// Therefore...
// ReSharper disable once ConstantConditionalAccessQualifier
bool isOrdered = ((ListBlock)listItemBlock.Parent)?.IsOrdered == true;
OsuMarkdownListItem childContainer = CreateListItem(listItemBlock, level, isOrdered);

View File

@ -7,7 +7,7 @@ namespace osu.Game.Online.API
{
public class APIException : InvalidOperationException
{
public APIException(string message, Exception innerException)
public APIException(string message, Exception? innerException)
: base(message, innerException)
{
}

View File

@ -11,9 +11,9 @@ namespace osu.Game.Overlays.BeatmapSet
{
public partial class BeatmapRulesetSelector : OverlayRulesetSelector
{
private readonly Bindable<APIBeatmapSet> beatmapSet = new Bindable<APIBeatmapSet>();
private readonly Bindable<APIBeatmapSet?> beatmapSet = new Bindable<APIBeatmapSet?>();
public APIBeatmapSet BeatmapSet
public APIBeatmapSet? BeatmapSet
{
get => beatmapSet.Value;
set

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
public APIBeatmap BeatmapInfo
public APIBeatmap? BeatmapInfo
{
get => successRate.Beatmap;
set => successRate.Beatmap = value;

View File

@ -351,7 +351,7 @@ namespace osu.Game.Screens.Select
private void addInfoLabels()
{
if (working.Beatmap?.HitObjects?.Any() != true)
if (working.Beatmap?.HitObjects.Any() != true)
return;
infoLabelContainer.Children = new Drawable[]