From 4834f262188185d9f5d6a2ce2c088fa3015d69e7 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 8 May 2024 17:43:29 -0500 Subject: [PATCH 1/2] chore: README with codacy badge --- .nuke/Build.Container.cs | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.nuke/Build.Container.cs b/.nuke/Build.Container.cs index 7a9db5b..35b795e 100644 --- a/.nuke/Build.Container.cs +++ b/.nuke/Build.Container.cs @@ -61,7 +61,7 @@ sealed partial class Build : NukeBuild }; /// - /// Return the proper image tag for a given OS. For the second tupple value, if the image mush be marked as "latest" + /// Return the proper image tag for a given OS. For the second tuple value, if the image mush be marked as "latest" /// (string, bool) ContainerRuntimeIdentifier => runtimeIdentifier switch { diff --git a/README.md b/README.md index 1f6ab1f..d130e27 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Official site: https://sucos.brunomassa.com [![Latest release](https://gitlab.com/sucos/sucos/-/badges/release.svg)](https://gitlab.com/sucos/sucos) ![Pipepline](https://gitlab.com/sucos/sucos/badges/main/pipeline.svg?ignore_skipped=true) [![Latest release](https://gitlab.com/sucos/sucos/badges/main/coverage.svg)](https://gitlab.com/sucos/sucos) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1fe0cc1ca72649ee9b85e13e7294a03a)](https://app.codacy.com/gl/sucos/sucos/dashboard?utm_source=gl&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) ## Install -- GitLab From b60243a5fe6b317895896251e5aba26c906f298b Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 8 May 2024 18:07:53 -0500 Subject: [PATCH 2/2] fix: dismiss same file changes too close to each other --- source/Commands/ServeCommand.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/Commands/ServeCommand.cs b/source/Commands/ServeCommand.cs index f62f451..253c8ce 100644 --- a/source/Commands/ServeCommand.cs +++ b/source/Commands/ServeCommand.cs @@ -54,6 +54,8 @@ public sealed class ServeCommand : BaseGeneratorCommand, IDisposable private Task? _loop; + private (WatcherChangeTypes changeType, string fullPath, DateTime dateTime) lastFileChanged; + /// /// Constructor for the ServeCommand class. /// @@ -247,11 +249,20 @@ public sealed class ServeCommand : BaseGeneratorCommand, IDisposable /// The FileSystemEventArgs containing information about the file change. private void OnSourceFileChanged(object sender, FileSystemEventArgs e) { - if (e.FullPath.Contains("\\.git\\", StringComparison.InvariantCulture)) + if (e.FullPath.Contains(@".git", StringComparison.InvariantCulture)) + { + return; + } + + if (lastFileChanged.fullPath == e.FullPath + && e.ChangeType == lastFileChanged.changeType + && (DateTime.Now - lastFileChanged.dateTime).TotalMilliseconds < 150) { return; } + lastFileChanged = (e.ChangeType, e.FullPath, DateTime.Now); + // File changes are firing multiple events in a short time. // Debounce the event handler to prevent multiple events from firing in a short time _debounceTimer?.Dispose(); -- GitLab