Skip to content

Commit e606d22

Browse files
fix: resolve all InspectCode warnings and notes from CI
Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/25d444f7-30e4-4b5b-b6b2-23759a4fee69 Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
1 parent 2580321 commit e606d22

33 files changed

Lines changed: 56 additions & 67 deletions

osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4-
54
using System.Numerics;
65

76
namespace osu.Game.Rulesets.Catch.Skinning.Default

osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyColumnBackground.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
3535
?? 0;
3636

3737
Colour4 lightColour = GetColumnSkinConfig<Colour4>(skin, LegacyManiaSkinConfigurationLookups.ColumnLightColour)?.Value
38-
?? Colour4.White;
38+
?? Colour4.White;
3939

4040
int lightFramePerSecond = skin.GetManiaSkinConfig<int>(LegacyManiaSkinConfigurationLookups.LightFramePerSecond)?.Value ?? 60;
4141

osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
2929
?? true;
3030

3131
Colour4 lineColour = skin.GetManiaSkinConfig<Colour4>(LegacyManiaSkinConfigurationLookups.JudgementLineColour)?.Value
32-
?? Colour4.White;
32+
?? Colour4.White;
3333

3434
InternalChild = directionContainer = new Container
3535
{

osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public static void ReflectVerticallyAlongPlayfield(OsuHitObject osuObject)
132132
if (osuObject is not Slider slider)
133133
return;
134134

135-
static void reflectControlPoint(PathControlPoint point) => point.Position = new Vector2(point.Position.X, -point.Position.Y);
135+
static void reflectControlPoint(PathControlPoint point) => point.Position = point.Position with { Y = -point.Position.Y };
136136

137137
modifySlider(slider, reflectControlPoint);
138138
}
@@ -143,7 +143,7 @@ public static void ReflectVerticallyAlongPlayfield(OsuHitObject osuObject)
143143
/// <param name="slider">The slider to be flipped.</param>
144144
public static void FlipSliderInPlaceHorizontally(Slider slider)
145145
{
146-
static void flipControlPoint(PathControlPoint point) => point.Position = new Vector2(-point.Position.X, point.Position.Y);
146+
static void flipControlPoint(PathControlPoint point) => point.Position = point.Position with { X = -point.Position.X };
147147

148148
modifySlider(slider, flipControlPoint);
149149
}

osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ public void TestInvalidEventStillPasses()
710710
using (var badResStream = TestResources.OpenResource("invalid-events.osu"))
711711
using (var badStream = new LineBufferedReader(badResStream))
712712
{
713-
Assert.DoesNotThrow(() => decoder.Decode(badStream));
713+
decoder.Decode(badStream);
714714
}
715715
}
716716

@@ -755,9 +755,9 @@ public void TestFallbackDecoderForCorruptedHeader()
755755
using (var resStream = TestResources.OpenResource("corrupted-header.osu"))
756756
using (var stream = new LineBufferedReader(resStream))
757757
{
758-
Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder<Beatmap>(stream));
758+
decoder = Decoder.GetDecoder<Beatmap>(stream);
759759
ClassicAssert.IsInstanceOf<LegacyBeatmapDecoder>(decoder);
760-
Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream));
760+
beatmap = decoder.Decode(stream);
761761
ClassicAssert.NotNull(beatmap);
762762
ClassicAssert.AreEqual("Beatmap with corrupted header", beatmap.Metadata.Title);
763763
ClassicAssert.AreEqual("Evil Hacker", beatmap.Metadata.Author.Username);
@@ -773,9 +773,9 @@ public void TestFallbackDecoderForMissingHeader()
773773
using (var resStream = TestResources.OpenResource("missing-header.osu"))
774774
using (var stream = new LineBufferedReader(resStream))
775775
{
776-
Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder<Beatmap>(stream));
776+
decoder = Decoder.GetDecoder<Beatmap>(stream);
777777
ClassicAssert.IsInstanceOf<LegacyBeatmapDecoder>(decoder);
778-
Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream));
778+
beatmap = decoder.Decode(stream);
779779
ClassicAssert.NotNull(beatmap);
780780
ClassicAssert.AreEqual("Beatmap with no header", beatmap.Metadata.Title);
781781
ClassicAssert.AreEqual("Incredibly Evil Hacker", beatmap.Metadata.Author.Username);
@@ -791,9 +791,9 @@ public void TestDecodeFileWithEmptyLinesAtStart()
791791
using (var resStream = TestResources.OpenResource("empty-lines-at-start.osu"))
792792
using (var stream = new LineBufferedReader(resStream))
793793
{
794-
Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder<Beatmap>(stream));
794+
decoder = Decoder.GetDecoder<Beatmap>(stream);
795795
ClassicAssert.IsInstanceOf<LegacyBeatmapDecoder>(decoder);
796-
Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream));
796+
beatmap = decoder.Decode(stream);
797797
ClassicAssert.NotNull(beatmap);
798798
ClassicAssert.AreEqual("Empty lines at start", beatmap.Metadata.Title);
799799
ClassicAssert.AreEqual("Edge Case Hunter", beatmap.Metadata.Author.Username);
@@ -809,9 +809,9 @@ public void TestDecodeFileWithEmptyLinesAndNoHeader()
809809
using (var resStream = TestResources.OpenResource("empty-line-instead-of-header.osu"))
810810
using (var stream = new LineBufferedReader(resStream))
811811
{
812-
Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder<Beatmap>(stream));
812+
decoder = Decoder.GetDecoder<Beatmap>(stream);
813813
ClassicAssert.IsInstanceOf<LegacyBeatmapDecoder>(decoder);
814-
Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream));
814+
beatmap = decoder.Decode(stream);
815815
ClassicAssert.NotNull(beatmap);
816816
ClassicAssert.AreEqual("The dog ate the file header", beatmap.Metadata.Title);
817817
ClassicAssert.AreEqual("Why does this keep happening", beatmap.Metadata.Author.Username);
@@ -827,9 +827,9 @@ public void TestDecodeFileWithContentImmediatelyAfterHeader()
827827
using (var resStream = TestResources.OpenResource("no-empty-line-after-header.osu"))
828828
using (var stream = new LineBufferedReader(resStream))
829829
{
830-
Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder<Beatmap>(stream));
830+
decoder = Decoder.GetDecoder<Beatmap>(stream);
831831
ClassicAssert.IsInstanceOf<LegacyBeatmapDecoder>(decoder);
832-
Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream));
832+
beatmap = decoder.Decode(stream);
833833
ClassicAssert.NotNull(beatmap);
834834
ClassicAssert.AreEqual("No empty line delimiting header from contents", beatmap.Metadata.Title);
835835
ClassicAssert.AreEqual("Edge Case Hunter", beatmap.Metadata.Author.Username);
@@ -839,11 +839,9 @@ public void TestDecodeFileWithContentImmediatelyAfterHeader()
839839
[Test]
840840
public void TestDecodeEmptyFile()
841841
{
842-
using (var resStream = new MemoryStream())
843-
using (var stream = new LineBufferedReader(resStream))
844-
{
845-
Assert.Throws<IOException>(() => Decoder.GetDecoder<Beatmap>(stream));
846-
}
842+
using var resStream = new MemoryStream();
843+
using var stream = new LineBufferedReader(resStream);
844+
Assert.Throws<IOException>(() => Decoder.GetDecoder<Beatmap>(stream));
847845
}
848846

