Skip to content

Commit

Permalink
fix sonarcloud, ignoring live ranking module as it will be re-written
Browse files Browse the repository at this point in the history
  • Loading branch information
snixtho committed Oct 3, 2023
1 parent a1ed3d4 commit 6cfc638
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 30 deletions.
9 changes: 5 additions & 4 deletions src/EvoSC.Common/Util/RaceTime.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using EvoSC.Common.Interfaces.Util;
using System.Globalization;
using EvoSC.Common.Interfaces.Util;

namespace EvoSC.Common.Util;

Expand Down Expand Up @@ -30,15 +31,15 @@ public static IRaceTime FromMilliseconds(int totalMilliseconds)

public override string ToString()
{
var milli = Milliseconds.ToString().PadLeft(3, '0');
var seconds = Seconds.ToString().PadLeft(2, '0');
var milli = Milliseconds.ToString(CultureInfo.InvariantCulture).PadLeft(3, '0');
var seconds = Seconds.ToString(CultureInfo.InvariantCulture).PadLeft(2, '0');

if (Minutes == 0 && Hours == 0)
{
return $"{seconds}.{milli}";
}

var minutes = Minutes.ToString().PadLeft(2, '0');
var minutes = Minutes.ToString(CultureInfo.InvariantCulture).PadLeft(2, '0');

return Hours == 0 ? $"{minutes}:{seconds}.{milli}" : $"{Hours}:{minutes}:{seconds}.{milli}";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ScoreboardCommandsController(IScoreboardService scoreboardService) =>
_scoreboardService = scoreboardService;

[ChatCommand("scoreboard", "[Command.ShowScoreboard]")]
public async Task ShowScoreboard()
public async Task ShowScoreboardAsync()
{
await _scoreboardService.ShowScoreboardAsync(Context.Player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ public ScoreboardEventController(IScoreboardService scoreboardService) =>
_scoreboardService = scoreboardService;

[Subscribe(GbxRemoteEvent.BeginMap)]
public async Task OnBeginMap(object sender, MapGbxEventArgs args)
public async Task OnBeginMapAsync(object sender, MapGbxEventArgs args)
{
await _scoreboardService.LoadAndSendRequiredAdditionalInfoAsync();
await _scoreboardService.ShowScoreboardToAllAsync();
}

[Subscribe(MatchSettingsEvent.MatchSettingsLoaded)]
public async Task OnMatchSettingsLoaded(object sender, MatchSettingsLoadedEventArgs args)
public async Task OnMatchSettingsLoadedAsync(object sender, MatchSettingsLoadedEventArgs args)
{
await _scoreboardService.LoadAndSendRequiredAdditionalInfoAsync();
await _scoreboardService.ShowScoreboardToAllAsync();
}

[Subscribe(ModeScriptEvent.StartRoundStart)]
public async Task OnRoundStart(object sender, RoundEventArgs args)
public async Task OnRoundStartAsync(object sender, RoundEventArgs args)
{
_scoreboardService.SetCurrentRound(args.Count);
await _scoreboardService.SendRequiredAdditionalInfoAsync();
Expand Down
10 changes: 5 additions & 5 deletions src/Modules/Scoreboard/Services/ScoreboardService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public ScoreboardService(IManialinkManager manialinks, IServerClient server, IEv

public async Task ShowScoreboardToAllAsync()
{
await _manialinks.SendPersistentManialinkAsync("Scoreboard.Scoreboard", await GetData());
await _manialinks.SendPersistentManialinkAsync("Scoreboard.Scoreboard", await GetDataAsync());
}

public async Task ShowScoreboardAsync(IPlayer playerLogin)
{
await _manialinks.SendManialinkAsync(playerLogin, "Scoreboard.Scoreboard", await GetData());
await _manialinks.SendManialinkAsync(playerLogin, "Scoreboard.Scoreboard", await GetDataAsync());
}

private Task<dynamic> GetData()
private Task<dynamic> GetDataAsync()
{
return Task.FromResult<dynamic>(new
{
Expand All @@ -57,7 +57,7 @@ private Task<dynamic> GetData()

public async Task HideNadeoScoreboardAsync()
{
var hudSettings = new List<string>()
var hudSettings = new List<string>
{
@"{
""uimodules"": [
Expand All @@ -77,7 +77,7 @@ public async Task HideNadeoScoreboardAsync()

public async Task ShowNadeoScoreboardAsync()
{
var hudSettings = new List<string>()
var hudSettings = new List<string>
{
@"{
""uimodules"": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ public SpectatorTargetInfoEventController(ISpectatorTargetInfoService spectatorT
_spectatorTargetInfoService = spectatorTargetInfoService;

[Subscribe(GbxRemoteEvent.PlayerConnect)]
public Task OnPlayerConnect(object x, PlayerConnectGbxEventArgs args) =>
public Task OnPlayerConnectAsync(object x, PlayerConnectGbxEventArgs args) =>
_spectatorTargetInfoService.SendManiaLinkAsync(args.Login);

[Subscribe(ModeScriptEvent.WayPoint)]
public Task OnWayPoint(object sender, WayPointEventArgs wayPointEventArgs) =>
public Task OnWayPointAsync(object sender, WayPointEventArgs wayPointEventArgs) =>
_spectatorTargetInfoService.ForwardCheckpointTimeToClientsAsync(wayPointEventArgs);

[Subscribe(ModeScriptEvent.StartRoundStart)]
public Task OnNewRound(object sender, RoundEventArgs roundEventArgs) =>
public Task OnNewRoundAsync(object sender, RoundEventArgs roundEventArgs) =>
_spectatorTargetInfoService.ResetCheckpointTimesAsync();

[Subscribe(ModeScriptEvent.GiveUp)]
public Task OnPlayerGiveUp(object sender, PlayerUpdateEventArgs playerUpdateEventArgs) =>
public Task OnPlayerGiveUpAsync(object sender, PlayerUpdateEventArgs playerUpdateEventArgs) =>
_spectatorTargetInfoService.ForwardDnfToClientsAsync(playerUpdateEventArgs);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task HideManiaLinkAsync() =>

public Task HideNadeoSpectatorInfoAsync()
{
var hudSettings = new List<string>()
var hudSettings = new List<string>
{
@"{""uimodules"": [
{
Expand All @@ -57,7 +57,7 @@ public Task HideNadeoSpectatorInfoAsync()

public Task ShowNadeoSpectatorInfoAsync()
{
var hudSettings = new List<string>()
var hudSettings = new List<string>
{
@"{""uimodules"": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public WorldRecordEventController(IWorldRecordService worldRecordService) =>
_worldRecordService = worldRecordService;

[Subscribe(ModeScriptEvent.EndMapEnd)]
public Task OnMapEnd(object sender, MapEventArgs mapEventArgs)
public Task OnMapEndAsync(object sender, MapEventArgs mapEventArgs)
=> _worldRecordService.ClearRecordAsync();

[Subscribe(ModeScriptEvent.StartMapStart)]
public Task OnMapStart(object sender, MapEventArgs mapEventArgs)
public Task OnMapStartAsync(object sender, MapEventArgs mapEventArgs)
=> _worldRecordService.FetchRecordAsync(mapEventArgs.Map.Uid);
}
9 changes: 0 additions & 9 deletions tests/Modules/MatchTrackerModule.Tests/UnitTest1.cs

This file was deleted.

0 comments on commit 6cfc638

Please sign in to comment.