Skip to content

Commit 5cf0a60

Browse files
committed
Update configs, update packages, fix new warnings
1 parent 841c1a9 commit 5cf0a60

25 files changed

+354
-81
lines changed

.editorconfig

+29-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
# EditorConfig is awesome: http://editorconfig.org
22
root = true
33

4+
[*.{csproj,props,targets}]
5+
charset = utf-8-bom
6+
end_of_line = crlf
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 2
10+
trim_trailing_whitespace = true
11+
12+
[g_*.cs]
13+
generated_code = true
14+
415
[*.cs]
516
end_of_line = crlf
617
insert_final_newline = true
718
indent_style = space
819
indent_size = 4
920
trim_trailing_whitespace = true
1021

22+
#license header
23+
file_header_template = Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.\nSee the LICENCE file in the repository root for full licence text.
24+
1125
#Roslyn naming styles
1226

1327
#PascalCase for public and protected members
@@ -121,7 +135,7 @@ dotnet_style_qualification_for_event = false:warning
121135
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
122136
dotnet_style_predefined_type_for_member_access = true:warning
123137
csharp_style_var_when_type_is_apparent = true:none
124-
csharp_style_var_for_built_in_types = true:none
138+
csharp_style_var_for_built_in_types = false:warning
125139
csharp_style_var_elsewhere = true:silent
126140

127141
#Style - modifiers
@@ -165,7 +179,7 @@ csharp_style_unused_value_assignment_preference = discard_variable:warning
165179

166180
#Style - variable declaration
167181
csharp_style_inlined_variable_declaration = true:warning
168-
csharp_style_deconstructed_variable_declaration = true:warning
182+
csharp_style_deconstructed_variable_declaration = false:silent
169183

170184
#Style - other C# 7.x features
171185
dotnet_style_prefer_inferred_tuple_names = true:warning
@@ -176,19 +190,20 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
176190
#Style - C# 8 features
177191
csharp_prefer_static_local_function = true:warning
178192
csharp_prefer_simple_using_statement = true:silent
179-
csharp_style_prefer_index_operator = true:warning
180-
csharp_style_prefer_range_operator = true:warning
193+
csharp_style_prefer_index_operator = false:silent
194+
csharp_style_prefer_range_operator = false:silent
181195
csharp_style_prefer_switch_expression = false:none
182196

183-
#Supressing roslyn built-in analyzers
184-
# Suppress: EC112
197+
csharp_style_namespace_declarations = block_scoped:warning
198+
199+
#Style - C# 12 features
200+
csharp_style_prefer_primary_constructors = false
185201

186-
#Private method is unused
187-
dotnet_diagnostic.IDE0051.severity = silent
188-
#Private member is unused
189-
dotnet_diagnostic.IDE0052.severity = silent
202+
[*.{yaml,yml}]
203+
insert_final_newline = true
204+
indent_style = space
205+
indent_size = 2
206+
trim_trailing_whitespace = true
190207

191-
#Rules for disposable
192-
dotnet_diagnostic.IDE0067.severity = none
193-
dotnet_diagnostic.IDE0068.severity = none
194-
dotnet_diagnostic.IDE0069.severity = none
208+
dotnet_diagnostic.OLOC001.words_in_name = 5
209+
dotnet_diagnostic.OLOC001.license_header = // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text.

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ App.config text eol=crlf
1515
*.cmd text eol=crlf
1616
*.snippet text eol=crlf
1717
*.manifest text eol=crlf
18+
*.licenseheader text eol=crlf
1819

1920
# Check out with lf (UNIX) line endings
2021
*.sh text eol=lf

.gitignore

+95-18
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@
1010
# User-specific files (MonoDevelop/Xamarin Studio)
1111
*.userprefs
1212

13-
### Cake ###
14-
tools/**
15-
build/tools/**
16-
1713
# Build results
18-
bin/[Dd]ebug/
14+
[Dd]ebug/
1915
[Dd]ebugPublic/
2016
[Rr]elease/
2117
[Rr]eleases/
@@ -102,7 +98,6 @@ $tf/
10298
_ReSharper*/
10399
*.[Rr]e[Ss]harper
104100
*.DotSettings.user
105-
inspectcode
106101

