Skip to content

Commit c852893

Browse files
fix: address InspectCode CI errors, warnings, and notes
- Remove redundant `using System.Linq;` from MainMenuButton.cs (error) - Replace `System.Numerics.Vector2` with `Vector2` in 9 files with redundant qualifiers (warnings) - Fix null-conditional on non-nullable `existingRoom` in LoungeSubScreen.cs (warning) - Fix ternary line break formatting in DailyChallenge.cs (warning) - Remove redundant type args from nameof() in SettingsItem, DrawableScrollingRuleset, RulesetInputManager (notes) - Use `with` expression for struct copying in LinedPositionSnapGrid, RectangularPositionSnapGrid, MetronomeDisplay, TabletSettings, TabletAreaSelection, WikiPanelContainer, ModIcon, ConvertHitObject (notes) - Use `field` keyword for backing fields in PathControlPoint, DrawableRuleset, Nub, ProgressNotification, OverlayRulesetTabItem, OverlayTabControl, ProfileItemContainer, ModFlashlight (notes) Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/d2df9e0a-0c4e-428c-99df-6ab89eefe5e7 Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
1 parent 374ce22 commit c852893

30 files changed

Lines changed: 72 additions & 91 deletions

osu.Game/Graphics/UserInterface/Nub.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,12 @@ public Colour4 AccentColour
125125
}
126126
}
127127

