Skip to content

Commit fced254

Browse files
committed
Enable selected rules for usage
1 parent 0a8ec4d commit fced254

File tree

7 files changed

+21
-16
lines changed

7 files changed

+21
-16
lines changed

.globalconfig

+5-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ dotnet_diagnostic.CA2101.severity = none
9090
# CA2201: Do not raise reserved exception types
9191
dotnet_diagnostic.CA2201.severity = warning
9292

93-
#Disable operator overloads requiring alternate named methods
94-
dotnet_diagnostic.CA2225.severity = none
93+
# CA2208: Instantiate argument exceptions correctly
94+
dotnet_diagnostic.CA2208.severity = suggestion
95+
96+
# CA2242: Test for NaN correctly
97+
dotnet_diagnostic.CA2242.severity = warning
9598

9699
# Banned APIs
97100
dotnet_diagnostic.RS0030.severity = error

Directory.Build.props

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<AnalysisModeNaming>Default</AnalysisModeNaming>
3030
<AnalysisModePerformance>Minimum</AnalysisModePerformance>
3131
<AnalysisModeReliability>Recommended</AnalysisModeReliability>
32+
<AnalysisModeSecurity>Default</AnalysisModeSecurity>
33+
<AnalysisModeUsage>Default</AnalysisModeUsage>
3234
</PropertyGroup>
3335
<PropertyGroup Label="Documentation">
3436
<GenerateDocumentationFile>true</GenerateDocumentationFile>

osu.Game.Rulesets.Mania/Skinning/Argon/ManiaArgonSkinTransformer.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
164164

165165
case 1: return colour_cyan;
166166

167-
default: throw new ArgumentOutOfRangeException();
167+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
168168
}
169169

170170
case 3:
@@ -176,7 +176,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
176176

177177
case 2: return colour_cyan;
178178

179-
default: throw new ArgumentOutOfRangeException();
179+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
180180
}
181181

182182
case 4:
@@ -190,7 +190,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
190190

191191
case 3: return colour_purple;
192192

193-
default: throw new ArgumentOutOfRangeException();
193+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
194194
}
195195

196196
case 5:
@@ -206,7 +206,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
206206

207207
case 4: return colour_cyan;
208208

209-
default: throw new ArgumentOutOfRangeException();
209+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
210210
}
211211

212212
case 6:
@@ -224,7 +224,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
224224

225225
case 5: return colour_pink;
226226

227-
default: throw new ArgumentOutOfRangeException();
227+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
228228
}
229229

230230
case 7:
@@ -244,7 +244,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
244244

245245
case 6: return colour_pink;
246246

247-
default: throw new ArgumentOutOfRangeException();
247+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
248248
}
249249

250250
case 8:
@@ -266,7 +266,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
266266

267267
case 7: return colour_purple;
268268

269-
default: throw new ArgumentOutOfRangeException();
269+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
270270
}
271271

272272
case 9:
@@ -290,7 +290,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
290290

291291
case 8: return colour_purple;
292292

293-
default: throw new ArgumentOutOfRangeException();
293+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
294294
}
295295

296296
case 10:
@@ -316,7 +316,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
316316

317317
case 9: return colour_purple;
318318

319-
default: throw new ArgumentOutOfRangeException();
319+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
320320
}
321321
}
322322

@@ -339,7 +339,7 @@ private Color4 getColourForLayout(int columnIndex, StageDefinition stage)
339339

340340
case 5: return colour_green;
341341

342-
default: throw new ArgumentOutOfRangeException();
342+
default: throw new ArgumentOutOfRangeException(nameof(columnIndex));
343343
}
344344
}
345345
}

osu.Game/Online/Leaderboards/Leaderboard.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ private void setState(LeaderboardState state)
363363
return null;
364364

365365
default:
366-
throw new ArgumentOutOfRangeException();
366+
throw new ArgumentOutOfRangeException(nameof(state));
367367
}
368368
}
369369

osu.Game/Online/OnlineViewContainer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule((
8787
break;
8888

8989
default:
90-
throw new ArgumentOutOfRangeException();
90+
throw new ArgumentOutOfRangeException(nameof(state.NewValue));
9191
}
9292
});
9393

osu.Game/Overlays/AccountCreationOverlay.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private void apiStateChanged(ValueChangedEvent<APIState> state)
126126
break;
127127

128128
default:
129-
throw new ArgumentOutOfRangeException();
129+
throw new ArgumentOutOfRangeException(nameof(state.NewValue));
130130
}
131131
}
132132
}

osu.Game/Overlays/Toolbar/ToolbarUserButton.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule((
130130
break;
131131

132132
default:
133-
throw new ArgumentOutOfRangeException();
133+
throw new ArgumentOutOfRangeException(nameof(state.NewValue));
134134
}
135135
});
136136
}

0 commit comments

Comments
 (0)