107102
# JustCode is a .NET coding add-in
108103
.JustCode
@@ -196,6 +191,7 @@ ClientBin/
196191
*.publishsettings
197192
node_modules/
198193
orleans.codegen.cs
194+
Resource.designer.cs
199195

200196
# Since there are multiple workflows, uncomment next line to ignore bower_components
201197
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
@@ -251,21 +247,102 @@ paket-files/
251247
# FAKE - F# Make
252248
.fake/
253249

254-
# JetBrains Rider
255-
.idea/.idea.osu.Tools/.idea/*.xml
256-
.idea/.idea.osu.Tools/.idea/codeStyles/*.xml
257-
.idea/.idea.osu.Tools/.idea/dataSources/*.xml
258-
.idea/.idea.osu.Tools/.idea/dictionaries/*.xml
259-
.idea/.idea.osu.Tools/*.iml
260-
*.sln.iml
261-
262-
# CodeRush
263-
.cr/
264-
265250
# Python Tools for Visual Studio (PTVS)
266251
__pycache__/
267252
*.pyc
268-
Staging/
269253

254+
# Cake #
255+
/tools/**
256+
/build/tools/**
257+
/build/temp/**
258+
259+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
260+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
261+
262+
# User-specific stuff
263+
.idea/**/workspace.xml
264+
.idea/**/tasks.xml
265+
.idea/**/usage.statistics.xml
266+
.idea/**/dictionaries
267+
.idea/**/shelf
268+
.idea/*/.idea/projectSettingsUpdater.xml
269+
.idea/*/.idea/encodings.xml
270+
271+
# Generated files
272+
.idea/**/contentModel.xml
273+
274+
# Sensitive or high-churn files
275+
.idea/**/dataSources/
276+
.idea/**/dataSources.ids
277+
.idea/**/dataSources.local.xml
278+
.idea/**/sqlDataSources.xml
279+
.idea/**/dynamic.xml
280+
.idea/**/uiDesigner.xml
281+
.idea/**/dbnavigator.xml
282+
283+
# Gradle
284+
.idea/**/gradle.xml
285+
.idea/**/libraries
286+
287+
# Gradle and Maven with auto-import
288+
# When using Gradle or Maven with auto-import, you should exclude module files,
289+
# since they will be recreated, and may cause churn. Uncomment if using
290+
# auto-import.
291+
.idea/modules.xml
292+
.idea/*.iml
293+
.idea/modules
294+
*.iml
295+
*.ipr
296+
297+
# CMake
298+
cmake-build-*/
299+
300+
# Mongo Explorer plugin
301+
.idea/**/mongoSettings.xml
302+
303+
# File-based project format
304+
*.iws
305+
306+
# IntelliJ
307+
out/
308+
309+
# mpeltonen/sbt-idea plugin
310+
.idea_modules/
311+
312+
# JIRA plugin
313+
atlassian-ide-plugin.xml
314+
315+
# Cursive Clojure plugin
316+
.idea/replstate.xml
317+
318+
# Crashlytics plugin (for Android Studio and IntelliJ)
319+
com_crashlytics_export_strings.xml
320+
crashlytics.properties
321+
crashlytics-build.properties
322+
fabric.properties
323+
324+
# Editor-based Rest Client
325+
.idea/httpRequests
326+
327+
# Android studio 3.1+ serialized cache file
328+
.idea/caches/build_file_checksums.ser
329+
330+
# fastlane
331+
fastlane/report.xml
332+
333+
# inspectcode
270334
inspectcodereport.xml
335+
inspectcode
336+
337+
# BenchmarkDotNet
338+
/BenchmarkDotNet.Artifacts
339+
340+
*.GeneratedMSBuildEditorConfig.editorconfig
341+
342+
# Fody (pulled in by Realm) - schema file
343+
FodyWeavers.xsd
344+
345+
.idea/.idea.osu.Desktop/.idea/misc.xml
346+
.idea/.idea.osu.Android/.idea/deploymentTargetDropDown.xml
347+
271348
PerformanceCalculator/cache/

