Skip to content

Commit 2c975de

Browse files
committed
polishing linting error message and more linting fixes
1 parent 9c6a140 commit 2c975de

9 files changed

Lines changed: 72 additions & 71 deletions

File tree

.github/workflows/pr-comment-warnings.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,20 @@ jobs:
8585
blocked=true
8686
fi
8787
88-
# Always list the warnings/errors in files this PR changed; expand only when blocking.
88+
# Always list the warnings/errors in files this PR changed, collapsed by default.
8989
total=$(jq -r '.pr_findings_total // 0' warning-result.json)
9090
if [ "$total" -gt 0 ]; then
91-
open_attr=""
92-
[ "$blocked" = "true" ] && open_attr=" open"
9391
echo ""
94-
echo "<details$open_attr><summary>Warnings/errors in files changed by this PR ($total)</summary>"
92+
echo "<details><summary>Warnings/errors in files changed by this PR ($total)</summary>"
9593
echo ""
96-
echo "| File | Line | Rule | Message |"
97-
echo "| --- | --- | --- | --- |"
98-
jq -r '.pr_findings[] | "| \(.file) | \(.line) | \(.rule) | \(.message | gsub("[|\r\n]"; " ")) |"' warning-result.json
94+
echo '```'
95+
jq -r '.pr_findings[] | "\(.file):\(.line) \(.rule) \(.message | gsub("[\r\n]"; " "))"' warning-result.json
9996
shown=$(jq -r '.pr_findings | length' warning-result.json)
10097
if [ "$total" -gt "$shown" ]; then
10198
echo ""
102-
echo "_…and $((total - shown)) more (see the \`csharp-lint-reports\` artifact)._"
99+
echo "…and $((total - shown)) more (see the csharp-lint-reports artifact)."
103100
fi
101+
echo '```'
104102
echo ""
105103
echo "</details>"
106104
fi

Explorer/Assets/DCL/Chat/Commands/ChatTeleporter.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public async UniTask<string> TeleportToRealmAsync(string realm, CancellationToke
6767

6868
return error.State switch
6969
{
70-
ChangeRealmError.MessageError => $"🔴 Teleport was not fully successful to {realm} world!",
71-
ChangeRealmError.NotReachable => $"🔴 Error: The world {realm} doesn't exist or not reachable!",
72-
ChangeRealmError.ChangeCancelled => "🔴 Error: The operation was canceled!",
73-
ChangeRealmError.LocalSceneDevelopmentBlocked => "🔴 Error: Realm changes are not allowed in local scene development mode",
74-
ChangeRealmError.UnauthorizedWorldAccess => "🔴 Error: User is not authorized to access the requested world",
75-
ChangeRealmError.Timeout => "🔴 Error: We were unable to connect to the realm. Please verify your connection.",
76-
ChangeRealmError.PasswordRequired => $"🔴 Error: The world {realm} requires a password to access",
77-
ChangeRealmError.PasswordCancelled => "🟡 Password entry was cancelled",
78-
ChangeRealmError.WhitelistAccessDenied => $"🔴 Error: You are not on the access list for {realm}",
70+
ChangeRealmError.MESSAGE_ERROR => $"🔴 Teleport was not fully successful to {realm} world!",
71+
ChangeRealmError.NOT_REACHABLE => $"🔴 Error: The world {realm} doesn't exist or not reachable!",
72+
ChangeRealmError.CHANGE_CANCELLED => "🔴 Error: The operation was canceled!",
73+
ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED => "🔴 Error: Realm changes are not allowed in local scene development mode",
74+
ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS => "🔴 Error: User is not authorized to access the requested world",
75+
ChangeRealmError.TIMEOUT => "🔴 Error: We were unable to connect to the realm. Please verify your connection.",
76+
ChangeRealmError.PASSWORD_REQUIRED => $"🔴 Error: The world {realm} requires a password to access",
77+
ChangeRealmError.PASSWORD_CANCELLED => "🟡 Password entry was cancelled",
78+
ChangeRealmError.WHITELIST_ACCESS_DENIED => $"🔴 Error: You are not on the access list for {realm}",
7979
_ => throw new ArgumentOutOfRangeException()
8080
};
8181
}
@@ -102,12 +102,12 @@ public async UniTask<string> TeleportToRealmAsync(string realm, Vector2Int targe
102102

103103
return error.State switch
104104
{
105-
ChangeRealmError.MessageError => $"🔴 Teleport was not fully successful to {realm} world!",
106-
ChangeRealmError.NotReachable => $"🔴 Error: The world {realm} doesn't exist or not reachable!",
107-
ChangeRealmError.ChangeCancelled => "🔴 Error: The operation was canceled!",
108-
ChangeRealmError.LocalSceneDevelopmentBlocked => "🔴 Error: Realm changes are not allowed in local scene development mode",
109-
ChangeRealmError.UnauthorizedWorldAccess => "🔴 Error: User is not authorized to access the requested world",
110-
ChangeRealmError.Timeout => "🔴 Error: We were unable to connect to the realm. Please verify your connection.",
105+
ChangeRealmError.MESSAGE_ERROR => $"🔴 Teleport was not fully successful to {realm} world!",
106+
ChangeRealmError.NOT_REACHABLE => $"🔴 Error: The world {realm} doesn't exist or not reachable!",
107+
ChangeRealmError.CHANGE_CANCELLED => "🔴 Error: The operation was canceled!",
108+
ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED => "🔴 Error: Realm changes are not allowed in local scene development mode",
109+
ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS => "🔴 Error: User is not authorized to access the requested world",
110+
ChangeRealmError.TIMEOUT => "🔴 Error: We were unable to connect to the realm. Please verify your connection.",
111111
_ => throw new ArgumentOutOfRangeException()
112112
};
113113
}
@@ -119,7 +119,7 @@ private bool ValidEnvironment(URLDomain realmURL, out string errorMessage)
119119

