From 45f2fc6128ca9aa1ab39e304d0bedcff0c425231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B3=E9=88=9E?= Date: Fri, 26 Apr 2024 06:16:08 +0800 Subject: [PATCH] chore: fix deepsource alert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陳鈞 --- ScopedServices/PlatformService/PlatformService.cs | 2 +- ScopedServices/PlatformService/YoutubeService.cs | 5 +++++ SingletonServices/DiscordService.cs | 1 + SingletonServices/Kubernetes/KubernetesService.cs | 8 ++++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ScopedServices/PlatformService/PlatformService.cs b/ScopedServices/PlatformService/PlatformService.cs index 673b4ed..c3f6159 100644 --- a/ScopedServices/PlatformService/PlatformService.cs +++ b/ScopedServices/PlatformService/PlatformService.cs @@ -78,7 +78,7 @@ public bool StepInterval(int elapsedTime) { if (!File.Exists(_ytdlPath) || !File.Exists(_ffmpegPath)) { - (var ytdlPath, var fFmpegPath) = YoutubeDL.WhereIs(); + var (ytdlPath, fFmpegPath) = YoutubeDL.WhereIs(); _ytdlPath = ytdlPath ?? throw new ConfigurationErrorsException("Yt-dlp is missing."); _ffmpegPath = fFmpegPath ?? throw new ConfigurationErrorsException("FFmpeg is missing."); } diff --git a/ScopedServices/PlatformService/YoutubeService.cs b/ScopedServices/PlatformService/YoutubeService.cs index 1f7c23f..7462fee 100644 --- a/ScopedServices/PlatformService/YoutubeService.cs +++ b/ScopedServices/PlatformService/YoutubeService.cs @@ -259,6 +259,11 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c video.Thumbnail = await DownloadThumbnailAsync(videoData.Thumbnail, video.id, cancellation); break; + + // ReSharper disable once RedundantEmptySwitchSection + default: + // Don't modify status. + break; } goto case "_live"; diff --git a/SingletonServices/DiscordService.cs b/SingletonServices/DiscordService.cs index 93e4dec..614700a 100644 --- a/SingletonServices/DiscordService.cs +++ b/SingletonServices/DiscordService.cs @@ -190,6 +190,7 @@ private ComponentBuilder GetComponentBuilder(Video video) #pragma warning disable CS0162 // 偵測到執行不到的程式碼 // ReSharper disable HeuristicUnreachableCode + // skipcq: CS-W1016 componentBuilder.WithButton(label: "Recorder.moe", style: ButtonStyle.Link, url: $"https://{_discordOption.FrontEndHost}/channels/{video.ChannelId}/videos/{video.id}", diff --git a/SingletonServices/Kubernetes/KubernetesService.cs b/SingletonServices/Kubernetes/KubernetesService.cs index 61dfe3c..06666bb 100644 --- a/SingletonServices/Kubernetes/KubernetesService.cs +++ b/SingletonServices/Kubernetes/KubernetesService.cs @@ -46,12 +46,16 @@ public KubernetesService( if (!CheckPersistentVolumeClaimExists()) { - _logger.LogCritical("PresistentVolumeClaim {name} does not exist!", PersistentVolumeClaimName); - throw new ConfigurationErrorsException($"PresistentVolumeClaim {PersistentVolumeClaimName} does not exist!"); + _logger.LogCritical("PersistentVolumeClaim {name} does not exist!", PersistentVolumeClaimName); + throw new ConfigurationErrorsException($"PersistentVolumeClaim {PersistentVolumeClaimName} does not exist!"); } break; } + case ServiceName.DockerVolume: + throw new NotImplementedException("Docker volume is not implemented yet."); + default: + throw new InvalidOperationException($"The SharedVolumeService {serviceOption.SharedVolumeService} is not defined."); } }