Skip to content

Commit 85ae753

Browse files
Refactor code for consistency and clarity across various files
- Updated JSON property attributes in EditGameServerDto to use the correct JsonConverter. - Simplified object creation in FakePlayersApiTests by removing redundant namespace references. - Improved null safety in FakeAdminActionsApi by removing unnecessary null-forgiving operators. - Streamlined service registration in ServiceCollectionExtensions by removing interface specifications for singleton registrations. - Enhanced integration test setup by removing specific types in CustomWebApplicationFactory. - Cleaned up player-related assertions in PlayersTests for better readability. - Added JSON language annotations in GameServerConfigurationsControllerTests for clarity. - Updated GameServersControllerTests to ensure proper deserialization of file transport types. - Introduced .editorconfig for consistent coding standards across the project. - Refactored constructor assignments in several controllers for improved readability.
1 parent 798cd4b commit 85ae753

26 files changed

Lines changed: 303 additions & 167 deletions

File tree

.editorconfig

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
root = true
2+
3+
[*.{cs,vb}]
4+
dotnet_analyzer_diagnostic.category-naming.severity = warning
5+
dotnet_analyzer_diagnostic.category-style.severity = warning
6+
dotnet_analyzer_diagnostic.category-maintainability.severity = warning
7+
dotnet_analyzer_diagnostic.category-formatting.severity = warning
8+
dotnet_analyzer_diagnostic.category-security.severity = warning
9+
dotnet_analyzer_diagnostic.category-performance.severity = warning
10+
dotnet_analyzer_diagnostic.category-reliability.severity = warning
11+
dotnet_analyzer_diagnostic.category-usage.severity = warning
12+
13+
# Lower-noise categories can start at suggestion.
14+
dotnet_analyzer_diagnostic.category-design.severity = suggestion
15+
dotnet_analyzer_diagnostic.category-globalization.severity = suggestion
16+
17+
# C# style baseline.
18+
csharp_using_directive_placement = outside_namespace:warning
19+
csharp_style_var_for_built_in_types = true:warning
20+
csharp_style_var_when_type_is_apparent = true:warning
21+
csharp_style_var_elsewhere = true:warning
22+
csharp_style_namespace_declarations = file_scoped:warning
23+
24+
# .NET style baseline.
25+
dotnet_style_qualification_for_field = false:warning
26+
dotnet_style_qualification_for_property = false:warning
27+
dotnet_style_qualification_for_method = false:warning
28+
dotnet_style_qualification_for_event = false:warning
29+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
30+
dotnet_style_object_initializer = true:warning
31+
dotnet_style_collection_initializer = true:warning
32+
dotnet_style_prefer_auto_properties = true:warning
33+
dotnet_style_null_propagation = true:warning
34+
dotnet_style_namespace_match_folder = true:warning
35+
36+
# Public API XML documentation backlog exists; keep strict compiler warnings while not blocking rollout.
37+
dotnet_diagnostic.CS1570.severity = suggestion
38+
dotnet_diagnostic.CS1591.severity = suggestion
39+
40+
# Legacy API version namespaces/types intentionally use underscores and versioned names.
41+
dotnet_diagnostic.CA1707.severity = suggestion
42+
dotnet_diagnostic.CA1711.severity = suggestion
43+
dotnet_diagnostic.CA1716.severity = suggestion
44+
dotnet_diagnostic.CA1720.severity = suggestion
45+
46+
# Defer broad style-only churn in existing code.
47+
dotnet_diagnostic.IDE0011.severity = suggestion
48+
dotnet_diagnostic.IDE0022.severity = suggestion
49+
dotnet_diagnostic.IDE0028.severity = suggestion
50+
dotnet_diagnostic.IDE0040.severity = suggestion
51+
dotnet_diagnostic.IDE0048.severity = suggestion
52+
dotnet_diagnostic.IDE0055.severity = suggestion
53+
dotnet_diagnostic.IDE0058.severity = suggestion
54+
dotnet_diagnostic.IDE0072.severity = suggestion
55+
dotnet_diagnostic.IDE0078.severity = suggestion
56+
dotnet_diagnostic.IDE0130.severity = suggestion
57+
dotnet_diagnostic.IDE0161.severity = suggestion
58+
dotnet_diagnostic.IDE0240.severity = suggestion
59+
dotnet_diagnostic.IDE0305.severity = suggestion
60+
dotnet_diagnostic.IDE0306.severity = suggestion
61+
62+
# Defer non-functional analyzer cleanups in existing code.
63+
dotnet_diagnostic.CA1068.severity = suggestion
64+
dotnet_diagnostic.CA1304.severity = suggestion
65+
dotnet_diagnostic.CA1305.severity = suggestion
66+
dotnet_diagnostic.CA1310.severity = suggestion
67+
dotnet_diagnostic.CA1311.severity = suggestion
68+
dotnet_diagnostic.CA1826.severity = suggestion
69+
dotnet_diagnostic.CA1822.severity = suggestion
70+
dotnet_diagnostic.CA1848.severity = suggestion
71+
dotnet_diagnostic.CA1860.severity = suggestion
72+
dotnet_diagnostic.CA1861.severity = suggestion
73+
dotnet_diagnostic.CA1862.severity = suggestion
74+
dotnet_diagnostic.CA1866.severity = suggestion
75+
dotnet_diagnostic.CA2016.severity = suggestion
76+
dotnet_diagnostic.CA2201.severity = suggestion
77+
dotnet_diagnostic.CA1859.severity = suggestion
78+
dotnet_diagnostic.CA2208.severity = suggestion
79+
dotnet_diagnostic.CA2249.severity = suggestion
80+
dotnet_diagnostic.CA1816.severity = suggestion
81+
82+
dotnet_diagnostic.CS1573.severity = suggestion
83+
84+
dotnet_diagnostic.IDE0004.severity = suggestion
85+
dotnet_diagnostic.IDE0007.severity = suggestion
86+
dotnet_diagnostic.IDE0018.severity = suggestion
87+
dotnet_diagnostic.IDE0037.severity = suggestion
88+
dotnet_diagnostic.IDE0045.severity = suggestion
89+
dotnet_diagnostic.IDE0046.severity = suggestion
90+
dotnet_diagnostic.IDE0047.severity = suggestion
91+
dotnet_diagnostic.IDE0060.severity = suggestion
92+
dotnet_diagnostic.IDE0063.severity = suggestion
93+
dotnet_diagnostic.IDE0200.severity = suggestion
94+
dotnet_diagnostic.IDE0290.severity = suggestion
95+
dotnet_diagnostic.IDE0300.severity = suggestion
96+
dotnet_diagnostic.IDE0021.severity = suggestion
97+
dotnet_diagnostic.IDE0042.severity = suggestion
98+
dotnet_diagnostic.IDE0301.severity = suggestion
99+
100+
dotnet_diagnostic.xUnit1004.severity = suggestion
101+
102+
# Avoid IDE0005 build coupling to GenerateDocumentationFile during standards rollout.
103+
dotnet_diagnostic.IDE0005.severity = none
104+
105+
[**/*Tests.cs]
106+
# Keep descriptive xUnit method names with underscores for readability in test code.
107+
dotnet_diagnostic.CA1707.severity = none
108+
109+
[*.g.cs]
110+
dotnet_analyzer_diagnostic.severity = none
111+
112+
[*.Designer.cs]
113+
dotnet_analyzer_diagnostic.severity = none
114+
115+
[*.generated.cs]
116+
dotnet_analyzer_diagnostic.severity = none
117+
118+
[*.AssemblyInfo.cs]
119+
dotnet_analyzer_diagnostic.severity = none

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
contents: read
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: frasermolyneux/actions/dotnet-ci@dotnet-ci/v1.4
35+
- uses: frasermolyneux/actions/dotnet-ci@dotnet-ci/v2
3636
with:
3737
dotnet-version: |
3838
9.0.x

.github/workflows/deploy-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- id: v1-ci
21-
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
21+
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v2
2222
with:
2323
dotnet-project: "XtremeIdiots.Portal.Repository.Api.V1"
2424
dotnet-version: |
@@ -27,7 +27,7 @@ jobs:
2727
src-folder: "src"
2828
skip-nuget-artifact-upload: "true"
2929
- id: v2-ci
30-
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
30+
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v2
3131
with:
3232
dotnet-project: "XtremeIdiots.Portal.Repository.Api.V2"
3333
dotnet-version: |

.github/workflows/deploy-prd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
runs-on: ubuntu-latest
7171
steps:
7272
- id: v1-ci
73-
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
73+
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v2
7474
with:
7575
dotnet-project: "XtremeIdiots.Portal.Repository.Api.V1"
7676
dotnet-version: |
@@ -79,7 +79,7 @@ jobs:
7979
src-folder: "src"
8080
skip-nuget-artifact-upload: "true"
8181
- id: v2-ci
82-
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
82+
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v2
8383
with:
8484
dotnet-project: "XtremeIdiots.Portal.Repository.Api.V2"
8585
dotnet-version: |

.github/workflows/pr-verify.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
if: github.event.pull_request.draft == false
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: frasermolyneux/actions/dotnet-ci@dotnet-ci/v1.4
27+
- uses: frasermolyneux/actions/dotnet-ci@dotnet-ci/v2
2828
with:
2929
dotnet-version: |
3030
9.0.x
@@ -33,7 +33,7 @@ jobs:
3333
skip-nuget-artifact-upload: "true"
3434

3535
- id: v1-ci
36-
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
36+
uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v2
3737
with:
3838
dotnet-project: "XtremeIdiots.Portal.Repository.Api.V1"
3939
dotnet-version: |
@@ -42,7 +42,7 @@ jobs:
4242
src-folder: "src"
4343
skip-nuget-artifact-upload: "true"
4444

45-
- uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
45+
- uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v2
4646
with:
4747
dotnet-project: "XtremeIdiots.Portal.Repository.Api.V2"
4848
dotnet-version: |

.github/workflows/release-version-and-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
BUILD_VERSION_OVERRIDE: ${{ needs.calculate-version.outputs.nuget_version }}
8585

8686
steps:
87-
- uses: frasermolyneux/actions/dotnet-ci@dotnet-ci/v1.4
87+
- uses: frasermolyneux/actions/dotnet-ci@dotnet-ci/v2
8888
with:
8989
dotnet-version: |
9090
9.0.x

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": ".NET Core Launch (web)",
99
"type": "coreclr",
1010
"request": "launch",
11-
"preLaunchTask": "build",
11+
"preLaunchTask": "dotnet: build",
1212
// If you have changed target frameworks, make sure to update the program path.
1313
"program": "${workspaceFolder}/src/XtremeIdiots.Portal.Repository.Api.V1/bin/Debug/net9.0/XtremeIdiots.Portal.Repository.Api.V1.dll",
1414
"args": [],

.vscode/tasks.json

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "clean",
5+
"label": "dotnet: clean",
66
"command": "dotnet",
77
"type": "process",
88
"args": [
@@ -14,7 +14,7 @@
1414
"problemMatcher": "$msCompile"
1515
},
1616
{
17-
"label": "build",
17+
"label": "dotnet: build",
1818
"command": "dotnet",
1919
"type": "process",
2020
"args": [
@@ -23,15 +23,15 @@
2323
"/property:GenerateFullPaths=true",
2424
"/consoleloggerparameters:NoSummary"
2525
],
26-
"dependsOn": "clean",
26+
"dependsOn": "dotnet: clean",
2727
"group": {
2828
"kind": "build",
2929
"isDefault": true
3030
},
3131
"problemMatcher": "$msCompile"
3232
},
3333
{
34-
"label": "test",
34+
"label": "dotnet: test",
3535
"command": "dotnet",
3636
"type": "process",
3737
"args": [
@@ -49,7 +49,7 @@
4949
"problemMatcher": "$msCompile"
5050
},
5151
{
52-
"label": "test-integration",
52+
"label": "dotnet: test-integration",
5353
"command": "dotnet",
5454
"type": "process",
5555
"args": [
@@ -66,7 +66,18 @@
6666
"problemMatcher": "$msCompile"
6767
},
6868
{
69-
"label": "clean release",
69+
"label": "dotnet: format",
70+
"command": "dotnet",
71+
"type": "process",
72+
"args": [
73+
"format",
74+
"${workspaceFolder}/src/XtremeIdiots.Portal.Repository.sln",
75+
"--verify-no-changes"
76+
],
77+
"problemMatcher": "$msCompile"
78+
},
79+
{
80+
"label": "dotnet: clean-release",
7081
"command": "dotnet",
7182
"type": "process",
7283
"args": [
@@ -80,7 +91,7 @@
8091
"problemMatcher": "$msCompile"
8192
},
8293
{
83-
"label": "publish",
94+
"label": "dotnet: publish",
8495
"command": "dotnet",
8596
"type": "process",
8697
"args": [
@@ -91,11 +102,11 @@
91102
"/property:GenerateFullPaths=true",
92103
"/consoleloggerparameters:NoSummary"
93104
],
94-
"dependsOn": "clean release",
105+
"dependsOn": "dotnet: clean-release",
95106
"problemMatcher": "$msCompile"
96107
},
97108
{
98-
"label": "watch",
109+
"label": "dotnet: watch",
99110
"command": "dotnet",
100111
"type": "process",
101112
"args": [

Directory.Build.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<Project>
22
<PropertyGroup>
33
<LangVersion>latest</LangVersion>
4+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
6+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7+
<AnalysisLevel>latest-recommended</AnalysisLevel>
8+
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
9+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
410

511
<!-- NuGet package metadata -->
612
<Authors>Fraser Molyneux</Authors>

0 commit comments

Comments
 (0)