From f49ffbe612ce0e656e79e8ed51eba585b3fba49f Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 18 Oct 2023 11:02:55 -0300 Subject: [PATCH 1/3] refactor: Implicit Usings --- .build.Nuke/Build.Container.cs | 2 +- .build.Nuke/Build.GitLab.cs | 4 ++-- .build.Nuke/Build.Test.cs | 18 +++++++++--------- source/BaseGeneratorCommand.cs | 3 --- source/BuildCommand.cs | 4 ---- source/Helpers/FileUtils.cs | 4 ---- source/Helpers/SiteCacheManager.cs | 4 +--- source/Helpers/SiteHelper.cs | 2 -- source/Helpers/SourceFileWatcher.cs | 3 +-- source/Helpers/StopwatchReporter.cs | 5 +---- source/Helpers/Urlizer.cs | 2 -- .../Models/CommandLineOptions/BuildOptions.cs | 2 -- source/Models/FrontMatter.cs | 3 --- source/Models/FrontMatterResources.cs | 1 - source/Models/IFile.cs | 1 - source/SuCoS.csproj | 2 +- .../RegisteredPageRequestHandlerTests.cs | 3 --- .../StaticFileRequestHandlerTests.cs | 3 ++- 18 files changed, 18 insertions(+), 48 deletions(-) diff --git a/.build.Nuke/Build.Container.cs b/.build.Nuke/Build.Container.cs index 45db07a..9951ab8 100644 --- a/.build.Nuke/Build.Container.cs +++ b/.build.Nuke/Build.Container.cs @@ -21,7 +21,7 @@ sealed partial class Build : NukeBuild [Parameter("GitLab Project Full Address")] readonly string containerDefaultRID = "linux-x64"; - Target CreateContainer => _ => _ + public Target CreateContainer => _ => _ .DependsOn(Publish) .DependsOn(CheckNewCommits) .OnlyWhenStatic(() => runtimeIdentifier != "win-x64") diff --git a/.build.Nuke/Build.GitLab.cs b/.build.Nuke/Build.GitLab.cs index 69fc805..ca3d909 100644 --- a/.build.Nuke/Build.GitLab.cs +++ b/.build.Nuke/Build.GitLab.cs @@ -42,7 +42,7 @@ sealed partial class Build : NukeBuild /// One for each runtime identifier. /// /// - Target CreatePackage => _ => _ + public Target CreatePackage => _ => _ .DependsOn(Publish) .DependsOn(CheckNewCommits) .Requires(() => gitlabPrivateToken) @@ -97,7 +97,7 @@ sealed partial class Build : NukeBuild /// Creates a release in the GitLab repository. /// /// - Target GitLabCreateRelease => _ => _ + public Target GitLabCreateRelease => _ => _ .DependsOn(GitLabCreateTag) .OnlyWhenStatic(() => HasNewCommits) .Requires(() => gitlabPrivateToken) diff --git a/.build.Nuke/Build.Test.cs b/.build.Nuke/Build.Test.cs index 8ed7a10..87130c4 100644 --- a/.build.Nuke/Build.Test.cs +++ b/.build.Nuke/Build.Test.cs @@ -17,14 +17,14 @@ namespace SuCoS; /// sealed partial class Build : NukeBuild { - AbsolutePath testDirectory => RootDirectory / "test"; - AbsolutePath testDLLDirectory => testDirectory / "bin" / "Debug" / "net7.0"; - AbsolutePath testAssembly => testDLLDirectory / "test.dll"; - AbsolutePath coverageDirectory => RootDirectory / "coverage-results"; - AbsolutePath coverageResultDirectory => coverageDirectory / "coverage"; - AbsolutePath coverageResultFile => coverageResultDirectory / "coverage.xml"; - AbsolutePath coverageReportDirectory => coverageDirectory / "report"; - AbsolutePath coverageReportSummaryDirectory => coverageReportDirectory / "Summary.txt"; + static AbsolutePath testDirectory => RootDirectory / "test"; + static AbsolutePath testDLLDirectory => testDirectory / "bin" / "Debug" / "net7.0"; + static AbsolutePath testAssembly => testDLLDirectory / "test.dll"; + static AbsolutePath coverageDirectory => RootDirectory / "coverage-results"; + static AbsolutePath coverageResultDirectory => coverageDirectory / "coverage"; + static AbsolutePath coverageResultFile => coverageResultDirectory / "coverage.xml"; + static AbsolutePath coverageReportDirectory => coverageDirectory / "report"; + static AbsolutePath coverageReportSummaryDirectory => coverageReportDirectory / "Summary.txt"; Target Test => _ => _ .DependsOn(Compile) @@ -40,7 +40,7 @@ sealed partial class Build : NukeBuild .SetFormat(CoverletOutputFormat.cobertura)); }); - Target TestReport => _ => _ + public Target TestReport => _ => _ .DependsOn(Test) .Executes(() => { diff --git a/source/BaseGeneratorCommand.cs b/source/BaseGeneratorCommand.cs index d11b59f..3b216ca 100644 --- a/source/BaseGeneratorCommand.cs +++ b/source/BaseGeneratorCommand.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; using Fluid; using Fluid.Values; using Serilog; diff --git a/source/BuildCommand.cs b/source/BuildCommand.cs index 92cceca..46f9bdc 100644 --- a/source/BuildCommand.cs +++ b/source/BuildCommand.cs @@ -1,7 +1,3 @@ -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; using Serilog; using SuCoS.Models; using SuCoS.Models.CommandLineOptions; diff --git a/source/Helpers/FileUtils.cs b/source/Helpers/FileUtils.cs index 25c490e..5125bb8 100644 --- a/source/Helpers/FileUtils.cs +++ b/source/Helpers/FileUtils.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using SuCoS.Models; namespace SuCoS.Helpers; diff --git a/source/Helpers/SiteCacheManager.cs b/source/Helpers/SiteCacheManager.cs index a689967..b58619a 100644 --- a/source/Helpers/SiteCacheManager.cs +++ b/source/Helpers/SiteCacheManager.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Concurrent; -using System.Collections.Generic; using SuCoS.Models; namespace SuCoS.Helpers; @@ -34,4 +32,4 @@ public class SiteCacheManager contentTemplateCache.Clear(); automaticContentCache.Clear(); } -} \ No newline at end of file +} diff --git a/source/Helpers/SiteHelper.cs b/source/Helpers/SiteHelper.cs index 910030e..ebc7346 100644 --- a/source/Helpers/SiteHelper.cs +++ b/source/Helpers/SiteHelper.cs @@ -1,5 +1,3 @@ -using System; -using System.IO; using Fluid; using Markdig; using Microsoft.Extensions.FileProviders; diff --git a/source/Helpers/SourceFileWatcher.cs b/source/Helpers/SourceFileWatcher.cs index 3129fcd..33b669c 100644 --- a/source/Helpers/SourceFileWatcher.cs +++ b/source/Helpers/SourceFileWatcher.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +namespace SuCoS.Helpers; /// /// The FileSystemWatcher object that monitors the source directory for file changes. diff --git a/source/Helpers/StopwatchReporter.cs b/source/Helpers/StopwatchReporter.cs index a8c6d7d..54543d6 100644 --- a/source/Helpers/StopwatchReporter.cs +++ b/source/Helpers/StopwatchReporter.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; using System.Diagnostics; using System.Globalization; -using System.Linq; using Serilog; namespace SuCoS.Helpers; @@ -104,4 +101,4 @@ Total {totalDurationAllSteps} ms // Log the report logger.Information(report, siteTitle); } -} \ No newline at end of file +} diff --git a/source/Helpers/Urlizer.cs b/source/Helpers/Urlizer.cs index 5d07b96..a3976f3 100644 --- a/source/Helpers/Urlizer.cs +++ b/source/Helpers/Urlizer.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using System.Globalization; using System.Text.RegularExpressions; diff --git a/source/Models/CommandLineOptions/BuildOptions.cs b/source/Models/CommandLineOptions/BuildOptions.cs index 3710cdf..fa14596 100644 --- a/source/Models/CommandLineOptions/BuildOptions.cs +++ b/source/Models/CommandLineOptions/BuildOptions.cs @@ -1,5 +1,3 @@ -using System.IO; - namespace SuCoS.Models.CommandLineOptions; /// diff --git a/source/Models/FrontMatter.cs b/source/Models/FrontMatter.cs index eddbeb6..5bb5d76 100644 --- a/source/Models/FrontMatter.cs +++ b/source/Models/FrontMatter.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.IO; using YamlDotNet.Serialization; namespace SuCoS.Models; diff --git a/source/Models/FrontMatterResources.cs b/source/Models/FrontMatterResources.cs index 440d6df..96833a7 100644 --- a/source/Models/FrontMatterResources.cs +++ b/source/Models/FrontMatterResources.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using Microsoft.Extensions.FileSystemGlobbing; namespace SuCoS.Models; diff --git a/source/Models/IFile.cs b/source/Models/IFile.cs index c7cf50f..fe2b817 100644 --- a/source/Models/IFile.cs +++ b/source/Models/IFile.cs @@ -1,4 +1,3 @@ -using System.IO; using FolkerKinzel.MimeTypes; // using Microsoft.AspNetCore.StaticFiles; diff --git a/source/SuCoS.csproj b/source/SuCoS.csproj index 18fec05..6abc136 100644 --- a/source/SuCoS.csproj +++ b/source/SuCoS.csproj @@ -4,7 +4,7 @@ Exe net7.0 enable - + enable true diff --git a/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs b/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs index bce4b15..495e845 100644 --- a/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs +++ b/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs @@ -1,15 +1,12 @@ using NSubstitute; using SuCoS.Models.CommandLineOptions; using SuCoS.ServerHandlers; -using System.Net; using Xunit; namespace Tests.ServerHandlers; public class RegisteredPageRequestHandlerTests : TestSetup { - private readonly HttpClient _httpClient = new HttpClient(); - [Theory] [InlineData("/", true)] [InlineData("/testPage", false)] diff --git a/test/ServerHandlers/StaticFileRequestHandlerTests.cs b/test/ServerHandlers/StaticFileRequestHandlerTests.cs index 6e61839..c656a0c 100644 --- a/test/ServerHandlers/StaticFileRequestHandlerTests.cs +++ b/test/ServerHandlers/StaticFileRequestHandlerTests.cs @@ -7,7 +7,6 @@ namespace Tests.ServerHandlers; public class StaticFileRequestHandlerTests : TestSetup, IDisposable { private readonly string tempFilePath; - private readonly HttpClient _httpClient = new HttpClient(); public StaticFileRequestHandlerTests() : base() { @@ -68,5 +67,7 @@ public class StaticFileRequestHandlerTests : TestSetup, IDisposable { File.Delete(tempFilePath); } + + GC.SuppressFinalize(this); } } -- GitLab From 312ff00c16d4afec9b6996988cbbaede63b43d62 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 18 Oct 2023 11:05:36 -0300 Subject: [PATCH 2/3] refactor: retorder usings --- .build.Nuke/Build.Container.cs | 4 ++-- .build.Nuke/Build.GitLab.cs | 10 +++++----- .build.Nuke/Build.Test.cs | 8 ++++---- .build.Nuke/Build.Version.cs | 2 +- .build.Nuke/Configuration.cs | 2 +- source/Helpers/SiteCacheManager.cs | 2 +- source/Helpers/StopwatchReporter.cs | 2 +- source/Models/IFrontMatter.cs | 2 -- source/Models/IPage.cs | 5 +---- source/Models/IParams.cs | 2 -- source/Models/ISite.cs | 4 +--- source/Models/ISystemClock.cs | 2 -- source/Models/Page.cs | 6 +----- source/Models/Resource.cs | 6 ++---- source/Models/Site.cs | 8 +------- source/Models/SiteSettings.cs | 3 --- source/Parser/YAMLParser.cs | 6 +----- source/Program.cs | 7 +++---- source/ServeCommand.cs | 8 +------- source/ServerHandlers/HttpListenerResponseWrapper.cs | 1 - source/ServerHandlers/IHttpListenerResponse.cs | 2 -- source/ServerHandlers/IServerHandlers.cs | 3 --- source/ServerHandlers/PingRequests.cs | 4 ---- source/ServerHandlers/RegisteredPageRequest.cs | 5 +---- source/ServerHandlers/RegisteredPageResourceRequest.cs | 5 +---- source/ServerHandlers/StaticFileRequest.cs | 6 +----- test/BaseGeneratorCommandTests.cs | 2 +- test/Helpers/StopwatchReporterTests.cs | 6 +++--- test/Helpers/UrlizerTests.cs | 2 +- test/Models/FrontMatterTests.cs | 2 +- test/Models/SiteTests.cs | 4 ++-- test/Parser/YAMLParserTests.cs | 6 +++--- test/TestSetup.cs | 2 +- 33 files changed, 41 insertions(+), 98 deletions(-) diff --git a/.build.Nuke/Build.Container.cs b/.build.Nuke/Build.Container.cs index 9951ab8..f80c5a5 100644 --- a/.build.Nuke/Build.Container.cs +++ b/.build.Nuke/Build.Container.cs @@ -1,9 +1,9 @@ using Nuke.Common; -using Serilog; using Nuke.Common.Tooling; using Nuke.Common.Tools.Docker; -using System.Linq; +using Serilog; using System; +using System.Linq; namespace SuCoS; diff --git a/.build.Nuke/Build.GitLab.cs b/.build.Nuke/Build.GitLab.cs index ca3d909..f9b5879 100644 --- a/.build.Nuke/Build.GitLab.cs +++ b/.build.Nuke/Build.GitLab.cs @@ -1,14 +1,14 @@ +using Nuke.Common; +using Nuke.Common.CI.GitLab; +using Nuke.Common.IO; +using Nuke.Common.Tools.Git; +using Serilog; using System; using System.Globalization; using System.IO; using System.IO.Compression; using System.Net.Http; using System.Net.Http.Json; -using Nuke.Common; -using Nuke.Common.CI.GitLab; -using Nuke.Common.IO; -using Nuke.Common.Tools.Git; -using Serilog; namespace SuCoS; diff --git a/.build.Nuke/Build.Test.cs b/.build.Nuke/Build.Test.cs index 87130c4..766b351 100644 --- a/.build.Nuke/Build.Test.cs +++ b/.build.Nuke/Build.Test.cs @@ -1,13 +1,13 @@ using Nuke.Common; +using Nuke.Common.IO; +using Nuke.Common.Tools.Coverlet; using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.OpenCover; -using static Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks; using Nuke.Common.Tools.ReportGenerator; -using Nuke.Common.IO; -using Nuke.Common.Tools.Coverlet; -using static Nuke.Common.Tools.Coverlet.CoverletTasks; using Serilog; using System; +using static Nuke.Common.Tools.Coverlet.CoverletTasks; +using static Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks; namespace SuCoS; diff --git a/.build.Nuke/Build.Version.cs b/.build.Nuke/Build.Version.cs index a87d89b..eb19708 100644 --- a/.build.Nuke/Build.Version.cs +++ b/.build.Nuke/Build.Version.cs @@ -1,8 +1,8 @@ -using System.Linq; using Nuke.Common; using Nuke.Common.Tools.Git; using Nuke.Common.Tools.GitVersion; using Serilog; +using System.Linq; namespace SuCoS; diff --git a/.build.Nuke/Configuration.cs b/.build.Nuke/Configuration.cs index 2cb3ee5..5fde430 100644 --- a/.build.Nuke/Configuration.cs +++ b/.build.Nuke/Configuration.cs @@ -1,5 +1,5 @@ -using System.ComponentModel; using Nuke.Common.Tooling; +using System.ComponentModel; namespace SuCoS; diff --git a/source/Helpers/SiteCacheManager.cs b/source/Helpers/SiteCacheManager.cs index b58619a..5391bbf 100644 --- a/source/Helpers/SiteCacheManager.cs +++ b/source/Helpers/SiteCacheManager.cs @@ -1,5 +1,5 @@ -using System.Collections.Concurrent; using SuCoS.Models; +using System.Collections.Concurrent; namespace SuCoS.Helpers; diff --git a/source/Helpers/StopwatchReporter.cs b/source/Helpers/StopwatchReporter.cs index 54543d6..c7d4458 100644 --- a/source/Helpers/StopwatchReporter.cs +++ b/source/Helpers/StopwatchReporter.cs @@ -1,6 +1,6 @@ +using Serilog; using System.Diagnostics; using System.Globalization; -using Serilog; namespace SuCoS.Helpers; diff --git a/source/Models/IFrontMatter.cs b/source/Models/IFrontMatter.cs index 0bc3699..c87eadb 100644 --- a/source/Models/IFrontMatter.cs +++ b/source/Models/IFrontMatter.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using SuCoS.Models.CommandLineOptions; namespace SuCoS.Models; diff --git a/source/Models/IPage.cs b/source/Models/IPage.cs index cd300c5..d979b7f 100644 --- a/source/Models/IPage.cs +++ b/source/Models/IPage.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; using Markdig; using SuCoS.Helpers; +using System.Collections.Concurrent; namespace SuCoS.Models; diff --git a/source/Models/IParams.cs b/source/Models/IParams.cs index ed73249..83da54a 100644 --- a/source/Models/IParams.cs +++ b/source/Models/IParams.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - namespace SuCoS.Models; /// diff --git a/source/Models/ISite.cs b/source/Models/ISite.cs index 5c96b67..5868b54 100644 --- a/source/Models/ISite.cs +++ b/source/Models/ISite.cs @@ -1,10 +1,8 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; using Fluid; using Serilog; using SuCoS.Helpers; using SuCoS.Models.CommandLineOptions; +using System.Collections.Concurrent; namespace SuCoS.Models; diff --git a/source/Models/ISystemClock.cs b/source/Models/ISystemClock.cs index bd38900..b4bd179 100644 --- a/source/Models/ISystemClock.cs +++ b/source/Models/ISystemClock.cs @@ -1,5 +1,3 @@ -using System; - namespace SuCoS.Models; /// diff --git a/source/Models/Page.cs b/source/Models/Page.cs index 5de36df..5f88cb5 100644 --- a/source/Models/Page.cs +++ b/source/Models/Page.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Fluid; using Markdig; using Microsoft.Extensions.FileSystemGlobbing; using SuCoS.Helpers; +using System.Collections.Concurrent; namespace SuCoS.Models; diff --git a/source/Models/Resource.cs b/source/Models/Resource.cs index 66cf808..e4cdb62 100644 --- a/source/Models/Resource.cs +++ b/source/Models/Resource.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - namespace SuCoS.Models; /// @@ -17,8 +15,8 @@ public class Resource : IResource public string SourceFullPath { get; set; } /// - public string? SourceRelativePath => throw new System.NotImplementedException(); - + public string? SourceRelativePath => throw new NotImplementedException(); + /// public string? Permalink { get; set; } diff --git a/source/Models/Site.cs b/source/Models/Site.cs index dd89c68..3df334f 100644 --- a/source/Models/Site.cs +++ b/source/Models/Site.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Fluid; using Serilog; using SuCoS.Helpers; using SuCoS.Models.CommandLineOptions; using SuCoS.Parser; +using System.Collections.Concurrent; namespace SuCoS.Models; diff --git a/source/Models/SiteSettings.cs b/source/Models/SiteSettings.cs index 1c137b3..60deca4 100644 --- a/source/Models/SiteSettings.cs +++ b/source/Models/SiteSettings.cs @@ -1,6 +1,3 @@ - -using System.Collections.Generic; - namespace SuCoS.Models; /// diff --git a/source/Parser/YAMLParser.cs b/source/Parser/YAMLParser.cs index b827ce2..36ca94d 100644 --- a/source/Parser/YAMLParser.cs +++ b/source/Parser/YAMLParser.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; using SuCoS.Helpers; using SuCoS.Models; +using System.Text; using YamlDotNet.Serialization; namespace SuCoS.Parser; diff --git a/source/Program.cs b/source/Program.cs index a85f7da..2d5f094 100644 --- a/source/Program.cs +++ b/source/Program.cs @@ -1,9 +1,8 @@ -using System.CommandLine; -using System.Reflection; -using System.Threading.Tasks; -using Serilog; +using Serilog; using Serilog.Events; using SuCoS.Models.CommandLineOptions; +using System.CommandLine; +using System.Reflection; namespace SuCoS; diff --git a/source/ServeCommand.cs b/source/ServeCommand.cs index e0b6668..a0044ae 100644 --- a/source/ServeCommand.cs +++ b/source/ServeCommand.cs @@ -1,14 +1,8 @@ -using System; -using System.IO; -using System.Net; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.VisualBasic; using Serilog; using SuCoS.Helpers; using SuCoS.Models.CommandLineOptions; using SuCoS.ServerHandlers; +using System.Net; namespace SuCoS; diff --git a/source/ServerHandlers/HttpListenerResponseWrapper.cs b/source/ServerHandlers/HttpListenerResponseWrapper.cs index 5bd1cd6..fa2b32c 100644 --- a/source/ServerHandlers/HttpListenerResponseWrapper.cs +++ b/source/ServerHandlers/HttpListenerResponseWrapper.cs @@ -1,4 +1,3 @@ -using System.IO; using System.Net; namespace SuCoS.ServerHandlers; diff --git a/source/ServerHandlers/IHttpListenerResponse.cs b/source/ServerHandlers/IHttpListenerResponse.cs index 34f1a82..415ef15 100644 --- a/source/ServerHandlers/IHttpListenerResponse.cs +++ b/source/ServerHandlers/IHttpListenerResponse.cs @@ -1,5 +1,3 @@ -using System.IO; - namespace SuCoS.ServerHandlers; /// diff --git a/source/ServerHandlers/IServerHandlers.cs b/source/ServerHandlers/IServerHandlers.cs index a354f51..5a4a578 100644 --- a/source/ServerHandlers/IServerHandlers.cs +++ b/source/ServerHandlers/IServerHandlers.cs @@ -1,6 +1,3 @@ -using System; -using System.Threading.Tasks; - namespace SuCoS.ServerHandlers; /// diff --git a/source/ServerHandlers/PingRequests.cs b/source/ServerHandlers/PingRequests.cs index 7465585..ba5e439 100644 --- a/source/ServerHandlers/PingRequests.cs +++ b/source/ServerHandlers/PingRequests.cs @@ -1,7 +1,3 @@ -using System; -using System.Threading.Tasks; -using System.IO; - namespace SuCoS.ServerHandlers; /// diff --git a/source/ServerHandlers/RegisteredPageRequest.cs b/source/ServerHandlers/RegisteredPageRequest.cs index ad6e48e..a80f5c6 100644 --- a/source/ServerHandlers/RegisteredPageRequest.cs +++ b/source/ServerHandlers/RegisteredPageRequest.cs @@ -1,8 +1,5 @@ -using System; -using System.IO; -using System.Reflection; -using System.Threading.Tasks; using SuCoS.Models; +using System.Reflection; namespace SuCoS.ServerHandlers; diff --git a/source/ServerHandlers/RegisteredPageResourceRequest.cs b/source/ServerHandlers/RegisteredPageResourceRequest.cs index c61183a..0633c5f 100644 --- a/source/ServerHandlers/RegisteredPageResourceRequest.cs +++ b/source/ServerHandlers/RegisteredPageResourceRequest.cs @@ -1,8 +1,5 @@ -using System; -using System.IO; -using System.Reflection; -using System.Threading.Tasks; using SuCoS.Models; +using System.Reflection; namespace SuCoS.ServerHandlers; diff --git a/source/ServerHandlers/StaticFileRequest.cs b/source/ServerHandlers/StaticFileRequest.cs index 16e6a0b..d3f3640 100644 --- a/source/ServerHandlers/StaticFileRequest.cs +++ b/source/ServerHandlers/StaticFileRequest.cs @@ -1,7 +1,3 @@ -using System; -using System.IO; -using System.Threading.Tasks; -using System.Net; using FolkerKinzel.MimeTypes; namespace SuCoS.ServerHandlers; @@ -48,7 +44,7 @@ public class StaticFileRequest : IServerHandlers throw new ArgumentNullException(nameof(response)); } - var fileAbsolutePath = Path.Combine(basePath, requestPath.TrimStart('/')); + var fileAbsolutePath = Path.Combine(basePath, requestPath.TrimStart('/')); response.ContentType = GetContentType(fileAbsolutePath!); await using var fileStream = new FileStream(fileAbsolutePath!, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); response.ContentLength64 = fileStream.Length; diff --git a/test/BaseGeneratorCommandTests.cs b/test/BaseGeneratorCommandTests.cs index 9e1ba7d..475efd4 100644 --- a/test/BaseGeneratorCommandTests.cs +++ b/test/BaseGeneratorCommandTests.cs @@ -1,7 +1,7 @@ -using System.Reflection; using Serilog; using SuCoS; using SuCoS.Models.CommandLineOptions; +using System.Reflection; using Xunit; namespace Tests; diff --git a/test/Helpers/StopwatchReporterTests.cs b/test/Helpers/StopwatchReporterTests.cs index 3cfd406..fcfc0b5 100644 --- a/test/Helpers/StopwatchReporterTests.cs +++ b/test/Helpers/StopwatchReporterTests.cs @@ -1,10 +1,10 @@ -using System.Diagnostics; -using System.Globalization; -using System.Reflection; using Serilog; using Serilog.Sinks.InMemory; using SuCoS.Helpers; +using System.Diagnostics; +using System.Globalization; +using System.Reflection; using Xunit; namespace Tests.Helpers; diff --git a/test/Helpers/UrlizerTests.cs b/test/Helpers/UrlizerTests.cs index 494a47e..e1e8e7e 100644 --- a/test/Helpers/UrlizerTests.cs +++ b/test/Helpers/UrlizerTests.cs @@ -1,5 +1,5 @@ -using Xunit; using SuCoS.Helpers; +using Xunit; namespace Tests.Helpers; diff --git a/test/Models/FrontMatterTests.cs b/test/Models/FrontMatterTests.cs index 6dbcde6..5412e1d 100644 --- a/test/Models/FrontMatterTests.cs +++ b/test/Models/FrontMatterTests.cs @@ -1,5 +1,5 @@ -using System.Globalization; using SuCoS.Models; +using System.Globalization; using Xunit; namespace Tests.Models; diff --git a/test/Models/SiteTests.cs b/test/Models/SiteTests.cs index 9f67b0e..f1ff2cb 100644 --- a/test/Models/SiteTests.cs +++ b/test/Models/SiteTests.cs @@ -1,6 +1,6 @@ -using Xunit; -using SuCoS.Models.CommandLineOptions; using SuCoS.Models; +using SuCoS.Models.CommandLineOptions; +using Xunit; namespace Tests.Models; diff --git a/test/Parser/YAMLParserTests.cs b/test/Parser/YAMLParserTests.cs index a375889..b737221 100644 --- a/test/Parser/YAMLParserTests.cs +++ b/test/Parser/YAMLParserTests.cs @@ -1,8 +1,8 @@ -using Xunit; -using SuCoS.Parser; -using System.Globalization; using SuCoS.Helpers; using SuCoS.Models; +using SuCoS.Parser; +using System.Globalization; +using Xunit; namespace Tests.Parser; diff --git a/test/TestSetup.cs b/test/TestSetup.cs index f11d0af..ac0602e 100644 --- a/test/TestSetup.cs +++ b/test/TestSetup.cs @@ -1,5 +1,5 @@ -using Serilog; using NSubstitute; +using Serilog; using SuCoS.Models; using SuCoS.Models.CommandLineOptions; using SuCoS.Parser; -- GitLab From d908214a184333111e6993a9e851323733782f08 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 18 Oct 2023 11:25:48 -0300 Subject: [PATCH 3/3] fix: necessary using --- source/Helpers/IFileWatcher.cs | 20 ++++++++++++++++++++ source/Helpers/SourceFileWatcher.cs | 19 ------------------- source/Program.cs | 1 + 3 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 source/Helpers/IFileWatcher.cs diff --git a/source/Helpers/IFileWatcher.cs b/source/Helpers/IFileWatcher.cs new file mode 100644 index 0000000..75e2045 --- /dev/null +++ b/source/Helpers/IFileWatcher.cs @@ -0,0 +1,20 @@ +namespace SuCoS.Helpers; + +/// +/// The FileSystemWatcher object that monitors the source directory for file changes. +/// +public interface IFileWatcher +{ + /// + /// Starts the file watcher to monitor file changes in the specified source path. + /// + /// The path to the source directory. + /// + /// The created FileSystemWatcher object. + void Start(string SourceAbsolutePath, Action OnSourceFileChanged); + + /// + /// Disposes the file watcher + /// + void Stop(); +} diff --git a/source/Helpers/SourceFileWatcher.cs b/source/Helpers/SourceFileWatcher.cs index 33b669c..b857e4c 100644 --- a/source/Helpers/SourceFileWatcher.cs +++ b/source/Helpers/SourceFileWatcher.cs @@ -1,24 +1,5 @@ namespace SuCoS.Helpers; -/// -/// The FileSystemWatcher object that monitors the source directory for file changes. -/// -public interface IFileWatcher -{ - /// - /// Starts the file watcher to monitor file changes in the specified source path. - /// - /// The path to the source directory. - /// - /// The created FileSystemWatcher object. - void Start(string SourceAbsolutePath, Action OnSourceFileChanged); - - /// - /// Disposes the file watcher - /// - void Stop(); -} - /// /// The FileSystemWatcher object that monitors the source directory for file changes. /// diff --git a/source/Program.cs b/source/Program.cs index 2d5f094..917a393 100644 --- a/source/Program.cs +++ b/source/Program.cs @@ -1,5 +1,6 @@ using Serilog; using Serilog.Events; +using SuCoS.Helpers; using SuCoS.Models.CommandLineOptions; using System.CommandLine; using System.Reflection; -- GitLab