120120
if (!environmentValidationResult.Success)
121121
{
122-
errorMessage = environmentValidationResult.ErrorMessage;
122+
errorMessage = environmentValidationResult.ErrorMessage!;
123123
return false;
124124
}
125125

Explorer/Assets/DCL/Chat/Commands/GoToChatCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,13 @@ private async UniTask<Vector2Int> FindCrowdAsync(CancellationToken ct)
7979
return new Vector2Int(topScene.baseCoords[0], topScene.baseCoords[1]);
8080
}
8181

82+
// ReSharper disable InconsistentNaming
83+
// Archipelago hot-scenes API response - fields must match the JSON wire format.
8284
private struct HotScene
8385
{
8486
public string name;
8587
public int[] baseCoords;
8688
}
89+
// ReSharper restore InconsistentNaming
8790
}
8891
}

Explorer/Assets/DCL/Chat/MessageBus/CommandsHandleChatMessageBus.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#nullable enable
21
using Cysharp.Threading.Tasks;
32
using DCL.Chat.Commands;
43
using DCL.Chat.History;
@@ -37,7 +36,7 @@ public void Dispose()
3736
commandCts.SafeCancelAndDispose();
3837
}
3938

40-
public void Send(ChatChannel channel, string message, ChatMessageOrigin origin, double timestamp)
39+
public void Send(ChatChannel channel, string message, ChatMessageOrigin messageOrigin, double timestamp)
4140
{
4241
if (loadingStatus.CurrentStage.Value != LoadingStatus.LoadingStage.Completed)
4342
return;
@@ -49,7 +48,7 @@ public void Send(ChatChannel channel, string message, ChatMessageOrigin origin,
4948
return;
5049
}
5150

52-
this.origin.Send(channel, message, origin, timestamp);
51+
origin.Send(channel, message, messageOrigin, timestamp);
5352
}
5453

5554
private async UniTaskVoid HandleChatCommandAsync(ChatChannel.ChannelId channelId, ChatChannel.ChatChannelType channelType, string message)