849847
[Test]
@@ -854,7 +852,7 @@ public void TestAllowFallbackDecoderOverwrite()
854852
using (var resStream = TestResources.OpenResource("corrupted-header.osu"))
855853
using (var stream = new LineBufferedReader(resStream))
856854
{
857-
Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder<Beatmap>(stream));
855+
decoder = Decoder.GetDecoder<Beatmap>(stream);
858856
ClassicAssert.IsInstanceOf<LegacyBeatmapDecoder>(decoder);
859857
}
860858

@@ -863,7 +861,7 @@ public void TestAllowFallbackDecoderOverwrite()
863861
using (var resStream = TestResources.OpenResource("corrupted-header.osu"))
864862
using (var stream = new LineBufferedReader(resStream))
865863
{
866-
Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder<Beatmap>(stream));
864+
decoder = Decoder.GetDecoder<Beatmap>(stream);
867865
ClassicAssert.IsInstanceOf<LegacyDifficultyCalculatorBeatmapDecoder>(decoder);
868866
}
869867
}

osu.Game.Tests/Visual/Editing/TestSceneColoursSection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void TestNoBeatmapSkinColours()
4545
AddAssert("beatmap skin has no colours", () => skin.Configuration.CustomComboColours, () => Is.Empty);
4646
AddAssert("section displays default combo colours",
4747
() => coloursSection.ChildrenOfType<FormColourPalette>().Single().Colours,
48-
() => Is.EquivalentTo(new Colour4[]
48+
() => Is.EquivalentTo(new[]
4949
{
5050
SkinConfiguration.DefaultComboColours[1],
5151
SkinConfiguration.DefaultComboColours[2],

osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void TestDangerousButton([Values(false, true)] bool atEdge)
3636
AddStep("move mouse to button edge", () =>
3737
{
3838
var dangerousButtonQuad = dialog.DangerousButton.ScreenSpaceDrawQuad;
39-
InputManager.MoveMouseTo(new Vector2(dangerousButtonQuad.TopLeft.X + 5, dangerousButtonQuad.Centre.Y));
39+
InputManager.MoveMouseTo(dangerousButtonQuad.Centre with { X = dangerousButtonQuad.TopLeft.X + 5 });
4040
});
4141
}
4242
else

osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private void setScrollState(ScrollState newState)
135135
closest = stc;
136136
}
137137

138-
Debug.Assert(closest != null, "closest != null");
138+
Debug.Assert(closest != null);
139139

140140
offset += DrawWidth / 2f - (closest.Position.X + closest.DrawWidth / 2f);
141141

osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public partial class TeamScoreDisplay : CompositeDrawable
2323

2424
public bool ShowScore
2525
{
26-
get => teamDisplay?.ShowScore ?? false; set => teamDisplay?.ShowScore = value;
26+
get => teamDisplay?.ShowScore ?? false;
27+
set => teamDisplay?.ShowScore = value;
2728
}
2829

2930
public TeamScoreDisplay(TeamColour teamColour)

osu.Game/Graphics/Cursor/OsuTooltipContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected override void PopIn()
9797

9898
protected override void PopOut() => this.Delay(150).FadeOut(300, Easing.OutQuint);
9999

100-
public override void Move(System.Numerics.Vector2 pos)
100+
public override void Move(Vector2 pos)
101101
{
102102
if (instantMovement)
103103
{

0 commit comments

Comments
 (0)