CodeAnalysis/BannedSymbols.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
2+
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
3+
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
4+
M:System.Nullable`1.Equals(System.Object)~System.Boolean;Use == instead.
5+
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
6+
T:SixLabors.ImageSharp.IDeepCloneable`1;Use osu.Game.Utils.IDeepCloneable<T> instead.
7+
M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.
8+
M:osu.Framework.Bindables.IBindableList`1.GetBoundCopy();Fails on iOS. Use manual ctor + BindTo instead. (see https://github.com/mono/mono/issues/19900)
9+
T:NuGet.Packaging.CollectionExtensions;Don't use internal extension methods.
10+
M:Realms.IRealmCollection`1.SubscribeForNotifications`1(Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IRealmCollection<T>,NotificationCallbackDelegate<T>) instead.
11+
M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty.
12+
M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Linq.IQueryable{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IQueryable<T>,NotificationCallbackDelegate<T>) instead.
13+
M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Collections.Generic.IList{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IList<T>,NotificationCallbackDelegate<T>) instead.
14+
M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks.
15+
P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks.
16+
M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever.
17+
M:Humanizer.InflectorExtensions.Pascalize(System.String);Humanizer's .Pascalize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToPascalCase() instead.
18+
M:Humanizer.InflectorExtensions.Camelize(System.String);Humanizer's .Camelize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToCamelCase() instead.
19+
M:Humanizer.InflectorExtensions.Underscore(System.String);Humanizer's .Underscore() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToSnakeCase() instead.
20+
M:Humanizer.InflectorExtensions.Kebaberize(System.String);Humanizer's .Kebaberize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToKebabCase() instead.

CodeAnalysis/osu.Tools.globalconfig

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# .NET Code Style
2+
# IDE styles reference: https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/
3+
is_global = true
4+
5+
# IDE0001: Simplify names
6+
dotnet_diagnostic.IDE0001.severity = warning
7+
8+
# IDE0002: Simplify member access
9+
dotnet_diagnostic.IDE0002.severity = warning
10+
11+
# IDE0003: Remove qualification
12+
dotnet_diagnostic.IDE0003.severity = warning
13+
14+
# IDE0004: Remove unnecessary cast
15+
dotnet_diagnostic.IDE0004.severity = warning
16+
17+
# IDE0005: Remove unnecessary imports
18+
dotnet_diagnostic.IDE0005.severity = warning
19+
20+
# IDE0034: Simplify default literal
21+
dotnet_diagnostic.IDE0034.severity = warning
22+
23+
# IDE0036: Sort modifiers
24+
dotnet_diagnostic.IDE0036.severity = warning
25+
26+
# IDE0040: Add accessibility modifier
27+
dotnet_diagnostic.IDE0040.severity = warning
28+
29+
# IDE0049: Use keyword for type name
30+
dotnet_diagnostic.IDE0040.severity = warning
31+
32+
# IDE0055: Fix formatting
33+
dotnet_diagnostic.IDE0055.severity = warning
34+
35+
# IDE0051: Private method is unused
36+
dotnet_diagnostic.IDE0051.severity = silent
37+
38+
# IDE0052: Private member is unused
39+
dotnet_diagnostic.IDE0052.severity = silent
40+
41+
# IDE0073: File header
42+
dotnet_diagnostic.IDE0073.severity = warning
43+
44+
# IDE0130: Namespace mismatch with folder
45+
dotnet_diagnostic.IDE0130.severity = warning
46+
47+
# IDE1006: Naming style
48+
dotnet_diagnostic.IDE1006.severity = warning
49+
50+
# CA1305: Specify IFormatProvider
51+
# Too many noisy warnings for parsing/formatting numbers
52+
dotnet_diagnostic.CA1305.severity = none
53+
54+
# CA1507: Use nameof to express symbol names
55+
# Flaggs serialization name attributes
56+
dotnet_diagnostic.CA1507.severity = suggestion
57+
58+
# CA1806: Do not ignore method results
59+
# The usages for numeric parsing are explicitly optional
60+
dotnet_diagnostic.CA1806.severity = suggestion
61+
62+
# CA1822: Mark members as static
63+
# Potential false positive around reflection/too much noise
64+
dotnet_diagnostic.CA1822.severity = none
65+
66+
# CA1826: Do not use Enumerable method on indexable collections
67+
dotnet_diagnostic.CA1826.severity = suggestion
68+
69+
# CA1859: Use concrete types when possible for improved performance
70+
# Involves design considerations
71+
dotnet_diagnostic.CA1859.severity = suggestion
72+
73+
# CA1860: Avoid using 'Enumerable.Any()' extension method
74+
dotnet_diagnostic.CA1860.severity = suggestion
75+
76+
# CA1861: Avoid constant arrays as arguments
77+
# Outdated with collection expressions
78+
dotnet_diagnostic.CA1861.severity = suggestion
79+
80+
# CA2007: Consider calling ConfigureAwait on the awaited task
81+
dotnet_diagnostic.CA2007.severity = warning
82+
83+
# CA2016: Forward the 'CancellationToken' parameter to methods
84+
# Some overloads are having special handling for debugger
85+
dotnet_diagnostic.CA2016.severity = suggestion
86+
87+
# CA2021: Do not call Enumerable.Cast<T> or Enumerable.OfType<T> with incompatible types
88+
# Causing a lot of false positives with generics
89+
dotnet_diagnostic.CA2021.severity = none
90+
91+
# CA2101: Specify marshaling for P/Invoke string arguments
92+
# Reports warning for all non-UTF16 usages on DllImport; consider migrating to LibraryImport
93+
dotnet_diagnostic.CA2101.severity = none
94+
95+
# CA2201: Do not raise reserved exception types
96+
dotnet_diagnostic.CA2201.severity = warning
97+
98+
# CA2208: Instantiate argument exceptions correctly
99+
dotnet_diagnostic.CA2208.severity = suggestion
100+
101+
# CA2242: Test for NaN correctly
102+
dotnet_diagnostic.CA2242.severity = warning
103+
104+
# Banned APIs
105+
dotnet_diagnostic.RS0030.severity = error
106+
107+
# Temporarily disable analysing CanBeNull = true in NRT contexts due to mobile issues.
108+
# See: https://github.com/ppy/osu/pull/19677
109+
dotnet_diagnostic.OSUF001.severity = none

PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private Mod[] getMods(Ruleset ruleset)
144144

145145
foreach (var modString in Mods)
146146
{
147-
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
147+
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.OrdinalIgnoreCase));
148148
if (newMod == null)
149149
throw new ArgumentException($"Invalid mod provided: {modString}");
150150

PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private Mod[] getMods(Ruleset ruleset)
9999

100100
foreach (var modString in Mods)
101101
{
102-
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
102+
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.OrdinalIgnoreCase));
103103
if (newMod == null)
104104
throw new ArgumentException($"Invalid mod provided: {modString}");
105105

PerformanceCalculator/Difficulty/ModsCommand.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using McMaster.Extensions.CommandLineUtils;
1212
using Newtonsoft.Json;
1313
using osu.Game.Configuration;
14+
using osu.Game.Extensions;
1415
using osu.Game.Rulesets;
1516
using osu.Game.Rulesets.Mods;
1617

@@ -75,7 +76,7 @@ IEnumerable<dynamic> getSettingsDefinitions(Mod mod)
7576

7677
yield return new
7778
{
78-
Name = propertyInfo.Name.Underscore(),
79+
Name = propertyInfo.Name.ToSnakeCase(),
7980
Type = getJsonType(netType),
8081
Label = settingsSource.Label.ToString(),
8182
Description = settingsSource.Description.ToString(),

0 commit comments

Comments
 (0)