Explorer/Assets/DCL/Infrastructure/Global/Dynamic/ChatContainer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using DCL.RealmNavigation;
1818
using DCL.Translation;
1919
using DCL.UI.InputFieldFormatting;
20-
using DCL.Utilities;
2120
using DCL.VoiceChat;
2221
using DCL.Web3.Identities;
2322
using ECS.SceneLifeCycle;

Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmLaunchSettings.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Text.RegularExpressions;
99
using DCL.FeatureFlags;
1010
using DCL.MapRenderer.MapLayers.HomeMarker;
11-
using DCL.Prefs;
1211
using DCL.UserInAppInitializationFlow.StartupOperations;
1312
using DCL.Utility;
1413
using Unity.Mathematics;
@@ -39,7 +38,7 @@ public struct PredefinedScenes
3938
+ "In Genesis City there are individual LiveKit rooms and only one connection at a time is maintained. "
4039
+ "Toggle this flag to equalize this behavior")] internal bool isolateSceneCommunication;
4140

42-
[SerializeField] private string[] portableExperiencesEnsToLoadAtGameStart;
41+
[SerializeField] private string[] portableExperiencesEnsToLoadAtGameStart = Array.Empty<string>();
4342

4443
private bool isLocalSceneDevelopmentRealm;
4544
internal string? spawnPointName;
@@ -90,10 +89,10 @@ public HybridSceneParams CreateHybridSceneParams()
9089
public void ApplyConfig(IAppArgs applicationParameters)
9190
{
9291
if (applicationParameters.TryGetValue(AppArgsFlags.REALM, out string? realm))
93-
ParseRealmAppParameter(applicationParameters, realm);
92+
ParseRealmAppParameter(applicationParameters, realm!);
9493

95-
if (applicationParameters.TryGetValue(AppArgsFlags.POSITION, out var parcelToTeleportOverride))
96-
ParsePositionAppParameter(parcelToTeleportOverride);
94+
if (applicationParameters.TryGetValue(AppArgsFlags.POSITION, out string? parcelToTeleportOverride))
95+
ParsePositionAppParameter(parcelToTeleportOverride!);
9796

9897
if (applicationParameters.TryGetValue(AppArgsFlags.SPAWN_POINT, out string? spawnPointOverride) && !string.IsNullOrEmpty(spawnPointOverride))
9998
spawnPointName = spawnPointOverride;
@@ -103,16 +102,16 @@ private void ParseRealmAppParameter(IAppArgs appParameters, string realmParamVal
103102
{
104103
if (string.IsNullOrEmpty(realmParamValue)) return;
105104

106-
bool isLocalSceneDevelopment = appParameters.TryGetValue(AppArgsFlags.LOCAL_SCENE, out string localSceneParamValue)
107-
&& ParseLocalSceneParameter(localSceneParamValue)
105+
bool isLocalSceneDevelopment = appParameters.TryGetValue(AppArgsFlags.LOCAL_SCENE, out string? localSceneParamValue)
106+
&& ParseLocalSceneParameter(localSceneParamValue!)
108107
&& IsRealmAValidUrl(realmParamValue);
109108

110109
if (isLocalSceneDevelopment)
111110
{
112111
SetLocalSceneDevelopmentRealm(realmParamValue, appParameters.HasFlag(AppArgsFlags.LSD_USE_REMOTE_AB) || useRemoteAssetsBundles);
113112

114113
if (appParameters.TryGetValue(AppArgsFlags.LSD_REMOTE_AB_SERVER, out string? serverValue))
115-
ParseLSDRemoteABServer(serverValue);
114+
ParseLsdRemoteABServer(serverValue!);
116115

117116
if (appParameters.TryGetValue(AppArgsFlags.LSD_REMOTE_AB_WORLD, out string? worldValue))
118117
{
@@ -146,7 +145,7 @@ private void SetLocalSceneDevelopmentRealm(string targetRealm, bool useRemoteAB)
146145
isLocalSceneDevelopmentRealm = true;
147146
}
148147

149-
private void ParseLSDRemoteABServer(string serverValue)
148+
private void ParseLsdRemoteABServer(string serverValue)
150149
{
151150
if (Enum.TryParse<HybridSceneContentServer>(serverValue, true, out var server))
152151
remoteHybridSceneContentServer = server;

Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/IRealmNavigator.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,53 @@ namespace ECS.SceneLifeCycle.Realm
99
{
1010
public enum ChangeRealmError
1111
{
12-
MessageError,
13-
ChangeCancelled,
14-
NotReachable,
15-
LocalSceneDevelopmentBlocked,
16-
UnauthorizedWorldAccess,
17-
Timeout,
12+
MESSAGE_ERROR,
13+
CHANGE_CANCELLED,
14+
NOT_REACHABLE,
15+
LOCAL_SCENE_DEVELOPMENT_BLOCKED,
16+
UNAUTHORIZED_WORLD_ACCESS,
17+
TIMEOUT,
1818

1919
/// <summary>
2020
/// World requires a password to access.
2121
/// </summary>
22-
PasswordRequired,
22+
PASSWORD_REQUIRED,
2323

2424
/// <summary>
2525
/// User cancelled the password entry.
2626
/// </summary>
27-
PasswordCancelled,
27+
PASSWORD_CANCELLED,
2828

2929
/// <summary>
3030
/// User is not on the allow-list for this world.
3131
/// </summary>
32-
WhitelistAccessDenied
32+
WHITELIST_ACCESS_DENIED
3333
}
3434

3535
public static class ChangeRealmErrors
3636
{
3737
public static TaskError AsTaskError(this ChangeRealmError e) =>
3838
e switch
3939
{
40-
ChangeRealmError.MessageError => TaskError.MessageError,
41-
ChangeRealmError.ChangeCancelled => TaskError.Cancelled,
42-
ChangeRealmError.NotReachable => TaskError.MessageError,
43-
ChangeRealmError.LocalSceneDevelopmentBlocked => TaskError.MessageError,
44-
ChangeRealmError.Timeout => TaskError.Timeout,
45-
ChangeRealmError.PasswordRequired => TaskError.MessageError,
46-
ChangeRealmError.PasswordCancelled => TaskError.Cancelled,
47-
ChangeRealmError.WhitelistAccessDenied => TaskError.MessageError,
48-
ChangeRealmError.UnauthorizedWorldAccess => TaskError.MessageError,
40+
ChangeRealmError.MESSAGE_ERROR => TaskError.MessageError,
41+
ChangeRealmError.CHANGE_CANCELLED => TaskError.Cancelled,
42+
ChangeRealmError.NOT_REACHABLE => TaskError.MessageError,
43+
ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED => TaskError.MessageError,
44+
ChangeRealmError.TIMEOUT => TaskError.Timeout,
45+
ChangeRealmError.PASSWORD_REQUIRED => TaskError.MessageError,
46+
ChangeRealmError.PASSWORD_CANCELLED => TaskError.Cancelled,
47+
ChangeRealmError.WHITELIST_ACCESS_DENIED => TaskError.MessageError,
48+
ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS => TaskError.MessageError,
4949
_ => throw new ArgumentOutOfRangeException(nameof(e), e, null)
5050
};
5151

5252
public static ChangeRealmError AsChangeRealmError(this TaskError e) =>
5353
e switch
5454
{
55-
TaskError.MessageError => ChangeRealmError.MessageError,
56-
TaskError.Timeout => ChangeRealmError.Timeout,
57-
TaskError.Cancelled => ChangeRealmError.ChangeCancelled,
58-
TaskError.UnexpectedException => ChangeRealmError.MessageError,
55+
TaskError.MessageError => ChangeRealmError.MESSAGE_ERROR,
56+
TaskError.Timeout => ChangeRealmError.TIMEOUT,
57+
TaskError.Cancelled => ChangeRealmError.CHANGE_CANCELLED,
58+
TaskError.UnexpectedException => ChangeRealmError.MESSAGE_ERROR,
5959
_ => throw new ArgumentOutOfRangeException(nameof(e), e, null)
6060
};
6161

Explorer/Assets/DCL/RealmNavigation/ITeleportController.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public interface ITeleportController
1212
{
1313
void StartTeleportToSpawnPoint(SceneEntityDefinition sceneDataSceneEntityDefinition, CancellationToken ct);
1414

15+
/// <param name="parcel">The parcel to teleport to.</param>
16+
/// <param name="loadReport">Reports the progress of the scene load.</param>
17+
/// <param name="ct">Cancellation token for the teleport operation.</param>
1518
/// <param name="landOnParcel">When true, land at <paramref name="parcel" /> itself instead of the scene's spawn point.</param>
1619
/// <param name="spawnPointName">When set, land at the scene's spawn point with this name (case-insensitive); an unmatched name falls back to the default selection.</param>
1720
UniTask<WaitForSceneReadiness?> TeleportToSceneSpawnPointAsync(Vector2Int parcel, AsyncLoadProcessReport loadReport, CancellationToken ct, bool landOnParcel = false, string? spawnPointName = null);
@@ -46,10 +49,10 @@ public bool IsConsumed() =>
4649

4750
public AssignResult Assign(Vector2Int newParcel, string? newSpawnPointName = null)
4851
{
49-
if (consumed) return AssignResult.ParcelAlreadyConsumed;
52+
if (consumed) return AssignResult.PARCEL_ALREADY_CONSUMED;
5053
value = newParcel;
5154
SpawnPointName = newSpawnPointName;
52-
return AssignResult.Ok;
55+
return AssignResult.OK;
5356
}
5457

5558
public Vector2Int ConsumeByTeleportOperation()
@@ -64,7 +67,7 @@ public Vector2Int Peek() =>
6467

6568
public enum AssignResult
6669
{
67-
Ok,
68-
ParcelAlreadyConsumed,
70+
OK,
71+
PARCEL_ALREADY_CONSUMED,
6972
}
7073
}

Explorer/Assets/DCL/RealmNavigation/RealmNavigator.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ public async UniTask<EnumResult<ChangeRealmError>> TryChangeRealmAsync(
9595
)
9696
{
9797
if (ct.IsCancellationRequested)
98-
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.ChangeCancelled);
98+
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.CHANGE_CANCELLED);
9999

100100
if (realmController.RealmData.IsLocalSceneDevelopment)
101-
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.LocalSceneDevelopmentBlocked);
101+
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED);
102102

103103
if (await realmController.IsReachableAsync(realm, ct) == false)
104-
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.NotReachable);
104+
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.NOT_REACHABLE);
105105

106106
// We use worldName != null to determine if the target is a world, instead of
107107
// RealmData.IsWorld(), because RealmData reflects the *current* realm — not the target.
@@ -116,7 +116,7 @@ public async UniTask<EnumResult<ChangeRealmError>> TryChangeRealmAsync(
116116
{
117117
ReportHub.LogWarning(ReportCategory.REALM, $"[RealmNavigator] Permission check failed for '{worldName}'");
118118
NotificationsBusController.Instance.AddNotification(new ServerErrorNotification(PERMISSION_CHECK_FAILED_MESSAGE));
119-
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.UnauthorizedWorldAccess);
119+
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS);
120120
}
121121

122122
if (result != WorldAccessResult.Allowed)
@@ -138,7 +138,7 @@ public async UniTask<EnumResult<ChangeRealmError>> TryChangeRealmAsync(
138138
globalWorld.Add(cameraEntity.Object, cameraSamplingData);
139139

140140
ReportHub.LogError(ReportCategory.REALM,
141-
$"Error trying to teleport to a realm {realm}: {loadResult.Error.Value.Message}");
141+
$"Error trying to teleport to a realm {realm}: {loadResult.Error!.Value.Message}");
142142

143143
return loadResult.As(ChangeRealmErrors.AsChangeRealmError);
144144
}
@@ -163,9 +163,9 @@ private async UniTask<WorldAccessResult> CheckWorldAccessAsync(string worldName,
163163
private static EnumResult<ChangeRealmError> MapToChangeRealmError(WorldAccessResult result) =>
164164
result switch
165165
{
166-
WorldAccessResult.Denied => EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.WhitelistAccessDenied),
167-
WorldAccessResult.PasswordCancelled => EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.PasswordCancelled),
168-
_ => EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.PasswordRequired)
166+
WorldAccessResult.Denied => EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.WHITELIST_ACCESS_DENIED),
167+
WorldAccessResult.PasswordCancelled => EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.PASSWORD_CANCELLED),
168+
_ => EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.PASSWORD_REQUIRED)
169169
};
170170

171171
private static bool TryExtractWorldName(URLDomain realm, out string worldName)

0 commit comments

Comments
 (0)