128-
private Colour4 glowingAccentColour;
129-
130128
public Colour4 GlowingAccentColour
131129
{
132-
get => glowingAccentColour;
130+
get;
133131
set
134132
{
135-
glowingAccentColour = value;
133+
field = value;
136134
if (Glowing)
137135
main.Colour = value;
138136
}

osu.Game/Overlays/Notifications/ProgressNotification.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,13 @@ public partial class ProgressNotification : Notification, IHasCompletionTarget
4747
/// </summary>
4848
public Func<bool>? CompletionClickAction { get; set; }
4949

50-
private LocalisableString text;
51-
5250
public override LocalisableString Text
5351
{
54-
get => text;
52+
get;
5553
set
5654
{
57-
text = value;
58-
Scheduler.AddOnce(t => textDrawable.Text = t, text);
55+
field = value;
56+
Scheduler.AddOnce(t => textDrawable.Text = t, field);
5957
}
6058
}
6159

osu.Game/Overlays/OverlayRulesetTabItem.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ namespace osu.Game.Overlays
1919
{
2020
public partial class OverlayRulesetTabItem : TabItem<RulesetInfo>, IHasTooltip
2121
{
22-
private Colour4 accentColour;
23-
2422
protected virtual Colour4 AccentColour
2523
{
26-
get => accentColour;
24+
get;
2725
set
2826
{
29-
accentColour = value;
27+
field = value;
3028
icon.FadeColour(value, 120, Easing.OutQuint);
3129
}
3230
}

osu.Game/Overlays/OverlayTabControl.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,15 @@ protected partial class OverlayTabItem : TabItem<T>, IHasAccentColour
6464
protected readonly ExpandingBar Bar;
6565
protected readonly OsuSpriteText Text;
6666

67-
private Colour4 accentColour;
68-
6967
public Colour4 AccentColour
7068
{
71-
get => accentColour;
69+
get;
7270
set
7371
{
74-
if (accentColour == value)
72+
if (field == value)
7573
return;
7674

77-
accentColour = value;
75+
field = value;
7876
Bar.Colour = value;
7977

8078
updateState();

osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,22 @@ public partial class ProfileItemContainer : Container
1818
private readonly Box background;
1919
private readonly Container content;
2020

21-
private Colour4 idleColour;
22-
2321
protected Colour4 IdleColour
2422
{
25-
get => idleColour;
23+
get;
2624
set
2725
{
28-
idleColour = value;
26+
field = value;
2927
fadeBackgroundColour();
3028
}
3129
}
3230

33-
private Colour4 hoverColour;
34-
3531
protected Colour4 HoverColour
3632
{
37-
get => hoverColour;
33+
get;
3834
set
3935
{
40-
hoverColour = value;
36+
field = value;
4137
fadeBackgroundColour();
4238
}
4339
}

osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ private void checkBounds()
204204

205205
var usableAreaQuad = new Quad(
206206
new Vector2(-halfUsableArea.X, -halfUsableArea.Y),
207-
new Vector2(halfUsableArea.X, -halfUsableArea.Y),
208-
new Vector2(-halfUsableArea.X, halfUsableArea.Y),
207+
halfUsableArea with { Y = -halfUsableArea.Y },
208+
halfUsableArea with { X = -halfUsableArea.X },
209209
new Vector2(halfUsableArea.X, halfUsableArea.Y)
210210
);
211211

osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ protected override void LoadComplete()
205205
offsetY.Value = val.NewValue.Y;
206206
}), true);
207207

208-
offsetX.BindValueChanged(val => areaOffset.Value = new Vector2(val.NewValue, areaOffset.Value.Y));
209-
offsetY.BindValueChanged(val => areaOffset.Value = new Vector2(areaOffset.Value.X, val.NewValue));
208+
offsetX.BindValueChanged(val => areaOffset.Value = areaOffset.Value with { X = val.NewValue });
209+
offsetY.BindValueChanged(val => areaOffset.Value = areaOffset.Value with { Y = val.NewValue });
210210

211211
areaSize.BindTo(tabletHandler.AreaSize);
212212
areaSize.BindValueChanged(val => Schedule(() =>
@@ -220,15 +220,15 @@ protected override void LoadComplete()
220220

221221
sizeX.BindValueChanged(val =>
222222
{
223-
areaSize.Value = new Vector2(val.NewValue, areaSize.Value.Y);
223+
areaSize.Value = areaSize.Value with { X = val.NewValue };
224224

225225
aspectRatioApplication?.Cancel();
226226
aspectRatioApplication = Schedule(() => applyAspectRatio(sizeX));
227227
});
228228

229229
sizeY.BindValueChanged(val =>
230230
{
231-
areaSize.Value = new Vector2(areaSize.Value.X, val.NewValue);
231+
areaSize.Value = areaSize.Value with { Y = val.NewValue };
232232

233233
aspectRatioApplication?.Cancel();
234234
aspectRatioApplication = Schedule(() => applyAspectRatio(sizeY));

osu.Game/Overlays/Settings/SettingsItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ protected SettingsItem()
212212
// IMPORTANT: all bindable logic is in constructor intentionally to support "CreateSettingsControls" being used in a context it is
213213
// never loaded, but requires bindable storage.
214214
if (controlWithCurrent == null)
215-
throw new ArgumentException(@$"Control created via {nameof(CreateControl)} must implement {nameof(IHasCurrentValue<T>)}");
215+
throw new ArgumentException(@$"Control created via {nameof(CreateControl)} must implement {nameof(IHasCurrentValue<>)}");
216216

217217
controlWithCurrent.Current.ValueChanged += _ => SettingChanged?.Invoke();
218218
controlWithCurrent.Current.DisabledChanged += _ => updateDisabled();

osu.Game/Overlays/Wiki/WikiPanelContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void load(IAPIProvider api)
6464
protected override void Update()
6565
{
6666
base.Update();
67-
background.Size = Parent!.DrawSize * new Vector2(Size.X, 1);
67+
background.Size = Parent!.DrawSize * (Size with { Y = 1 });
6868
}
6969

7070
private partial class PanelBackground : CompositeDrawable

osu.Game/Rulesets/Mods/ModFlashlight.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,30 +180,26 @@ protected virtual float GetComboScaleFor(int combo)
180180
return 1.0f;
181181
}
182182

183-
private Vector2 flashlightPosition;
184-
185183
protected Vector2 FlashlightPosition
186184
{
187-
get => flashlightPosition;
185+
get;
188186
set
189187
{
190-
if (flashlightPosition == value) return;
188+
if (field == value) return;
191189

192-
flashlightPosition = value;
190+
field = value;
193191
Invalidate(Invalidation.DrawNode);
194192
}
195193
}
196194

197-
private Vector2 flashlightSize;
198-
199195
protected Vector2 FlashlightSize
200196
{
201-
get => flashlightSize;
197+
get;
202198
set
203199
{
204-
if (flashlightSize == value) return;
200+
if (field == value) return;
205201

206-
flashlightSize = value;
202+
field = value;
207203
Invalidate(Invalidation.DrawNode);
208204
}
209205
}

0 commit comments

Comments
 (0)