From 64e700c3967013e77d48078f4e2b5247e800825b Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 15 Nov 2023 16:00:05 -0300 Subject: [PATCH 01/10] chore: no public fields --- source/BaseGeneratorCommand.cs | 8 ++++---- source/Helpers/SiteCacheManager.cs | 6 +++--- source/Models/Site.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/BaseGeneratorCommand.cs b/source/BaseGeneratorCommand.cs index 3b216ca..408f555 100644 --- a/source/BaseGeneratorCommand.cs +++ b/source/BaseGeneratorCommand.cs @@ -21,22 +21,22 @@ public abstract class BaseGeneratorCommand /// /// The site configuration. /// - protected Site site; + protected Site site { get; set; } /// /// The front matter parser instance. The default is YAML. /// - protected readonly IFrontMatterParser frontMatterParser = new YAMLParser(); + protected IFrontMatterParser frontMatterParser { get; } = new YAMLParser(); /// /// The stopwatch reporter. /// - protected readonly StopwatchReporter stopwatch; + protected StopwatchReporter stopwatch { get; } /// /// The logger (Serilog). /// - protected readonly ILogger logger; + protected ILogger logger { get; } /// /// Initializes a new instance of the class. diff --git a/source/Helpers/SiteCacheManager.cs b/source/Helpers/SiteCacheManager.cs index 5391bbf..7365db8 100644 --- a/source/Helpers/SiteCacheManager.cs +++ b/source/Helpers/SiteCacheManager.cs @@ -11,17 +11,17 @@ public class SiteCacheManager /// /// Cache for content templates. /// - public readonly Dictionary<(string?, Kind?, string?), string> contentTemplateCache = new(); + public Dictionary<(string?, Kind?, string?), string> contentTemplateCache { get; } = new(); /// /// Cache for base templates. /// - public readonly Dictionary<(string?, Kind?, string?), string> baseTemplateCache = new(); + public Dictionary<(string?, Kind?, string?), string> baseTemplateCache { get; } = new(); /// /// Cache for tag page. /// - public readonly ConcurrentDictionary> automaticContentCache = new(); + public ConcurrentDictionary> automaticContentCache { get; } = new(); /// /// Resets the template cache to force a reload of all templates. diff --git a/source/Models/Site.cs b/source/Models/Site.cs index 3df334f..da9e0b3 100644 --- a/source/Models/Site.cs +++ b/source/Models/Site.cs @@ -141,7 +141,7 @@ public class Site : ISite /// /// Number of files parsed, used in the report. /// - public int filesParsedToReport; + public int filesParsedToReport { get; set; } private const string indexLeafFileConst = "index.md"; -- GitLab From e2e5cecf8f03e940db9318dcb5ef1b6d8b77dc4e Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 15 Nov 2023 16:15:04 -0300 Subject: [PATCH 02/10] chore: replace Lists for Collections --- source/Helpers/SiteHelper.cs | 2 +- source/Models/FrontMatter.cs | 7 ++++--- source/Models/IFrontMatter.cs | 7 ++++--- source/Models/IPage.cs | 5 +++-- source/Models/Page.cs | 11 ++++++----- source/Models/Site.cs | 4 +++- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/source/Helpers/SiteHelper.cs b/source/Helpers/SiteHelper.cs index ebc7346..ed9996b 100644 --- a/source/Helpers/SiteHelper.cs +++ b/source/Helpers/SiteHelper.cs @@ -54,7 +54,7 @@ public static class SiteHelper site.ParseAndScanSourceFiles(site.SourceContentPath); - stopwatch.Stop("Parse", site.filesParsedToReport); + stopwatch.Stop("Parse", site.FilesParsedToReport); site.TemplateOptions.FileProvider = new PhysicalFileProvider(Path.GetFullPath(site.SourceThemePath)); diff --git a/source/Models/FrontMatter.cs b/source/Models/FrontMatter.cs index 5bb5d76..2b58550 100644 --- a/source/Models/FrontMatter.cs +++ b/source/Models/FrontMatter.cs @@ -1,3 +1,4 @@ +using System.Collections.ObjectModel; using YamlDotNet.Serialization; namespace SuCoS.Models; @@ -23,7 +24,7 @@ public class FrontMatter : IFrontMatter public bool? Draft { get; init; } /// - public List? Aliases { get; init; } + public Collection? Aliases { get; init; } /// public string? Section { get; set; } = string.Empty; @@ -44,10 +45,10 @@ public class FrontMatter : IFrontMatter public int Weight { get; init; } = 0; /// - public List? Tags { get; init; } + public Collection? Tags { get; init; } /// - public List? ResourceDefinitions { get; set; } + public Collection? ResourceDefinitions { get; set; } /// [YamlIgnore] diff --git a/source/Models/IFrontMatter.cs b/source/Models/IFrontMatter.cs index c87eadb..50d7361 100644 --- a/source/Models/IFrontMatter.cs +++ b/source/Models/IFrontMatter.cs @@ -1,3 +1,4 @@ +using System.Collections.ObjectModel; using SuCoS.Models.CommandLineOptions; namespace SuCoS.Models; @@ -82,7 +83,7 @@ public interface IFrontMatter : IParams, IFile /// List URL, it will be parsed as liquid templates, so you can use page variables. /// /// - List? Aliases { get; } + Collection? Aliases { get; } /// /// Page weight. Used for sorting by default. @@ -92,12 +93,12 @@ public interface IFrontMatter : IParams, IFile /// /// A list of tags, if any. /// - List? Tags { get; } + Collection? Tags { get; } /// /// List of resource definitions. /// - List? ResourceDefinitions { get; } + Collection? ResourceDefinitions { get; } /// /// Raw content from the Markdown file, bellow the front matter. diff --git a/source/Models/IPage.cs b/source/Models/IPage.cs index d979b7f..db7083a 100644 --- a/source/Models/IPage.cs +++ b/source/Models/IPage.cs @@ -1,6 +1,7 @@ using Markdig; using SuCoS.Helpers; using System.Collections.Concurrent; +using System.Collections.ObjectModel; namespace SuCoS.Models; @@ -27,7 +28,7 @@ public interface IPage : IFrontMatter, IOutput /// /// Secondary URL patterns to be used to create the url. /// - public List? AliasesProcessed { get; set; } + public Collection? AliasesProcessed { get; set; } /// /// Other content that mention this content. @@ -49,7 +50,7 @@ public interface IPage : IFrontMatter, IOutput /// /// Page resources. All files that accompany a page. /// - public List? Resources { get; set; } + public Collection? Resources { get; set; } /// /// Plain markdown content, without HTML. diff --git a/source/Models/Page.cs b/source/Models/Page.cs index 5f88cb5..4b4442c 100644 --- a/source/Models/Page.cs +++ b/source/Models/Page.cs @@ -3,6 +3,7 @@ using Markdig; using Microsoft.Extensions.FileSystemGlobbing; using SuCoS.Helpers; using System.Collections.Concurrent; +using System.Collections.ObjectModel; namespace SuCoS.Models; @@ -28,7 +29,7 @@ public class Page : IPage public bool? Draft => frontMatter.Draft; /// - public List? Aliases => frontMatter.Aliases; + public Collection? Aliases => frontMatter.Aliases; /// public string? Section => frontMatter.Section; @@ -49,10 +50,10 @@ public class Page : IPage public int Weight => frontMatter.Weight; /// - public List? Tags => frontMatter.Tags; + public Collection? Tags => frontMatter.Tags; /// - public List? ResourceDefinitions => frontMatter.ResourceDefinitions; + public Collection? ResourceDefinitions => frontMatter.ResourceDefinitions; /// public string RawContent => frontMatter.RawContent; @@ -103,7 +104,7 @@ public class Page : IPage /// /// Secondary URL patterns to be used to create the url. /// - public List? AliasesProcessed { get; set; } + public Collection? AliasesProcessed { get; set; } /// public string? Permalink { get; set; } @@ -121,7 +122,7 @@ public class Page : IPage public BundleType BundleType { get; set; } = BundleType.none; /// - public List? Resources { get; set; } + public Collection? Resources { get; set; } /// /// Plain markdown content, without HTML. diff --git a/source/Models/Site.cs b/source/Models/Site.cs index da9e0b3..7436109 100644 --- a/source/Models/Site.cs +++ b/source/Models/Site.cs @@ -141,7 +141,9 @@ public class Site : ISite /// /// Number of files parsed, used in the report. /// - public int filesParsedToReport { get; set; } + public int FilesParsedToReport => filesParsedToReport; + + private int filesParsedToReport; private const string indexLeafFileConst = "index.md"; -- GitLab From 30dc561d2baba5c9fe73e9b885f16189e430cc98 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 15 Nov 2023 16:24:28 -0300 Subject: [PATCH 03/10] chore: no useless value initializer --- source/Models/FrontMatter.cs | 2 +- source/Models/Page.cs | 4 ++-- source/Models/Site.cs | 4 ++-- source/Program.cs | 18 ++++++++++++------ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/source/Models/FrontMatter.cs b/source/Models/FrontMatter.cs index 2b58550..11c5d94 100644 --- a/source/Models/FrontMatter.cs +++ b/source/Models/FrontMatter.cs @@ -42,7 +42,7 @@ public class FrontMatter : IFrontMatter public DateTime? ExpiryDate { get; init; } /// - public int Weight { get; init; } = 0; + public int Weight { get; init; } /// public Collection? Tags { get; init; } diff --git a/source/Models/Page.cs b/source/Models/Page.cs index 4b4442c..68058bc 100644 --- a/source/Models/Page.cs +++ b/source/Models/Page.cs @@ -192,7 +192,7 @@ public class Page : IPage return pagesCached; } - pagesCached ??= new(); + pagesCached = new(); foreach (var permalink in PagesReferences) { var page = Site.OutputReferences[permalink] as IPage; @@ -373,7 +373,7 @@ endif ScanForResources(); } - private int counterInternal = 0; + private int counterInternal; private bool counterInternalLock; private int counter { diff --git a/source/Models/Site.cs b/source/Models/Site.cs index 7436109..dfe051d 100644 --- a/source/Models/Site.cs +++ b/source/Models/Site.cs @@ -312,7 +312,7 @@ public class Site : ISite // Remove the selected file from markdownFiles markdownFiles = bundleType == BundleType.leaf - ? new string[] { } + ? Array.Empty() : markdownFiles.Where(file => file != selectedFile).ToArray(); page = ParseSourceFile(selectedFile!, parent, bundleType); @@ -393,7 +393,7 @@ public class Site : ISite page.PostProcess(); // Replace the old page with the newly created one - if (oldOutput is IPage oldpage && oldpage?.PagesReferences is not null) + if (oldOutput is IPage oldpage && oldpage.PagesReferences is not null) { foreach (var pageOld in oldpage.PagesReferences) { diff --git a/source/Program.cs b/source/Program.cs index 917a393..1abf59f 100644 --- a/source/Program.cs +++ b/source/Program.cs @@ -26,6 +26,12 @@ public class Program "; private ILogger logger; + private static readonly string[] aliases = new[] { "--source", "-s" }; + private static readonly string[] aliasesArray = new[] { "--draft", "-d" }; + private static readonly string[] aliasesArray0 = new[] { "--future", "-f" }; + private static readonly string[] aliasesArray1 = new[] { "--expired", "-e" }; + private static readonly string[] aliasesArray2 = new[] { "--verbose", "-v" }; + private static readonly string[] aliasesArray3 = new[] { "--output", "-o" }; /// /// Entry point of the program @@ -59,14 +65,14 @@ public class Program OutputWelcome(); // Shared options between the commands - var sourceOption = new Option(new[] { "--source", "-s" }, () => ".", "Source directory path"); - var draftOption = new Option(new[] { "--draft", "-d" }, "Include draft content"); - var futureOption = new Option(new[] { "--future", "-f" }, "Include content with dates in the future"); - var expiredOption = new Option(new[] { "--expired", "-e" }, "Include content with ExpiredDate dates from the past"); - var verboseOption = new Option(new[] { "--verbose", "-v" }, "Verbose output"); + var sourceOption = new Option(aliases, () => ".", "Source directory path"); + var draftOption = new Option(aliasesArray, "Include draft content"); + var futureOption = new Option(aliasesArray0, "Include content with dates in the future"); + var expiredOption = new Option(aliasesArray1, "Include content with ExpiredDate dates from the past"); + var verboseOption = new Option(aliasesArray2, "Verbose output"); // BuildCommand setup - var buildOutputOption = new Option(new[] { "--output", "-o" }, "Output directory path"); + var buildOutputOption = new Option(aliasesArray3, "Output directory path"); Command buildCommandHandler = new("build", "Builds the site") { -- GitLab From 1729773e1e955113e2812f84a8cdbe78ec6c475b Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 15 Nov 2023 16:29:59 -0300 Subject: [PATCH 04/10] chore: add a discarded return var --- .build.Nuke/Build.Compile.cs | 8 +-- .build.Nuke/Build.Container.cs | 50 ++++++++-------- .build.Nuke/Build.GitLab.cs | 14 ++--- .build.Nuke/Build.Publish.cs | 60 +++++++++---------- .build.Nuke/Build.Test.cs | 32 +++++----- source/Models/Page.cs | 4 +- source/Models/Site.cs | 8 +-- source/Parser/YAMLParser.cs | 2 +- source/ServeCommand.cs | 2 +- test/BaseGeneratorCommandTests.cs | 4 +- test/Models/PageTests.cs | 6 +- test/Models/SiteTests.cs | 26 ++++---- test/Parser/YAMLParserTests.cs | 20 +++---- .../ServerHandlers/PingRequestHandlerTests.cs | 6 +- .../RegisteredPageRequestHandlerTests.cs | 8 +-- .../StaticFileRequestHandlerTests.cs | 10 ++-- test/TestSetup.cs | 2 +- 17 files changed, 131 insertions(+), 131 deletions(-) diff --git a/.build.Nuke/Build.Compile.cs b/.build.Nuke/Build.Compile.cs index b07b145..e784aba 100644 --- a/.build.Nuke/Build.Compile.cs +++ b/.build.Nuke/Build.Compile.cs @@ -26,21 +26,21 @@ sealed partial class Build : NukeBuild coverageDirectory.DeleteDirectory(); }); - Target Restore => _ => _ + Target Restore => td => td .DependsOn(Clean) .Executes(() => { - DotNetRestore(s => s + _ = DotNetRestore(s => s .SetProjectFile(solution)); }); - Target Compile => _ => _ + Target Compile => td => td .DependsOn(Restore) .Executes(() => { Log.Debug("Configuration {Configuration}", configurationSet); Log.Debug("configuration {configuration}", configuration); - DotNetBuild(s => s + _ = DotNetBuild(s => s .SetNoLogo(true) .SetProjectFile(solution) .SetConfiguration(configurationSet) diff --git a/.build.Nuke/Build.Container.cs b/.build.Nuke/Build.Container.cs index f80c5a5..621882d 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"; - public Target CreateContainer => _ => _ + public Target CreateContainer => td => td .DependsOn(Publish) .DependsOn(CheckNewCommits) .OnlyWhenStatic(() => runtimeIdentifier != "win-x64") @@ -34,35 +34,35 @@ sealed partial class Build : NukeBuild tags.AddRange(tagsOriginal); } - // Build the Container image - DockerTasks.DockerBuild(_ => _ - .SetPath(PublishDirectory) - .SetFile($"./Dockerfile") - .SetTag(tags.Select(tag => $"{ContainerRegistryImage}:{tag}").ToArray()) - .SetBuildArg(new[] { $"BASE_IMAGE={BaseImage}", $"COPY_PATH={PublishDirectory}" }) - .SetProcessLogger((outputType, output) => - { - // A bug this log type value - if (outputType != OutputType.Std) - Log.Information(output); - else - Log.Error(output); - }) - ); + // Build the Container image + _ = DockerTasks.DockerBuild(dbs => dbs + .SetPath(PublishDirectory) + .SetFile($"./Dockerfile") + .SetTag(tags.Select(tag => $"{ContainerRegistryImage}:{tag}").ToArray()) + .SetBuildArg(new[] { $"BASE_IMAGE={BaseImage}", $"COPY_PATH={PublishDirectory}" }) + .SetProcessLogger((outputType, output) => + { + // A bug this log type value + if (outputType != OutputType.Std) + Log.Information(output); + else + Log.Error(output); + }) + ); - // Log in to the Docker registry - DockerTasks.DockerLogin(_ => _ - .SetServer("registry.gitlab.com") - .SetUsername("gitlab-ci-token") - .SetPassword(GitLab.JobToken) - ); + // Log in to the Docker registry + _ = DockerTasks.DockerLogin(_ => _ + .SetServer("registry.gitlab.com") + .SetUsername("gitlab-ci-token") + .SetPassword(GitLab.JobToken) + ); // Push the container images foreach (var tag in tags) { - DockerTasks.DockerPush(_ => _ - .SetName($"{ContainerRegistryImage}:{tag}") - ); + _ = DockerTasks.DockerPush(_ => _ + .SetName($"{ContainerRegistryImage}:{tag}") + ); // Create a link to the GitLab release var tagLink = GitLabAPIUrl($"?orderBy=NAME&sort=asc&search[]={tag}"); diff --git a/.build.Nuke/Build.GitLab.cs b/.build.Nuke/Build.GitLab.cs index f9b5879..56ca7a6 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. /// /// - public Target CreatePackage => _ => _ + public Target CreatePackage => td => td .DependsOn(Publish) .DependsOn(CheckNewCommits) .Requires(() => gitlabPrivateToken) @@ -82,7 +82,7 @@ sealed partial class Build : NukeBuild packageLink, new StreamContent(fileStream)); - response.EnsureSuccessStatusCode(); + _ = response.EnsureSuccessStatusCode(); } catch (Exception ex) { @@ -97,7 +97,7 @@ sealed partial class Build : NukeBuild /// Creates a release in the GitLab repository. /// /// - public Target GitLabCreateRelease => _ => _ + public Target GitLabCreateRelease => td => td .DependsOn(GitLabCreateTag) .OnlyWhenStatic(() => HasNewCommits) .Requires(() => gitlabPrivateToken) @@ -115,7 +115,7 @@ sealed partial class Build : NukeBuild description = $"Created {Date}" }); - response.EnsureSuccessStatusCode(); + _ = response.EnsureSuccessStatusCode(); } catch (Exception ex) { @@ -128,7 +128,7 @@ sealed partial class Build : NukeBuild /// Creates a tag in the GitLab repository. /// /// - Target GitLabCreateTag => _ => _ + Target GitLabCreateTag => td => td .DependsOn(CheckNewCommits) .After(Compile) .OnlyWhenStatic(() => HasNewCommits) @@ -147,7 +147,7 @@ sealed partial class Build : NukeBuild message = $"Automatic tag creation: {isScheduled} at {Date}" }); - response.EnsureSuccessStatusCode(); + _ = response.EnsureSuccessStatusCode(); } catch (Exception ex) { @@ -199,7 +199,7 @@ sealed partial class Build : NukeBuild url = itemLink }); - response.EnsureSuccessStatusCode(); + _ = response.EnsureSuccessStatusCode(); } catch (Exception ex) { diff --git a/.build.Nuke/Build.Publish.cs b/.build.Nuke/Build.Publish.cs index fa2684d..042775f 100644 --- a/.build.Nuke/Build.Publish.cs +++ b/.build.Nuke/Build.Publish.cs @@ -11,39 +11,39 @@ namespace SuCoS; /// sealed partial class Build : NukeBuild { - [Parameter("Runtime identifier for the build (e.g., win-x64, linux-x64, osx-x64) (default: linux-x64)")] - readonly string runtimeIdentifier = "linux-x64"; + [Parameter("Runtime identifier for the build (e.g., win-x64, linux-x64, osx-x64) (default: linux-x64)")] + readonly string runtimeIdentifier = "linux-x64"; - [Parameter("publish-directory (default: ./publish/{runtimeIdentifier})")] - readonly AbsolutePath publishDirectory; - AbsolutePath PublishDirectory => publishDirectory ?? RootDirectory / "publish" / runtimeIdentifier; + [Parameter("publish-directory (default: ./publish/{runtimeIdentifier})")] + readonly AbsolutePath publishDirectory; + AbsolutePath PublishDirectory => publishDirectory ?? RootDirectory / "publish" / runtimeIdentifier; - [Parameter("publish-self-contained (default: true)")] - readonly bool publishSelfContained = true; + [Parameter("publish-self-contained (default: true)")] + readonly bool publishSelfContained = true; - [Parameter("publish-single-file (default: true)")] - readonly bool publishSingleFile = true; + [Parameter("publish-single-file (default: true)")] + readonly bool publishSingleFile = true; - [Parameter("publish-trimmed (default: false)")] - readonly bool publishTrimmed = false; + [Parameter("publish-trimmed (default: false)")] + readonly bool publishTrimmed = false; - Target Publish => _ => _ - .DependsOn(Restore) - .Executes(() => - { - DotNetPublish(s => s - .SetNoLogo(true) - .SetProject("source/SuCoS.csproj") - .SetConfiguration(configurationSet) - .SetOutput(PublishDirectory) - .SetRuntime(runtimeIdentifier) - .SetSelfContained(publishSelfContained) - .SetPublishSingleFile(publishSingleFile) - .SetPublishTrimmed(publishTrimmed) - .SetAuthors("Bruno Massa") - .SetVersion(CurrentVersion) - .SetAssemblyVersion(CurrentVersion) - .SetInformationalVersion(CurrentVersion) - ); - }); + Target Publish => td => td + .DependsOn(Restore) + .Executes(() => + { + _ = DotNetPublish(s => s + .SetNoLogo(true) + .SetProject("source/SuCoS.csproj") + .SetConfiguration(configurationSet) + .SetOutput(PublishDirectory) + .SetRuntime(runtimeIdentifier) + .SetSelfContained(publishSelfContained) + .SetPublishSingleFile(publishSingleFile) + .SetPublishTrimmed(publishTrimmed) + .SetAuthors("Bruno Massa") + .SetVersion(CurrentVersion) + .SetAssemblyVersion(CurrentVersion) + .SetInformationalVersion(CurrentVersion) + ); + }); } diff --git a/.build.Nuke/Build.Test.cs b/.build.Nuke/Build.Test.cs index 54f1d52..0a4fe57 100644 --- a/.build.Nuke/Build.Test.cs +++ b/.build.Nuke/Build.Test.cs @@ -26,30 +26,30 @@ sealed partial class Build : NukeBuild static AbsolutePath coverageReportDirectory => coverageDirectory / "report"; static AbsolutePath coverageReportSummaryDirectory => coverageReportDirectory / "Summary.txt"; - Target Test => _ => _ + Target Test => td => td .DependsOn(Compile) .Executes(() => { - coverageResultDirectory.CreateDirectory(); - Coverlet(s => s - .SetTarget("dotnet") - .SetTargetArgs("test --no-build --no-restore") - .SetAssembly(testAssembly) - // .SetThreshold(75) - .SetOutput(coverageResultFile) - .SetFormat(CoverletOutputFormat.cobertura)); + _ = coverageResultDirectory.CreateDirectory(); + _ = Coverlet(s => s + .SetTarget("dotnet") + .SetTargetArgs("test --no-build --no-restore") + .SetAssembly(testAssembly) + // .SetThreshold(75) + .SetOutput(coverageResultFile) + .SetFormat(CoverletOutputFormat.cobertura)); }); - public Target TestReport => _ => _ + public Target TestReport => td => td .DependsOn(Test) .Executes(() => { - coverageReportDirectory.CreateDirectory(); - ReportGenerator(s => s - .SetTargetDirectory(coverageReportDirectory) - .SetReportTypes(new ReportTypes[] { ReportTypes.Html, ReportTypes.TextSummary }) - .SetReports(coverageResultFile) - ); + _ = coverageReportDirectory.CreateDirectory(); + _ = ReportGenerator(s => s + .SetTargetDirectory(coverageReportDirectory) + .SetReportTypes(new ReportTypes[] { ReportTypes.Html, ReportTypes.TextSummary }) + .SetReports(coverageResultFile) + ); var summaryText = coverageReportSummaryDirectory.ReadAllLines(); Log.Information(string.Join(Environment.NewLine, summaryText)); }); diff --git a/source/Models/Page.cs b/source/Models/Page.cs index 68058bc..1e2a859 100644 --- a/source/Models/Page.cs +++ b/source/Models/Page.cs @@ -366,7 +366,7 @@ endif { foreach (var tagName in Tags) { - Site.CreateSystemPage(Path.Combine("tags", tagName), tagName, "tags", this); + _ = Site.CreateSystemPage(Path.Combine("tags", tagName), tagName, "tags", this); } } @@ -419,7 +419,7 @@ endif foreach (var resourceDefinition in ResourceDefinitions) { resourceDefinition.GlobMatcher ??= new(); - resourceDefinition.GlobMatcher.AddInclude(resourceDefinition.Src); + _ = resourceDefinition.GlobMatcher.AddInclude(resourceDefinition.Src); var file = new InMemoryDirectoryInfo("./", new[] { filenameOriginal }); if (resourceDefinition.GlobMatcher.Execute(file).HasMatches) { diff --git a/source/Models/Site.cs b/source/Models/Site.cs index dfe051d..f88e1e5 100644 --- a/source/Models/Site.cs +++ b/source/Models/Site.cs @@ -220,7 +220,7 @@ public class Site : ISite _ = Parallel.ForEach(markdownFiles, filePath => { - ParseSourceFile(filePath, parent); + _ = ParseSourceFile(filePath, parent); }); var subdirectories = Directory.GetDirectories(directory); @@ -320,11 +320,11 @@ public class Site : ISite if (level == 0) { - OutputReferences.TryRemove(page!.Permalink!, out _); + _ = OutputReferences.TryRemove(page!.Permalink!, out _); page.Permalink = "/"; page.Kind = Kind.index; - OutputReferences.GetOrAdd(page.Permalink, page); + _ = OutputReferences.GetOrAdd(page.Permalink, page); Home = page; } else @@ -404,7 +404,7 @@ public class Site : ISite // Register the page for all urls foreach (var pageOutput in page.AllOutputURLs) { - OutputReferences.TryAdd(pageOutput.Key, pageOutput.Value); + _ = OutputReferences.TryAdd(pageOutput.Key, pageOutput.Value); } } } diff --git a/source/Parser/YAMLParser.cs b/source/Parser/YAMLParser.cs index 36ca94d..72e9133 100644 --- a/source/Parser/YAMLParser.cs +++ b/source/Parser/YAMLParser.cs @@ -62,7 +62,7 @@ public class YAMLParser : IFrontMatterParser while ((line = content.ReadLine()) != null && line != "---") { } while ((line = content.ReadLine()) != null && line != "---") { - frontMatterBuilder.AppendLine(line); + _ = frontMatterBuilder.AppendLine(line); } // Join the read lines to form the front matter diff --git a/source/ServeCommand.cs b/source/ServeCommand.cs index a0044ae..69b3b40 100644 --- a/source/ServeCommand.cs +++ b/source/ServeCommand.cs @@ -143,7 +143,7 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable /// private async Task RestartServer() { - await lastRestartTask.ContinueWith(async _ => + _ = await lastRestartTask.ContinueWith(async _ => { logger.Information($"Restarting server..."); diff --git a/test/BaseGeneratorCommandTests.cs b/test/BaseGeneratorCommandTests.cs index 475efd4..e4f4681 100644 --- a/test/BaseGeneratorCommandTests.cs +++ b/test/BaseGeneratorCommandTests.cs @@ -24,13 +24,13 @@ public class BaseGeneratorCommandTests [Fact] public void Constructor_ShouldThrowArgumentNullException_WhenOptionsIsNull() { - Assert.Throws(() => new BaseGeneratorCommandStub(null!, testLogger)); + _ = Assert.Throws(() => new BaseGeneratorCommandStub(null!, testLogger)); } [Fact] public void Constructor_ShouldThrowArgumentNullException_WhenLoggerIsNull() { - Assert.Throws(() => new BaseGeneratorCommandStub(testOptions, null!)); + _ = Assert.Throws(() => new BaseGeneratorCommandStub(testOptions, null!)); } [Fact] diff --git a/test/Models/PageTests.cs b/test/Models/PageTests.cs index 25ba01f..56fd141 100644 --- a/test/Models/PageTests.cs +++ b/test/Models/PageTests.cs @@ -89,7 +89,7 @@ word03 word04 word05 6 7 eight // Assert Assert.Equal(3, site.OutputReferences.Count); - site.OutputReferences.TryGetValue(url, out var pageOther); + _ = site.OutputReferences.TryGetValue(url, out var pageOther); Assert.NotNull(pageOther); Assert.Same(page, pageOther); } @@ -179,7 +179,7 @@ word03 word04 word05 6 7 eight }, site); var options = Substitute.For(); - options.Draft.Returns(draftOption); + _ = options.Draft.Returns(draftOption); // Assert Assert.Equal(expectedValue, site.IsValidPage(page, options)); @@ -199,7 +199,7 @@ word03 word04 word05 6 7 eight // Act var options = Substitute.For(); - options.Future.Returns(futureOption); + _ = options.Future.Returns(futureOption); // Assert Assert.Equal(expected, site.IsValidDate(page, options)); diff --git a/test/Models/SiteTests.cs b/test/Models/SiteTests.cs index f1ff2cb..e328aba 100644 --- a/test/Models/SiteTests.cs +++ b/test/Models/SiteTests.cs @@ -46,7 +46,7 @@ public class SiteTests : TestSetup // Assert Assert.NotNull(site.Home); Assert.True(site.Home.IsHome); - Assert.Single(site.OutputReferences.Values.Where(output => output is IPage page && page.IsHome)); + _ = Assert.Single(site.OutputReferences.Values.Where(output => output is IPage page && page.IsHome)); } [Theory] @@ -154,8 +154,8 @@ public class SiteTests : TestSetup // Act site.ParseAndScanSourceFiles(null); - // Assert - site.OutputReferences.TryGetValue("/tags", out var output); + // Assert + _ = site.OutputReferences.TryGetValue("/tags", out var output); var tagSectionPage = output as IPage; Assert.NotNull(tagSectionPage); Assert.Equal(2, tagSectionPage.Pages.Count()); @@ -177,8 +177,8 @@ public class SiteTests : TestSetup // Act site.ParseAndScanSourceFiles(null); - // Assert - site.OutputReferences.TryGetValue("/tags/tag1", out var output); + // Assert + _ = site.OutputReferences.TryGetValue("/tags/tag1", out var output); var page = output as IPage; Assert.NotNull(page); Assert.Equal(10, page.Pages.Count()); @@ -202,8 +202,8 @@ public class SiteTests : TestSetup // Act site.ParseAndScanSourceFiles(null); - // Assert - site.OutputReferences.TryGetValue(url, out var output); + // Assert + _ = site.OutputReferences.TryGetValue(url, out var output); var page = output as IPage; Assert.NotNull(page); Assert.Equal(expectedContent, page.Content); @@ -237,8 +237,8 @@ public class SiteTests : TestSetup // Act site.ParseAndScanSourceFiles(null); - // Assert - site.OutputReferences.TryGetValue(url, out var output); + // Assert + _ = site.OutputReferences.TryGetValue(url, out var output); var page = output as IPage; Assert.NotNull(page); Assert.Equal(expectedContentPreRendered, page.ContentPreRendered); @@ -263,8 +263,8 @@ public class SiteTests : TestSetup // Act site.ParseAndScanSourceFiles(null); - // Assert - site.OutputReferences.TryGetValue(url, out var output); + // Assert + _ = site.OutputReferences.TryGetValue(url, out var output); var page = output as IPage; Assert.NotNull(page); Assert.Equal(string.Empty, page.Content); @@ -303,8 +303,8 @@ public class SiteTests : TestSetup // Act site.ParseAndScanSourceFiles(null); - // Assert - site.OutputReferences.TryGetValue(url, out var output); + // Assert + _ = site.OutputReferences.TryGetValue(url, out var output); var page = output as IPage; Assert.NotNull(page); Assert.Equal(expectedContentPreRendered, page.ContentPreRendered); diff --git a/test/Parser/YAMLParserTests.cs b/test/Parser/YAMLParserTests.cs index b737221..2782a37 100644 --- a/test/Parser/YAMLParserTests.cs +++ b/test/Parser/YAMLParserTests.cs @@ -135,8 +135,8 @@ Title --- "; - // Asset - Assert.Throws(() => parser.ParseFrontmatterAndMarkdown(fileRelativePathCONST, fileFullPathCONST, fileContent)); + // Asset + _ = Assert.Throws(() => parser.ParseFrontmatterAndMarkdown(fileRelativePathCONST, fileFullPathCONST, fileContent)); } [Fact] @@ -212,37 +212,37 @@ Title [Fact] public void ParseFrontmatter_ShouldThrowExceptionWhenSiteIsNull() { - Assert.Throws(() => parser.ParseFrontmatterAndMarkdownFromFile(null!, "fakeFilePath")); + _ = Assert.Throws(() => parser.ParseFrontmatterAndMarkdownFromFile(null!, "fakeFilePath")); } [Fact] public void ParseFrontmatter_ShouldThrowExceptionWhenFilePathIsNull() { - Assert.Throws(() => parser.ParseFrontmatterAndMarkdownFromFile(null!)); + _ = Assert.Throws(() => parser.ParseFrontmatterAndMarkdownFromFile(null!)); } [Fact] public void ParseFrontmatter_ShouldThrowExceptionWhenFilePathDoesNotExist() { - Assert.Throws(() => parser.ParseFrontmatterAndMarkdownFromFile("fakePath")); + _ = Assert.Throws(() => parser.ParseFrontmatterAndMarkdownFromFile("fakePath")); } [Fact] public void ParseFrontmatter_ShouldThrowExceptionWhenFilePathDoesNotExist2() { - Assert.Throws(() => parser.ParseFrontmatterAndMarkdown(null!, null!, "fakeContent")); + _ = Assert.Throws(() => parser.ParseFrontmatterAndMarkdown(null!, null!, "fakeContent")); } [Fact] public void ParseFrontmatter_ShouldHandleEmptyFileContent() { - Assert.Throws(() => parser.ParseFrontmatterAndMarkdown("fakeFilePath", "/fakeFilePath", "")); + _ = Assert.Throws(() => parser.ParseFrontmatterAndMarkdown("fakeFilePath", "/fakeFilePath", "")); } [Fact] public void ParseYAML_ShouldThrowExceptionWhenFrontmatterIsInvalid() { - Assert.Throws(() => parser.ParseFrontmatterAndMarkdown("fakeFilePath", "/fakeFilePath", "invalidFrontmatter")); + _ = Assert.Throws(() => parser.ParseFrontmatterAndMarkdown("fakeFilePath", "/fakeFilePath", "invalidFrontmatter")); } [Fact] @@ -265,13 +265,13 @@ Title [Fact] public void SiteParams_ShouldThrowExceptionWhenSettingsIsNull() { - Assert.Throws(() => parser.ParseParams(null!, typeof(Site), siteContentCONST)); + _ = Assert.Throws(() => parser.ParseParams(null!, typeof(Site), siteContentCONST)); } [Fact] public void SiteParams_ShouldThrowExceptionWhenTypeIsNull() { - Assert.Throws(() => parser.ParseParams(site, null!, siteContentCONST)); + _ = Assert.Throws(() => parser.ParseParams(site, null!, siteContentCONST)); } [Fact] diff --git a/test/ServerHandlers/PingRequestHandlerTests.cs b/test/ServerHandlers/PingRequestHandlerTests.cs index 0d7ad20..c8ec07d 100644 --- a/test/ServerHandlers/PingRequestHandlerTests.cs +++ b/test/ServerHandlers/PingRequestHandlerTests.cs @@ -12,15 +12,15 @@ public class PingRequestHandlerTests : TestSetup // Arrange var response = Substitute.For(); var stream = new MemoryStream(); - response.OutputStream.Returns(stream); + _ = response.OutputStream.Returns(stream); var pingRequests = new PingRequests(); // Act var code = await pingRequests.Handle(response, "ping", todayDate); - // Assert - stream.Seek(0, SeekOrigin.Begin); + // Assert + _ = stream.Seek(0, SeekOrigin.Begin); using var reader = new StreamReader(stream); var content = await reader.ReadToEndAsync(); diff --git a/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs b/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs index 495e845..8453250 100644 --- a/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs +++ b/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs @@ -42,15 +42,15 @@ public class RegisteredPageRequestHandlerTests : TestSetup var response = Substitute.For(); var stream = new MemoryStream(); - response.OutputStream.Returns(stream); + _ = response.OutputStream.Returns(stream); // Act site.ParseAndScanSourceFiles(Path.Combine(siteFullPath, "content")); - registeredPageRequest.Check(requestPath); + _ = registeredPageRequest.Check(requestPath); var code = await registeredPageRequest.Handle(response, requestPath, DateTime.Now); - // Assert - stream.Seek(0, SeekOrigin.Begin); + // Assert + _ = stream.Seek(0, SeekOrigin.Begin); using var reader = new StreamReader(stream); var content = await reader.ReadToEndAsync(); diff --git a/test/ServerHandlers/StaticFileRequestHandlerTests.cs b/test/ServerHandlers/StaticFileRequestHandlerTests.cs index c656a0c..31657a4 100644 --- a/test/ServerHandlers/StaticFileRequestHandlerTests.cs +++ b/test/ServerHandlers/StaticFileRequestHandlerTests.cs @@ -44,14 +44,14 @@ public class StaticFileRequestHandlerTests : TestSetup, IDisposable var response = Substitute.For(); var stream = new MemoryStream(); - response.OutputStream.Returns(stream); + _ = response.OutputStream.Returns(stream); - // Act - staticFileRequest.Check(requestPath); + // Act + _ = staticFileRequest.Check(requestPath); var code = await staticFileRequest.Handle(response, requestPath, DateTime.Now); - // Assert - stream.Seek(0, SeekOrigin.Begin); + // Assert + _ = stream.Seek(0, SeekOrigin.Begin); using var reader = new StreamReader(stream); var content = await reader.ReadToEndAsync(); diff --git a/test/TestSetup.cs b/test/TestSetup.cs index ac0602e..aa0f4d0 100644 --- a/test/TestSetup.cs +++ b/test/TestSetup.cs @@ -42,7 +42,7 @@ public class TestSetup public TestSetup() { - systemClockMock.Now.Returns(todayDate); + _ = systemClockMock.Now.Returns(todayDate); site = new Site(generateOptionsMock, siteSettingsMock, frontMatterParser, loggerMock, systemClockMock); } } -- GitLab From a65e04c73ea4dd79b90a29f7232d9adb3ab60fb6 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 15 Nov 2023 16:37:12 -0300 Subject: [PATCH 05/10] chore: ConfigureAwait to allow to jump to other threads --- .build.Nuke/Build.GitLab.cs | 8 ++++---- source/Program.cs | 2 +- source/ServeCommand.cs | 16 ++++++++-------- source/ServerHandlers/PingRequests.cs | 4 ++-- source/ServerHandlers/RegisteredPageRequest.cs | 2 +- test/ServerHandlers/PingRequestHandlerTests.cs | 4 ++-- .../RegisteredPageRequestHandlerTests.cs | 4 ++-- .../StaticFileRequestHandlerTests.cs | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.build.Nuke/Build.GitLab.cs b/.build.Nuke/Build.GitLab.cs index 56ca7a6..833d9e9 100644 --- a/.build.Nuke/Build.GitLab.cs +++ b/.build.Nuke/Build.GitLab.cs @@ -80,7 +80,7 @@ sealed partial class Build : NukeBuild using var httpClient = HttpClientGitLabToken(); var response = await httpClient.PutAsync( packageLink, - new StreamContent(fileStream)); + new StreamContent(fileStream)).ConfigureAwait(false); _ = response.EnsureSuccessStatusCode(); } @@ -113,7 +113,7 @@ sealed partial class Build : NukeBuild tag_name = TagName, name = $"{TagName} {Date}", description = $"Created {Date}" - }); + }).ConfigureAwait(false); _ = response.EnsureSuccessStatusCode(); } @@ -145,7 +145,7 @@ sealed partial class Build : NukeBuild tag_name = TagName, @ref = GitLab?.CommitRefName ?? GitTasks.GitCurrentCommit(), message = $"Automatic tag creation: {isScheduled} at {Date}" - }); + }).ConfigureAwait(false); _ = response.EnsureSuccessStatusCode(); } @@ -197,7 +197,7 @@ sealed partial class Build : NukeBuild { name = itemName, url = itemLink - }); + }).ConfigureAwait(false); _ = response.EnsureSuccessStatusCode(); } diff --git a/source/Program.cs b/source/Program.cs index 1abf59f..26f78ee 100644 --- a/source/Program.cs +++ b/source/Program.cs @@ -122,7 +122,7 @@ public class Program var serveCommand = new ServeCommand(serverOptions, logger, new SourceFileWatcher()); serveCommand.StartServer(); - await Task.Delay(-1); // Wait forever. + await Task.Delay(-1).ConfigureAwait(false); // Wait forever. }, sourceOption, draftOption, futureOption, expiredOption, verboseOption); diff --git a/source/ServeCommand.cs b/source/ServeCommand.cs index 69b3b40..50a3220 100644 --- a/source/ServeCommand.cs +++ b/source/ServeCommand.cs @@ -105,8 +105,8 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable { try { - var context = await listener.GetContextAsync(); - await HandleRequest(context); + var context = await listener.GetContextAsync().ConfigureAwait(false); + await HandleRequest(context).ConfigureAwait(false); } catch (HttpListenerException ex) { @@ -155,7 +155,7 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable if (loop is not null) { // Wait for the loop to finish processing any ongoing requests. - await loop; + await loop.ConfigureAwait(false); loop.Dispose(); } } @@ -164,7 +164,7 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable site = SiteHelper.Init(configFile, options, frontMatterParser, WhereParamsFilter, logger, stopwatch); StartServer(baseURLDefault, portDefault); - }); + }).ConfigureAwait(false); lastRestartTask = lastRestartTask.ContinueWith(t => t.Exception != null ? throw t.Exception @@ -194,7 +194,7 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable try { - resultType = await item.Handle(response, requestPath, serverStartTime); + resultType = await item.Handle(response, requestPath, serverStartTime).ConfigureAwait(false); } catch (Exception ex) { @@ -212,7 +212,7 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable if (resultType is null) { resultType = "404"; - await HandleNotFoundRequest(context); + await HandleNotFoundRequest(context).ConfigureAwait(false); } logger.Debug("Request {type}\tfor {RequestPath}", resultType, requestPath); } @@ -221,7 +221,7 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable { context.Response.StatusCode = 404; using var writer = new StreamWriter(context.Response.OutputStream); - await writer.WriteAsync("404 - File Not Found"); + await writer.WriteAsync("404 - File Not Found").ConfigureAwait(false); } /// @@ -241,6 +241,6 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable private async void DebounceCallback(object? state) { - await RestartServer(); + await RestartServer().ConfigureAwait(false); } } diff --git a/source/ServerHandlers/PingRequests.cs b/source/ServerHandlers/PingRequests.cs index ba5e439..02d4a43 100644 --- a/source/ServerHandlers/PingRequests.cs +++ b/source/ServerHandlers/PingRequests.cs @@ -21,8 +21,8 @@ public class PingRequests : IServerHandlers var content = serverStartTime.ToString("o"); using var writer = new StreamWriter(response.OutputStream, leaveOpen: true); - await writer.WriteAsync(content); - await writer.FlushAsync(); + await writer.WriteAsync(content).ConfigureAwait(false); + await writer.FlushAsync().ConfigureAwait(false); return "ping"; } diff --git a/source/ServerHandlers/RegisteredPageRequest.cs b/source/ServerHandlers/RegisteredPageRequest.cs index a80f5c6..385cb1a 100644 --- a/source/ServerHandlers/RegisteredPageRequest.cs +++ b/source/ServerHandlers/RegisteredPageRequest.cs @@ -41,7 +41,7 @@ public class RegisteredPageRequest : IServerHandlers var content = page.CompleteContent; content = InjectReloadScript(content); using var writer = new StreamWriter(response.OutputStream, leaveOpen: true); - await writer.WriteAsync(content); + await writer.WriteAsync(content).ConfigureAwait(false); return "dict"; } else diff --git a/test/ServerHandlers/PingRequestHandlerTests.cs b/test/ServerHandlers/PingRequestHandlerTests.cs index c8ec07d..e6aa511 100644 --- a/test/ServerHandlers/PingRequestHandlerTests.cs +++ b/test/ServerHandlers/PingRequestHandlerTests.cs @@ -17,12 +17,12 @@ public class PingRequestHandlerTests : TestSetup var pingRequests = new PingRequests(); // Act - var code = await pingRequests.Handle(response, "ping", todayDate); + var code = await pingRequests.Handle(response, "ping", todayDate).ConfigureAwait(true); // Assert _ = stream.Seek(0, SeekOrigin.Begin); using var reader = new StreamReader(stream); - var content = await reader.ReadToEndAsync(); + var content = await reader.ReadToEndAsync().ConfigureAwait(true); Assert.Equal(todayDate.ToString("o"), content); diff --git a/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs b/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs index 8453250..21fbf14 100644 --- a/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs +++ b/test/ServerHandlers/RegisteredPageRequestHandlerTests.cs @@ -47,12 +47,12 @@ public class RegisteredPageRequestHandlerTests : TestSetup // Act site.ParseAndScanSourceFiles(Path.Combine(siteFullPath, "content")); _ = registeredPageRequest.Check(requestPath); - var code = await registeredPageRequest.Handle(response, requestPath, DateTime.Now); + var code = await registeredPageRequest.Handle(response, requestPath, DateTime.Now).ConfigureAwait(true); // Assert _ = stream.Seek(0, SeekOrigin.Begin); using var reader = new StreamReader(stream); - var content = await reader.ReadToEndAsync(); + var content = await reader.ReadToEndAsync().ConfigureAwait(true); Assert.Equal("dict", code); diff --git a/test/ServerHandlers/StaticFileRequestHandlerTests.cs b/test/ServerHandlers/StaticFileRequestHandlerTests.cs index 31657a4..92378e7 100644 --- a/test/ServerHandlers/StaticFileRequestHandlerTests.cs +++ b/test/ServerHandlers/StaticFileRequestHandlerTests.cs @@ -48,12 +48,12 @@ public class StaticFileRequestHandlerTests : TestSetup, IDisposable // Act _ = staticFileRequest.Check(requestPath); - var code = await staticFileRequest.Handle(response, requestPath, DateTime.Now); + var code = await staticFileRequest.Handle(response, requestPath, DateTime.Now).ConfigureAwait(true); // Assert _ = stream.Seek(0, SeekOrigin.Begin); using var reader = new StreamReader(stream); - var content = await reader.ReadToEndAsync(); + var content = await reader.ReadToEndAsync().ConfigureAwait(true); Assert.Equal("test", content); -- GitLab From fa524ce1cc86463c1bc4889a9679d0555c0e4a09 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Wed, 27 Dec 2023 09:46:44 -0300 Subject: [PATCH 06/10] feat: realdotdave suggestions --- .build.Nuke/Build.Container.cs | 2 +- .build.Nuke/Build.Test.cs | 2 +- .editorconfig | 2340 +++++++++++++++++ .nuke/build.schema.json | 328 +-- source/Helpers/SourceFileWatcher.cs | 17 +- source/Models/IPage.cs | 6 +- source/Models/Page.cs | 2 +- source/Models/Site.cs | 2 +- source/Parser/YAMLParser.cs | 2 +- source/Program.cs | 12 +- source/ServeCommand.cs | 6 +- .../RegisteredPageResourceRequest.cs | 2 +- source/ServerHandlers/StaticFileRequest.cs | 2 +- 13 files changed, 2539 insertions(+), 184 deletions(-) diff --git a/.build.Nuke/Build.Container.cs b/.build.Nuke/Build.Container.cs index 621882d..888d831 100644 --- a/.build.Nuke/Build.Container.cs +++ b/.build.Nuke/Build.Container.cs @@ -39,7 +39,7 @@ sealed partial class Build : NukeBuild .SetPath(PublishDirectory) .SetFile($"./Dockerfile") .SetTag(tags.Select(tag => $"{ContainerRegistryImage}:{tag}").ToArray()) - .SetBuildArg(new[] { $"BASE_IMAGE={BaseImage}", $"COPY_PATH={PublishDirectory}" }) + .SetBuildArg([$"BASE_IMAGE={BaseImage}", $"COPY_PATH={PublishDirectory}"]) .SetProcessLogger((outputType, output) => { // A bug this log type value diff --git a/.build.Nuke/Build.Test.cs b/.build.Nuke/Build.Test.cs index 0a4fe57..76ec9e9 100644 --- a/.build.Nuke/Build.Test.cs +++ b/.build.Nuke/Build.Test.cs @@ -47,7 +47,7 @@ sealed partial class Build : NukeBuild _ = coverageReportDirectory.CreateDirectory(); _ = ReportGenerator(s => s .SetTargetDirectory(coverageReportDirectory) - .SetReportTypes(new ReportTypes[] { ReportTypes.Html, ReportTypes.TextSummary }) + .SetReportTypes([ReportTypes.Html, ReportTypes.TextSummary]) .SetReports(coverageResultFile) ); var summaryText = coverageReportSummaryDirectory.ReadAllLines(); diff --git a/.editorconfig b/.editorconfig index ad36a90..0407ca1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -68,3 +68,2343 @@ dotnet_diagnostic.CS8019.severity = warning [**/obj/**/*.cs] dotnet_diagnostic.CS8019.severity = none # disable on debug genereated files +# dotNetDave's (David McCarter) Editor Config - dotNetTips.com +# Updates to this file are posted quarterly at: https://bit.ly/EditorConfig5 +# Updated August 2023 +# dotNetDave's books available at: http://bit.ly/RockYourCodeBooks +# Rockin' the Code World with dotNetDave (weekly live show): https://www.c-sharpcorner.com/live/rockin-the-code-world-with-dotnetdave + +root = true + +# All Files +[*] +charset = utf-8 +csharp_indent_labels = one_less_than_current +csharp_prefer_braces = true:suggestion +csharp_prefer_simple_default_expression = true:warning +csharp_prefer_simple_using_statement = false:silent +csharp_prefer_static_local_function = true:warning +csharp_space_around_binary_operators = before_and_after +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent +csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent +csharp_style_conditional_delegate_call = true:warning +csharp_style_deconstructed_variable_declaration = true:warning +csharp_style_expression_bodied_accessors = true:warning +csharp_style_expression_bodied_constructors = true:warning +csharp_style_expression_bodied_indexers = true:warning +csharp_style_expression_bodied_lambdas = true:warning +csharp_style_expression_bodied_local_functions = true:warning +csharp_style_expression_bodied_methods = true:warning +csharp_style_expression_bodied_operators = true:warning +csharp_style_expression_bodied_properties = true:warning +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning +csharp_style_inlined_variable_declaration = true:warning +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_pattern_matching_over_as_with_null_check = true:warning +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_prefer_index_operator = true:warning +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_not_pattern = true:warning +csharp_style_prefer_null_check_over_type_check = true:warning +csharp_style_prefer_pattern_matching = true:warning +csharp_style_prefer_range_operator = true:warning +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_prefer_switch_expression = true:warning +csharp_style_prefer_top_level_statements = true:silent +csharp_style_prefer_tuple_swap = true:suggestion +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_throw_expression = true:warning +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion +csharp_style_var_elsewhere = true:warning +csharp_style_var_for_built_in_types = true:warning +csharp_style_var_when_type_is_apparent = true:warning +csharp_using_directive_placement = outside_namespace:warning +end_of_line = crlf +indent_size = 4 +indent_style = tab +insert_final_newline = true + +# Visual Studio Solution Files +[*.sln] +indent_style = tab + +# Visual Studio XML Project Files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# XML Configuration Files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,xml,stylecop}] +indent_size = 2 + +# JSON Files +[*.{json,json5,webmanifest}] +indent_size = 2 + +# YAML Files +[*.{yml,yaml}] +indent_size = 2 + +# Markdown Files +[*.{md,mdx}] +trim_trailing_whitespace = false + +# Bash Files +[*.sh] +end_of_line = lf + +# Batch Files +[*.{cmd,bat}] +end_of_line = crlf + +# Web Files +[*.{htm,html,js,jsm,ts,tsx,cjs,cts,ctsx,mjs,mts,mtsx,css,sass,scss,less,pcss,svg,vue}] +indent_size = 2 +insert_final_newline = true + +# Makefiles +[Makefile] +indent_style = tab + +########################################## +# Default .NET Code Style Severities +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/configuration-options#scope +########################################## + +########################################## +# Language Rules +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules +########################################## + +# .NET Style Rules +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules +[*.{cs,csx,cake,vb,vbx}] + +# CA1014: Mark assemblies with CLSCompliantAttribute +dotnet_diagnostic.CA1014.severity = none + +# Non-private static fields are PascalCase +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields + +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static + +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case + +#Constants are PascalCase +dotnet_naming_rule.constants_should_be_pascal_case.severity = warning +dotnet_naming_rule.constants_should_be_pascal_case.style = non_private_static_field_style +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants + +dotnet_naming_symbols.constants.required_modifiers = const +dotnet_naming_symbols.constants.applicable_kinds = field, local + +dotnet_naming_style.constant_style.capitalization = pascal_case + +#Locals and parameters are camelCase +dotnet_naming_rule.locals_should_be_camel_case.severity = warning +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters + +# camel_case_style - Define the camelCase style +dotnet_naming_style.camel_case_style.capitalization = camel_case +dotnet_naming_style.static_field_style.required_prefix = s_ +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local +dotnet_naming_symbols.static_fields.required_modifiers = static + +# first_upper_style - The first character must start with an upper-case character +dotnet_naming_style.first_upper_style.capitalization = first_word_upper + +# prefix_interface_with_i_style - Interfaces must be PascalCase and the first character of an interface must be an 'I' +dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case +dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I + +# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and the first character must be a 'T' +dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case +dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T + +# disallowed_style - Anything that has this style applied is marked as disallowed +dotnet_naming_style.disallowed_style.capitalization = pascal_case +dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____ +dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____ + +# internal_error_style - This style should never occur... if it does, it indicates a bug in file or in the parser using the file +dotnet_naming_style.internal_error_style.capitalization = pascal_case +dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____ +dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____ + +# Simplify interpolation +dotnet_diagnostic.IDE0071.severity = warning + +# ??? +dotnet_diagnostic.IDE2000.severity = suggestion + +# All public/protected/protected_internal constant fields must be PascalCase +# https://docs.microsoft.com/dotnet/standard/design-guidelines/field +dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning +dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = non_private_static_field_style +dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group +dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal +dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field +dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const + +# All public/protected/protected_internal static readonly fields must be PascalCase +# https://docs.microsoft.com/dotnet/standard/design-guidelines/field +dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning +dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = non_private_static_field_style +dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group +dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal +dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field +dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly + +# No other public/protected/protected_internal fields are allowed +# https://docs.microsoft.com/dotnet/standard/design-guidelines/field +dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error +dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style +dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group +dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal +dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field + +########################################## +# StyleCop Field Naming Rules +# Naming rules for fields follow the StyleCop analyzers +# This does not override any rules using disallowed_style above +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers +########################################## + +########################################## +# All constant fields must be PascalCase +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md +dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning +dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = non_private_static_field_style +dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group +dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private +dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field +dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const +########################################## + +########################################## +# All static readonly fields must be PascalCase +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md +dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning +dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = non_private_static_field_style +dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group +dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private +dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field +dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly +########################################## + +########################################## +# No non-private instance fields are allowed +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md +dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error +dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style +dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group +dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected +dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field +########################################## + +########################################## +# Private fields must be camelCase +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md +dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning +dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style +dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group +dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private +dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field +########################################## + +########################################## +# Local variables must be camelCase +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md +dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent +dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style +dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group +dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local +dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local +########################################## + +########################################## +# This rule should never fire. However, it's included for at least two purposes: +# First, it helps to understand, reason about, and root-case certain types of issues, such as bugs in .editorconfig parsers. +# Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#). +dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error +dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style +dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group +dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = * +dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field +########################################## + +########################################## +# All of the following must be PascalCase: +# - Namespaces +# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-namespaces +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md +# - Classes and Enumerations +# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md +# - Delegates +# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces#names-of-common-types +# - Constructors, Properties, Events, Methods +# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-type-members +dotnet_naming_rule.element_rule.severity = warning +dotnet_naming_rule.element_rule.style = non_private_static_field_style +dotnet_naming_rule.element_rule.symbols = element_group +dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property +########################################## + +########################################## +# Interfaces use PascalCase and are prefixed with uppercase 'I' +# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces +dotnet_naming_rule.interface_rule.severity = warning +dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style +dotnet_naming_rule.interface_rule.symbols = interface_group +dotnet_naming_symbols.interface_group.applicable_kinds = interface +########################################## + +########################################## +# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T' +# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces +dotnet_naming_rule.type_parameter_rule.severity = warning +dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style +dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group +dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter +########################################## + +########################################## +# Function parameters use camelCase +# https://docs.microsoft.com/dotnet/standard/design-guidelines/naming-parameters +dotnet_naming_rule.parameters_rule.severity = warning +dotnet_naming_rule.parameters_rule.style = camel_case_style +dotnet_naming_rule.parameters_rule.symbols = parameters_group +dotnet_naming_symbols.parameters_group.applicable_kinds = parameter +########################################## + +# Type Parameters +dotnet_naming_style.type_parameter_style.required_prefix = T +dotnet_naming_style.type_parameter_style.capitalization = pascal_case + +dotnet_naming_rule.type_parameter_naming.severity = warning +dotnet_naming_rule.type_parameter_naming.style = type_parameter_style +dotnet_naming_rule.type_parameter_naming.symbols = type_parameter_symbol +dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = * +dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter + +# Instance fields are camelCase and start with _ +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.instance_fields_should_be_camel_case.style = camel_case_underscore_style +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.instance_field_style.capitalization = camel_case +dotnet_naming_style.instance_field_style.required_prefix = _ +dotnet_naming_symbols.instance_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field + +# Local functions are PascalCase +dotnet_diagnostic.CS8618.severity = silent +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = warning +dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = all_members +dotnet_naming_style.local_function_style.capitalization = pascal_case +dotnet_naming_symbols.local_functions.applicable_kinds = local_function + +# "this." and "Me." qualifiers +# dotnet_style_qualification_for_event = true:warning +# dotnet_style_qualification_for_field = true:warning +# dotnet_style_qualification_for_method = true:warning +# dotnet_style_qualification_for_property = true:warning + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning + +# Undocumented +dotnet_style_operator_placement_when_wrapping = end_of_line + +# Naming styles +dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning +dotnet_naming_rule.interface_should_be_begins_with_i.style = prefix_interface_with_i_style +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.types_should_be_pascal_case.severity = warning +dotnet_naming_rule.types_should_be_pascal_case.style = non_private_static_field_style +dotnet_naming_rule.types_should_be_pascal_case.symbols = types + +# By default, name items with PascalCase +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = non_private_static_field_style +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members + +# pascal_case_style - Define the PascalCase style +dotnet_naming_style.pascal_case_style.capitalization = pascal_case +dotnet_naming_symbols.all_members.applicable_kinds = * + +# Symbol specifications +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.required_modifiers = * + +# Naming styles +dotnet_naming_style.begins_with_i.capitalization = pascal_case +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = + +#### Interoperability #### + +# P/Invokes should not be visible +dotnet_diagnostic.CA1401.severity = error + +# Validate platform compatibility +dotnet_diagnostic.CA1416.severity = suggestion + +# Do not use OutAttribute on string parameters for P/Invokes +dotnet_diagnostic.CA1417.severity = suggestion + +# Validate platform compatibility +dotnet_diagnostic.CA1418.severity = suggestion + +# Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle' +dotnet_diagnostic.CA1419.severity = suggestion + +# Property, type, or attribute requires runtime marshalling +dotnet_diagnostic.CA1420.severity = suggestion + +# Method uses runtime marshalling when DisableRuntimeMarshallingAttribute is applied +dotnet_diagnostic.CA1421.severity = warning + +# Validate platform compatibility - obsoleted APIs +dotnet_diagnostic.CA1422.severity = warning + +#### Diagnostic #### + +# Avoid problematic synchronous waits +dotnet_diagnostic.VSTHRD002.severity = error + +# Avoid excessive inheritance +dotnet_diagnostic.CA1501.severity = warning + +# Avoid excessive complexity +dotnet_diagnostic.CA1502.severity = warning + +# Avoid unmaintainable code +dotnet_diagnostic.CA1505.severity = warning + +# Avoid excessive class coupling +dotnet_diagnostic.CA1506.severity = warning + +# Use nameof in place of string +dotnet_diagnostic.CA1507.severity = suggestion + +# Avoid dead conditional code +dotnet_diagnostic.CA1508.severity = warning + +# Invalid entry in code metrics configuration file +dotnet_diagnostic.CA1509.severity = suggestion + +# StatementMustNotUseUnnecessaryParenthesis +dotnet_diagnostic.SA1119.severity = suggestion + +# AccessModifierMustBeDeclared +dotnet_diagnostic.SA1400.severity = warning + +# FieldsMustBePrivate +dotnet_diagnostic.SA1401.severity = warning + +# FileMayOnlyContainASingleNamespace +dotnet_diagnostic.SA1403.severity = warning + +# DebugAssertMustProvideMessageText +dotnet_diagnostic.SA1405.severity = warning + +# DebugFailMustProvideMessageText +dotnet_diagnostic.SA1406.severity = warning + +# RemoveUnnecessaryCode +dotnet_diagnostic.SA1409.severity = warning + +# Dispose created +dotnet_diagnostic.IDISP001.severity = error + +# Dispose member +dotnet_diagnostic.IDISP002.severity = error + +# Dispose previous before re-assigning +dotnet_diagnostic.IDISP003.severity = error + +# Don't ignore created IDisposable +dotnet_diagnostic.IDISP004.severity = error + +# Return type should indicate that the value should be disposed +dotnet_diagnostic.IDISP005.severity = error + +# Implement IDisposable +dotnet_diagnostic.IDISP006.severity = error + +# Don't dispose injected +dotnet_diagnostic.IDISP007.severity = error + +# Don't assign member with injected and created disposables +dotnet_diagnostic.IDISP008.severity = error + +# Add IDisposable interface +dotnet_diagnostic.IDISP009.severity = error + +# Call base.Dispose(disposing) +dotnet_diagnostic.IDISP010.severity = error + +# Don't return disposed instance +dotnet_diagnostic.IDISP011.severity = warning + +# Property should not return created disposable +dotnet_diagnostic.IDISP012.severity = error + +# Await in using +dotnet_diagnostic.IDISP013.severity = error + +# Use a single instance of HttpClient +dotnet_diagnostic.IDISP014.severity = warning + +# Member should not return created and cached instance +dotnet_diagnostic.IDISP015.severity = error + +# Don't use disposed instance +dotnet_diagnostic.IDISP016.severity = error + +# Prefer using +dotnet_diagnostic.IDISP017.severity = error + +# Call SuppressFinalize +dotnet_diagnostic.IDISP018.severity = error + +# Call SuppressFinalize +dotnet_diagnostic.IDISP019.severity = error + +# Call SuppressFinalize(this) +dotnet_diagnostic.IDISP020.severity = error + +# Call this.Dispose(true) +dotnet_diagnostic.IDISP021.severity = error + +# Call this.Dispose(false) +dotnet_diagnostic.IDISP022.severity = error + +# Don't use reference types in finalizer context +dotnet_diagnostic.IDISP023.severity = error + +# Don't call GC.SuppressFinalize(this) when the type is sealed and has no finalizer +dotnet_diagnostic.IDISP024.severity = error + +# Class with no virtual dispose method should be sealed +dotnet_diagnostic.IDISP025.severity = error + +# Class with no virtual DisposeAsyncCore method should be sealed +dotnet_diagnostic.IDISP026.severity = error + +# Namespace does not match folder structure +dotnet_diagnostic.IDE0130.severity = warning + +#### Naming #### + +# Do not name enum values 'Reserved' +dotnet_diagnostic.CA1700.severity = warning + +# Identifiers should not contain underscores +dotnet_diagnostic.CA1707.severity = suggestion + +# Identifiers should differ by more than case +dotnet_diagnostic.CA1708.severity = error + +# Identifiers should have correct suffix +dotnet_diagnostic.CA1710.severity = suggestion + +# Identifiers should not have incorrect suffix +dotnet_diagnostic.CA1711.severity = silent + +# Do not prefix enum values with type name +dotnet_diagnostic.CA1712.severity = warning + +# Events should not have before or after prefix +dotnet_diagnostic.CA1713.severity = warning + +# Flags enums should have plural names +dotnet_diagnostic.CA1714.severity = error + +# Identifiers should have correct prefix +dotnet_diagnostic.CA1715.severity = error + +# Identifiers should not match keywords +dotnet_diagnostic.CA1716.severity = warning + +# Only FlagsAttribute enums should have plural names +dotnet_diagnostic.CA1717.severity = error + +# Identifiers should not contain type names +dotnet_diagnostic.CA1720.severity = warning + +# Property names should not match get methods +dotnet_diagnostic.CA1721.severity = warning + +# Type names should not match namespaces +dotnet_diagnostic.CA1724.severity = suggestion + +# Parameter names should match base declaration +dotnet_diagnostic.CA1725.severity = warning + +# Use PascalCase for named placeholders +dotnet_diagnostic.CA1727.severity = warning + +#### Code Quality #### +dotnet_code_quality_unused_parameters = all:warning + +#### Performance #### + +# Use Literals Where Appropriate +dotnet_diagnostic.CA1802.severity = suggestion + +# Do not initialize unnecessarily. +dotnet_diagnostic.CA1805.severity = error + +# Do not ignore method results +dotnet_diagnostic.CA1806.severity = error + +# Initialize reference type static fields inline +dotnet_diagnostic.CA1810.severity = error + +# Avoid uninstantiated internal classes +dotnet_diagnostic.CA1812.severity = warning + +# Avoid unsealed attributes +dotnet_diagnostic.CA1813.severity = error + +# Prefer jagged arrays over multidimensional +dotnet_diagnostic.CA1814.severity = warning + +# Override equals and operator equals on value types +dotnet_diagnostic.CA1815.severity = warning + +# Properties should not return arrays +dotnet_diagnostic.CA1819.severity = warning + +# Test for empty strings using string length +dotnet_diagnostic.CA1820.severity = warning + +# Remove empty finalizers +dotnet_diagnostic.CA1821.severity = error + +# Mark members as static +dotnet_diagnostic.CA1822.severity = warning + +# Avoid unused private fields +dotnet_diagnostic.CA1823.severity = error + +# Mark assemblies with NeutralResourcesLanguageAttribute +dotnet_diagnostic.CA1824.severity = suggestion + +# Avoid zero-length array allocations +dotnet_diagnostic.CA1825.severity = warning + +# Use property instead of Linq Enumerable method +dotnet_diagnostic.CA1826.severity = warning + +# Do not use Count/LongCount when Any can be used +dotnet_diagnostic.CA1827.severity = suggestion + +# Do not use CountAsync/LongCountAsync when AnyAsync can be used +dotnet_diagnostic.CA1828.severity = suggestion + +# Use Length/Count property instead of Enumerable.Count method +dotnet_diagnostic.CA1829.severity = warning + +# Prefer strongly-typed Append and Insert method overloads on StringBuilder. +dotnet_diagnostic.CA1830.severity = warning + +# Use AsSpan instead of Range-based indexers for string when appropriate +dotnet_diagnostic.CA1831.severity = warning + +# Use AsSpan or AsMemory instead of Range-based indexers for getting ReadOnlySpan or ReadOnlyMemory portion of an array +dotnet_diagnostic.CA1832.severity = warning + +# Use AsSpan or AsMemory instead of Range-based indexers for getting Span or Memory portion of an array +dotnet_diagnostic.CA1833.severity = warning + +# Use StringBuilder.Append(char) for single character strings +dotnet_diagnostic.CA1834.severity = warning + +# Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes +dotnet_diagnostic.CA1835.severity = warning + +# Prefer IsEmpty over Count when available +dotnet_diagnostic.CA1836.severity = warning + +# Use Environment.ProcessId instead of Process.GetCurrentProcess().Id +dotnet_diagnostic.CA1837.severity = warning + +# Avoid StringBuilder parameters for P/Invokes +dotnet_diagnostic.CA1838.severity = warning + +# Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName +dotnet_diagnostic.CA1839.severity = warning + +# Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId +dotnet_diagnostic.CA1840.severity = warning + +# Prefer Dictionary Contains methods +dotnet_diagnostic.CA1841.severity = warning + +# Do not use 'WhenAll' with a single task +dotnet_diagnostic.CA1842.severity = error + +# Do not use 'WaitAll' with a single task +dotnet_diagnostic.CA1843.severity = error + +# Provide memory-based overrides of async methods when subclassing 'Stream' +dotnet_diagnostic.CA1844.severity = warning + +# Use span-based 'string.Concat' +dotnet_diagnostic.CA1845.severity = warning + +# Prefer AsSpan over Substring +dotnet_diagnostic.CA1846.severity = warning + +# Use string.Contains(char) instead of string.Contains(string) with single character +dotnet_diagnostic.CA1847.severity = warning + +# Use the LoggerMessage delegates +dotnet_diagnostic.CA1848.severity = warning + +# Call async methods when in an async method +dotnet_diagnostic.CA1849.severity = error + +# Prefer static HashData method over ComputeHash +dotnet_diagnostic.CA1850.severity = error + +# Possible multiple enumerations of IEnumerable collection +dotnet_diagnostic.CA1851.severity = warning + +# Seal internal types +dotnet_diagnostic.CA1852.severity = error + +# Unnecessary call to 'Dictionary.ContainsKey(key)' +dotnet_diagnostic.CA1853.severity = error + +# Prefer the IDictionary.TryGetValue(TKey, out TValue) method +dotnet_diagnostic.CA1854.severity = error + +# Use Span.Clear() instead of Span.Fill() +dotnet_diagnostic.CA1855.severity = error + +# Use StartsWith instead of IndexOf +dotnet_diagnostic.CA1858.severity = error + +# Avoid using 'Enumerable.Any()' extension method +dotnet_diagnostic.CA1860.severity = error + +# Use Span.Clear() instead of Span.Fill() +dotnet_analyzer_diagnostic.category-Performance.severity = error + +# Use StartsWith instead of IndexOf +dotnet_analyzer_diagnostic.category-Performance.severity = error + +# Add readonly modifier +dotnet_diagnostic.IDE0044.severity = warning + +# Use 'System.HashCode.Combine' +dotnet_diagnostic.IDE0070.severity = warning + +# The UTF-7 encoding is insecure +dotnet_diagnostic.SYSLIB0001.severity = error + +# PrincipalPermissionAttribute is obsolete +dotnet_diagnostic.SYSLIB0002.severity = error + +# Code access security is not supported +dotnet_diagnostic.SYSLIB0003.severity = error + +# The constrained execution region (CER) feature is not supported +dotnet_diagnostic.SYSLIB0004.severity = error + +# The global assembly cache (GAC) is not supported +dotnet_diagnostic.SYSLIB0005.severity = error + +# Thread.Abort is not supported +dotnet_diagnostic.SYSLIB0006.severity = error + +# Default implementations of cryptography algorithms not supported +dotnet_diagnostic.SYSLIB0007.severity = error + +# CreatePdbGenerator is not supported +dotnet_diagnostic.SYSLIB0008.severity = error + +# The AuthenticationManager Authenticate and PreAuthenticate methods are not supported +dotnet_diagnostic.SYSLIB0009.severity = error + +# Unsupported remoting APIs +dotnet_diagnostic.SYSLIB0010.severity = error + +# BinaryFormatter serialization is obsolete +dotnet_diagnostic.SYSLIB0011.severity = error + +# Type or member is obsolete +dotnet_diagnostic.SYSLIB0012.severity = error + +# EscapeUriString is obsolete +dotnet_diagnostic.SYSLIB0013.severity = error + +# WebRequest, HttpWebRequest, ServicePoint, WebClient are obsolete +dotnet_diagnostic.SYSLIB0014.severity = error + +# DisablePrivateReflectionAttribute is obsolete +dotnet_diagnostic.SYSLIB0015.severity = error + +# GetContextInfo() is obsolete +dotnet_diagnostic.SYSLIB0016.severity = error + +# Strong-name signing is not supported and throws PlatformNotSupportedException +dotnet_diagnostic.SYSLIB0017.severity = error + +# Reflection-only loading is not supported and throws PlatformNotSupportedException +dotnet_diagnostic.SYSLIB0018.severity = error + +# Some RuntimeEnvironment APIs are obsolete +dotnet_diagnostic.SYSLIB0019.severity = error + +# IgnoreNullValues is obsolete +dotnet_diagnostic.SYSLIB0020.severity = error + +# Derived cryptographic types are obsolete +dotnet_diagnostic.SYSLIB0021.severity = error + +# The Rijndael and RijndaelManaged types are obsolete +dotnet_diagnostic.SYSLIB0022.severity = error + +# RNGCryptoServiceProvider is obsolete +dotnet_diagnostic.SYSLIB0023.severity = error + +# Creating and unloading AppDomains is not supported and throws an exception +dotnet_diagnostic.SYSLIB0024.severity = error + +# SuppressIldasmAttribute is obsolete +dotnet_diagnostic.SYSLIB0025.severity = error + +# X509Certificate and X509Certificate2 are immutable +dotnet_diagnostic.SYSLIB0026.severity = error + +# PublicKey.Key is obsolete +dotnet_diagnostic.SYSLIB0027.severity = error + +# X509Certificate2.PrivateKey is obsolete +dotnet_diagnostic.SYSLIB0028.severity = error + +# ProduceLegacyHmacValues is obsolete +dotnet_diagnostic.SYSLIB0029.severity = error + +# HMACSHA1 always uses the algorithm implementation provided by the platform +dotnet_diagnostic.SYSLIB0030.severity = error + +# EncodeOID is obsolete +dotnet_diagnostic.SYSLIB0031.severity = error + +# Recovery from corrupted process state exceptions is not supported +dotnet_diagnostic.SYSLIB0032.severity = error + +# Rfc2898DeriveBytes.CryptDeriveKey is obsolete +dotnet_diagnostic.SYSLIB0033.severity = error + +# CmsSigner(CspParameters) constructor is obsolete +dotnet_diagnostic.SYSLIB0034.severity = error + +# ComputeCounterSignature without specifying a CmsSigner is obsolete +dotnet_diagnostic.SYSLIB0035.severity = error + +# Regex.CompileToAssembly is obsolete +dotnet_diagnostic.SYSLIB0036.severity = error + +# AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete +dotnet_diagnostic.SYSLIB0037.severity = error + +# SerializationFormat.Binary is obsolete +dotnet_diagnostic.SYSLIB0038.severity = error + +# SslProtocols.Tls and SslProtocols.Tls11 are obsolete +dotnet_diagnostic.SYSLIB0039.severity = error + +# EncryptionPolicy.NoEncryption and EncryptionPolicy.AllowNoEncryption are obsolete +dotnet_diagnostic.SYSLIB0040.severity = error + +# Some Rfc2898DeriveBytes constructors are obsolete +dotnet_diagnostic.SYSLIB0041.severity = error + +# FromXmlString and ToXmlString on ECC types are obsolete +dotnet_diagnostic.SYSLIB0042.severity = error + +# ECDiffieHellmanPublicKey.ToByteArray is obsolete +dotnet_diagnostic.SYSLIB0043.severity = error + +# AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete +dotnet_diagnostic.SYSLIB0044.severity = error + +# Some cryptographic factory methods are obsolete +dotnet_diagnostic.SYSLIB0045.severity = error + +# ControlledExecution.Run should not be used +dotnet_diagnostic.SYSLIB0046.severity = error + +# XmlSecureResolver is obsolete +dotnet_diagnostic.SYSLIB0047.severity = error + +# RSA.EncryptValue and DecryptValue are obsolete +dotnet_diagnostic.SYSLIB0048.severity = error + +# Logging method names can't start with an underscore +dotnet_diagnostic.SYSLIB1001.severity = error + +# Don't include log level parameters as templates in the logging message +dotnet_diagnostic.SYSLIB1002.severity = error + +# Logging method parameter names can't start with an underscore +dotnet_diagnostic.SYSLIB1003.severity = error + +# Could not find a required type definition +dotnet_diagnostic.SYSLIB1005.severity = error + +# Multiple logging methods cannot use the same event ID +dotnet_diagnostic.SYSLIB1006.severity = error + +# Logging methods must return void +dotnet_diagnostic.SYSLIB1007.severity = error + +# One of the arguments to a logging method must implement the ILogger interface +dotnet_diagnostic.SYSLIB1008.severity = error + +# Logging methods must be static +dotnet_diagnostic.SYSLIB1009.severity = error + +# Logging methods must be partial +dotnet_diagnostic.SYSLIB1010.severity = error + +# Logging methods cannot be generic +dotnet_diagnostic.SYSLIB1011.severity = error + +# Redundant qualifier in logging message +dotnet_diagnostic.SYSLIB1012.severity = error + +# Don't include exception parameters as templates in the logging message +dotnet_diagnostic.SYSLIB1013.severity = error + +# Logging template has no corresponding method argument +dotnet_diagnostic.SYSLIB1014.severity = error + +# Argument is not referenced from the logging message +dotnet_diagnostic.SYSLIB1015.severity = error + +# Logging methods cannot have a body +dotnet_diagnostic.SYSLIB1016.severity = error + +# A LogLevel value must be supplied in the LoggerMessage attribute or as a parameter to the logging method +dotnet_diagnostic.SYSLIB1017.severity = error + +# Don't include logger parameters as templates in the logging message +dotnet_diagnostic.SYSLIB1018.severity = error + +# Couldn't find a field of type ILogger +dotnet_diagnostic.SYSLIB1019.severity = error + +# Found multiple fields of type ILogger +dotnet_diagnostic.SYSLIB1020.severity = error + +# Multiple message-template item names differ only by case +dotnet_diagnostic.SYSLIB1021.severity = error + +# Can't have malformed format strings +dotnet_diagnostic.SYSLIB1022.severity = error + +# Generating more than six arguments is not supported +dotnet_diagnostic.SYSLIB1023.severity = error + +# System.Text.Json source generator did not generate output for type +dotnet_diagnostic.SYSLIB1030.severity = error + +# System.Text.Json source generator encountered a duplicate type info property name +dotnet_diagnostic.SYSLIB1031.severity = error + +# Context classes to be augmented by the System.Text.Json source generator must be declared as partial +dotnet_diagnostic.SYSLIB1032.severity = error + +# System.Text.Json source generator encountered a type with multiple [JsonConstructor] annotations +dotnet_diagnostic.SYSLIB1033.severity = error + +# System.Text.Json source generator encountered a type with multiple [JsonExtensionData] annotations +dotnet_diagnostic.SYSLIB1035.severity = error + +# System.Text.Json source generator encountered an invalid [JsonExtensionData] annotation +dotnet_diagnostic.SYSLIB1036.severity = error + +# System.Text.Json source generator encountered a type with init-only properties which are not supported for deserialization +dotnet_diagnostic.SYSLIB1037.severity = error + +# System.Text.Json source generator encountered a property annotated with [JsonInclude] but with inaccessible accessors +dotnet_diagnostic.SYSLIB1038.severity = error + +# Invalid GeneratedRegexAttribute usage. +dotnet_diagnostic.SYSLIB1040.severity = error + +# Multiple GeneratedRegexAttribute attributes were applied to the same method, but only one is allowed. +dotnet_diagnostic.SYSLIB1041.severity = error + +# The specified regular expression is invalid. +dotnet_diagnostic.SYSLIB1042.severity = error + +# A GeneratedRegexAttribute method must be partial, parameterless, non-generic, and non-abstract, and return Regex. +dotnet_diagnostic.SYSLIB1043.severity = error + +# The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. +dotnet_diagnostic.SYSLIB1044.severity = error + +# Use GeneratedRegexAttribute to generate the regular expression implementation at compile time. +dotnet_diagnostic.SYSLIB1045.severity = suggestion #CHANGE TO WARNING + +# Invalid LibraryImportAttribute usage. +dotnet_diagnostic.SYSLIB1050.severity = error + +# The specified type is not supported by source-generated p/invokes. +dotnet_diagnostic.SYSLIB1051.severity = error + +# The specified configuration is not supported by source-generated p/invokes. +dotnet_diagnostic.SYSLIB1052.severity = error + +# The specified LibraryImportAttribute arguments cannot be forwarded to DllImportAttribute. +dotnet_diagnostic.SYSLIB1053.severity = error + +# Use LibraryImportAttribute instead of DllImportAttribute to generate p/invoke marshalling code at compile time. +dotnet_diagnostic.SYSLIB1054.severity = suggestion #SHOULD BE ERROR + +# Invalid CustomMarshallerAttribute usage. +dotnet_diagnostic.SYSLIB1055.severity = error + +# The specified native type is invalid. +dotnet_diagnostic.SYSLIB1056.severity = error + +# The marshaller type does not have the required shape. +dotnet_diagnostic.SYSLIB1057.severity = error + +# Invalid NativeMarshallingAttribute usage +dotnet_diagnostic.SYSLIB1058.severity = error + +# The marshaller type does not support an allocating constructor. +dotnet_diagnostic.SYSLIB1059.severity = error + +# The specified marshaller type is invalid. +dotnet_diagnostic.SYSLIB1060.severity = error + +# The marshaller type has incompatible method signatures. +dotnet_diagnostic.SYSLIB1061.severity = error + +# The project must be updated with true. +dotnet_diagnostic.SYSLIB1062.severity = error + +# Invalid JSImportAttribute usage. +dotnet_diagnostic.SYSLIB1070.severity = error + +# Invalid JSExportAttribute usage. +dotnet_diagnostic.SYSLIB1071.severity = error + +# The specified type is not supported by source-generated JavaScript interop. +dotnet_diagnostic.SYSLIB1072.severity = error + +# The specified configuration is not supported by source-generated JavaScript interop. +dotnet_diagnostic.SYSLIB1073.severity = error + +# JSImportAttribute requires unsafe code. +dotnet_diagnostic.SYSLIB1074.severity = error + +# JSExportAttribute requires unsafe code. +dotnet_diagnostic.SYSLIB1075.severity = error + + +dotnet_diagnostic.SYSLIB1070.severity = error + + +dotnet_diagnostic.SYSLIB1070.severity = error + +dotnet_diagnostic.RemoveUnnecessaryImportsFixable.severity = warning + +#### Reliability #### + +# Dispose objects before losing scope +dotnet_diagnostic.CA2000.severity = error + +# Do not lock on objects with weak identity +dotnet_diagnostic.CA2002.severity = error + +# Do not directly await a Task +dotnet_diagnostic.CA2007.severity = error + +# Do not create tasks without passing a TaskScheduler +dotnet_diagnostic.CA2008.severity = suggestion + +# Do not call ToImmutableCollection on an ImmutableCollection value +dotnet_diagnostic.CA2009.severity = error + +# Do not assign property within its setter +dotnet_diagnostic.CA2011.severity = error + +# Use ValueTasks correctly +dotnet_diagnostic.CA2012.severity = error + +# Do not use ReferenceEquals with value types +dotnet_diagnostic.CA2013.severity = suggestion + +# Do not use stackalloc in loops +dotnet_diagnostic.CA2014.severity = error + +# Do not define finalizers for types derived from MemoryManager +dotnet_diagnostic.CA2015.severity = error + +# Forward the CancellationToken parameter to methods that take one +dotnet_diagnostic.CA2016.severity = suggestion + +# Parameter count mismatch +dotnet_diagnostic.CA2017.severity = error + +# The count argument to Buffer.BlockCopy should specify the number of bytes to copy +dotnet_diagnostic.CA2018.severity = warning + +# ThreadStatic fields should not use inline initialization +dotnet_diagnostic.CA2019.severity = warning + +# Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr +dotnet_diagnostic.CA2020.severity = warning + +#### Security Rules #### + +# Review SQL queries for security vulnerabilities +dotnet_diagnostic.CA2100.severity = error + +# Review visible event handlers +dotnet_diagnostic.CA2109.severity = warning + +# Seal methods that satisfy private interfaces +dotnet_diagnostic.CA2119.severity = warning + +# Avoid handling Corrupted State Exceptions +dotnet_diagnostic.CA2153.severity = warning + +# Do not use insecure deserializer BinaryFormatter +dotnet_diagnostic.CA2300.severity = warning + +# Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder +dotnet_diagnostic.CA2301.severity = warning + +# Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize +dotnet_diagnostic.CA2302.severity = warning + +# Do not use insecure deserializer LosFormatter +dotnet_diagnostic.CA2305.severity = warning + +# Do not use insecure deserializer NetDataContractSerializer +dotnet_diagnostic.CA2310.severity = warning + +# Do not deserialize without first setting NetDataContractSerializer.Binder +dotnet_diagnostic.CA2311.severity = warning + +# Ensure NetDataContractSerializer.Binder is set before deserializing +dotnet_diagnostic.CA2312.severity = warning + +# Do not use insecure deserializer ObjectStateFormatter +dotnet_diagnostic.CA2315.severity = warning + +# Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver +dotnet_diagnostic.CA2321.severity = warning + +# Ensure JavaScriptSerializer is not initialized with SimpleTypeResolver before deserializing +dotnet_diagnostic.CA2322.severity = warning + +# Do not use TypeNameHandling values other than None +dotnet_diagnostic.CA2326.severity = warning + +# Do not use insecure JsonSerializerSettings +dotnet_diagnostic.CA2327.severity = warning + +# Ensure that JsonSerializerSettings are secure +dotnet_diagnostic.CA2328.severity = warning + +# Do not deserialize with JsonSerializer using an insecure configuration +dotnet_diagnostic.CA2329.severity = warning + +# Ensure that JsonSerializer has a secure configuration when deserializing +dotnet_diagnostic.CA2330.severity = warning + +# Ensure DataTable.ReadXml()'s input is trusted +dotnet_diagnostic.CA2350.severity = warning + +# Ensure DataSet.ReadXml()'s input is trusted +dotnet_diagnostic.CA2351.severity = warning + +# Unsafe DataSet or DataTable in serializable type can be vulnerable to remote code execution attacks +dotnet_diagnostic.CA2352.severity = warning + +# Unsafe DataSet or DataTable in serializable type +dotnet_diagnostic.CA2353.severity = warning + +# Unsafe DataSet or DataTable in deserialized object graph can be vulnerable to remote code execution attack +dotnet_diagnostic.CA2354.severity = warning + +# Unsafe DataSet or DataTable in deserialized object graph +dotnet_diagnostic.CA2355.severity = warning + +# Unsafe DataSet or DataTable type in web deserialized object graph +dotnet_diagnostic.CA2356.severity = warning + +# Ensure autogenerated class containing DataSet.ReadXml() is not used with untrusted data +dotnet_diagnostic.CA2361.severity = warning + +# Unsafe DataSet or DataTable in autogenerated serializable type can be vulnerable to remote code execution attacks +dotnet_diagnostic.CA2362.severity = warning + +# Review code for SQL injection vulnerabilities +dotnet_diagnostic.CA3001.severity = warning + +# Review code for XSS vulnerabilities +dotnet_diagnostic.CA3002.severity = warning + +# Review code for file path injection vulnerabilities +dotnet_diagnostic.CA3003.severity = warning + +# Review code for information disclosure vulnerabilities +dotnet_diagnostic.CA3004.severity = warning + +# Review code for LDAP injection vulnerabilities +dotnet_diagnostic.CA3005.severity = warning + +# Review code for process command injection vulnerabilities +dotnet_diagnostic.CA3006.severity = warning + +# Review code for open redirect vulnerabilities +dotnet_diagnostic.CA3007.severity = warning + +# Review code for XPath injection vulnerabilities +dotnet_diagnostic.CA3008.severity = warning + +# Review code for XML injection vulnerabilities +dotnet_diagnostic.CA3009.severity = warning + +# Review code for XAML injection vulnerabilities +dotnet_diagnostic.CA3010.severity = warning + +# Review code for DLL injection vulnerabilities +dotnet_diagnostic.CA3011.severity = warning + +# Review code for regex injection vulnerabilities +dotnet_diagnostic.CA3012.severity = warning + +# Do Not Add Schema By URL +dotnet_diagnostic.CA3061.severity = warning + +# Insecure DTD processing in XML +dotnet_diagnostic.CA3075.severity = warning + +# Insecure XSLT script processing. +dotnet_diagnostic.CA3076.severity = warning + +# Insecure Processing in API Design, XmlDocument and XmlTextReader +dotnet_diagnostic.CA3077.severity = warning + +# Mark Verb Handlers With Validate Antiforgery Token +dotnet_diagnostic.CA3147.severity = warning + +# Do Not Use Weak Cryptographic Algorithms +dotnet_diagnostic.CA5350.severity = warning + +# Do Not Use Broken Cryptographic Algorithms +dotnet_diagnostic.CA5351.severity = warning + +# Do Not Use Unsafe Cipher Modes +dotnet_diagnostic.CA5358.severity = warning + +# Do Not Disable Certificate Validation +dotnet_diagnostic.CA5359.severity = warning + +# Do Not Call Dangerous Methods In Deserialization +dotnet_diagnostic.CA5360.severity = warning + +# Do Not Disable SChannel Use of Strong Crypto +dotnet_diagnostic.CA5361.severity = warning + +# Do Not Refer Self In Serializable Class +dotnet_diagnostic.CA5362.severity = error + +# Do Not Disable Request Validation +dotnet_diagnostic.CA5363.severity = warning + +# Do Not Use Deprecated Security Protocols +dotnet_diagnostic.CA5364.severity = warning + +# Do Not Disable HTTP Header Checking +dotnet_diagnostic.CA5365.severity = warning + +# Use XmlReader For DataSet Read Xml +dotnet_diagnostic.CA5366.severity = warning + +# Do Not Serialize Types With Pointer Fields +dotnet_diagnostic.CA5367.severity = warning + +# Set ViewStateUserKey For Classes Derived From Page +dotnet_diagnostic.CA5368.severity = warning + +# Use XmlReader For Deserialize +dotnet_diagnostic.CA5369.severity = warning + +# Use XmlReader For Validating Reader +dotnet_diagnostic.CA5370.severity = warning + +# Use XmlReader For Schema Read +dotnet_diagnostic.CA5371.severity = warning + +# Use XmlReader For XPathDocument +dotnet_diagnostic.CA5372.severity = warning + +# Do not use obsolete key derivation function +dotnet_diagnostic.CA5373.severity = warning + +# Do Not Use XslTransform +dotnet_diagnostic.CA5374.severity = warning + +# Do Not Use Account Shared Access Signature +dotnet_diagnostic.CA5375.severity = warning + +# Use SharedAccessProtocol HttpsOnly +dotnet_diagnostic.CA5376.severity = warning + +# Use Container Level Access Policy +dotnet_diagnostic.CA5377.severity = warning + +# Do not disable ServicePointManagerSecurityProtocols +dotnet_diagnostic.CA5378.severity = warning + +# Do Not Use Weak Key Derivation Function Algorithm +dotnet_diagnostic.CA5379.severity = warning + +# Do Not Add Certificates To Root Store +dotnet_diagnostic.CA5380.severity = warning + +# Ensure Certificates Are Not Added To Root Store +dotnet_diagnostic.CA5381.severity = warning + +# Use Secure Cookies In ASP.Net Core +dotnet_diagnostic.CA5382.severity = warning + +# Ensure Use Secure Cookies In ASP.Net Core +dotnet_diagnostic.CA5383.severity = warning + +# Do Not Use Digital Signature Algorithm (DSA) +dotnet_diagnostic.CA5384.severity = warning + +# Use Rivest–Shamir–Adleman (RSA) Algorithm With Sufficient Key Size +dotnet_diagnostic.CA5385.severity = warning + +# Avoid hardcoding SecurityProtocolType value +dotnet_diagnostic.CA5386.severity = warning + +# Do Not Use Weak Key Derivation Function With Insufficient Iteration Count +dotnet_diagnostic.CA5387.severity = warning + +# Ensure Sufficient Iteration Count When Using Weak Key Derivation Function +dotnet_diagnostic.CA5388.severity = warning + +# Do Not Add Archive Item's Path To The Target File System Path +dotnet_diagnostic.CA5389.severity = suggestion + +# Do Not Hard Code Encryption Key +dotnet_diagnostic.CA5390.severity = error + +# Use antiforgery tokens in ASP.NET Core MVC controllers +dotnet_diagnostic.CA5391.severity = warning + +# Use DefaultDllImportSearchPaths attribute for P/Invokes +dotnet_diagnostic.CA5392.severity = warning + +# Do not use unsafe DllImportSearchPath value +dotnet_diagnostic.CA5393.severity = warning + +# Do not use insecure randomness +dotnet_diagnostic.CA5394.severity = warning + +# Miss HttpVerb attribute for action methods +dotnet_diagnostic.CA5395.severity = warning + +# Set HttpOnly to true for HttpCookie +dotnet_diagnostic.CA5396.severity = warning + +# Do not use deprecated SslProtocols values +dotnet_diagnostic.CA5397.severity = warning + +# Avoid hardcoded SslProtocols values +dotnet_diagnostic.CA5398.severity = warning + +# Definitely disable HttpClient certificate revocation list check +dotnet_diagnostic.CA5399.severity = warning + +# Ensure HttpClient certificate revocation list check is not disabled +dotnet_diagnostic.CA5400.severity = warning + +# Do not use CreateEncryptor with non-default IV +dotnet_diagnostic.CA5401.severity = suggestion + +# Use CreateEncryptor with the default IV +dotnet_diagnostic.CA5402.severity = warning + +# Do not hard-code certificate +dotnet_diagnostic.CA5403.severity = error + +# Do not disable token validation checks +dotnet_diagnostic.CA5404.severity = error + +# Do not always skip token validation in delegates +dotnet_diagnostic.CA5404.severity = error + +# Do not always skip token validation in delegates +dotnet_diagnostic.CA5405.severity = error + +#### Usage Rules #### +# Review unused parameters +dotnet_diagnostic.CA1801.severity = warning + +# Call GC.SuppressFinalize correctly +dotnet_diagnostic.CA1816.severity = error + +# Rethrow to preserve stack details +dotnet_diagnostic.CA2200.severity = error + +# Do not raise reserved exception types +dotnet_diagnostic.CA2201.severity = error + +# Initialize value type static fields inline +dotnet_diagnostic.CA2207.severity = warning + +# Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = error + +# Non-constant fields should not be visible +dotnet_diagnostic.CA2211.severity = error + +# Disposable fields should be disposed +dotnet_diagnostic.CA2213.severity = error + +# Do not call overridable methods in constructors +dotnet_diagnostic.CA2214.severity = warning + +# Dispose methods should call base class dispose +dotnet_diagnostic.CA2215.severity = warning + +# Disposable types should declare finalizer +dotnet_diagnostic.CA2216.severity = warning + +# Do not mark enums with FlagsAttribute +dotnet_diagnostic.CA2217.severity = error + +# Override GetHashCode on overriding Equals +dotnet_diagnostic.CA2218.severity = warning + +# Do not raise exceptions in exception clauses +dotnet_diagnostic.CA2219.severity = error + +# Override Equals on overloading operator equals +dotnet_diagnostic.CA2224.severity = warning + +# Operator overloads have named alternates +dotnet_diagnostic.CA2225.severity = warning + +# Operators should have symmetrical overloads +dotnet_diagnostic.CA2226.severity = warning + +# Collection properties should be read only +dotnet_diagnostic.CA2227.severity = warning + +# Implement serialization constructors +dotnet_diagnostic.CA2229.severity = warning + +# Overload operator equals on overriding ValueType.Equals +dotnet_diagnostic.CA2231.severity = warning + +# Pass System.Uri objects instead of strings +dotnet_diagnostic.CA2234.severity = warning + +# Mark all non-serializable fields +dotnet_diagnostic.CA2235.severity = suggestion + +# Mark ISerializable types with SerializableAttribute +dotnet_diagnostic.CA2237.severity = warning + +# Provide correct arguments to formatting methods +dotnet_diagnostic.CA2241.severity = warning + +# Test for NaN correctly +dotnet_diagnostic.CA2242.severity = warning + +# Attribute string literals should parse correctly +dotnet_diagnostic.CA2243.severity = warning + +# Do not duplicate indexed element initializations +dotnet_diagnostic.CA2244.severity = warning + +# Do not assign a property to itself +dotnet_diagnostic.CA2245.severity = warning + +# Do not assign a symbol and its member in the same statement +dotnet_diagnostic.CA2246.severity = warning + +# Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum +dotnet_diagnostic.CA2247.severity = warning + +# Provide correct enum argument to Enum.HasFlag +dotnet_diagnostic.CA2248.severity = warning + +# Consider using String.Contains instead of String.IndexOf +dotnet_diagnostic.CA2249.severity = warning + +# Use ThrowIfCancellationRequested +dotnet_diagnostic.CA2250.severity = warning + +# Use String.Equals over String.Compare +dotnet_diagnostic.CA2251.severity = warning + +# Opt in to preview features +dotnet_diagnostic.CA2252.severity = suggestion + +# Named placeholders should not be numeric values +dotnet_diagnostic.CA2253.severity = warning + +# Template should be a static expression +dotnet_diagnostic.CA2254.severity = warning + +# The ModuleInitializer attribute should not be used in libraries +dotnet_diagnostic.CA2255.severity = warning + +# All members declared in parent interfaces must have an implementation in a DynamicInterfaceCastableImplementation-attributed interface +dotnet_diagnostic.CA2256.severity = warning + +# Members defined on an interface with 'DynamicInterfaceCastableImplementationAttribute' should be 'static' +dotnet_diagnostic.CA2257.severity = warning + +# Providing a 'DynamicInterfaceCastableImplementation' interface in Visual Basic is unsupported +dotnet_diagnostic.CA2258.severity = warning + +# Ensure ThreadStatic is only used with static fields +dotnet_diagnostic.CA2259.severity = warning + +# Implement generic math interfaces correctly +dotnet_diagnostic.CA2260.severity = warning + +#### Language Rules #### +# this and Me preferences +dotnet_diagnostic.IDE0003.severity = suggestion +dotnet_diagnostic.IDE0009.severity = suggestion +dotnet_style_qualification_for_field = true:suggestion + +# Simplify 'default' expression +dotnet_diagnostic.IDE0034.severity = suggestion + +# Order modifiers +dotnet_diagnostic.IDE0036.severity = warning + +# Add accessibility modifiers +dotnet_diagnostic.IDE0040.severity = error + +# Format string contains invalid placeholder +dotnet_diagnostic.IDE0043.severity = warning + +# Add readonly modifier +dotnet_diagnostic.IDE0044.severity = warning + +# Language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning + +# Use language keywords instead of framework type names for type references +dotnet_diagnostic.IDE0049.severity = suggestion + +# Convert anonymous type to tuple +dotnet_diagnostic.IDE0050.severity = suggestion + +# Use index operator +dotnet_diagnostic.IDE0056.severity = suggestion + +# Use range operator +dotnet_diagnostic.IDE0057.severity = suggestion + +# Make local function static +dotnet_diagnostic.IDE0062.severity = suggestion + +# Add missing cases to switch expression +dotnet_diagnostic.IDE0072.severity = suggestion + +# Simplify new expression +dotnet_diagnostic.IDE0090.severity = suggestion + +# ??? +dotnet_diagnostic.IDE0120.severity = suggestion + +# Make struct fields writable +dotnet_diagnostic.IDE0064.severity = suggestion + +# Parentheses preferences +dotnet_diagnostic.IDE0047.severity = warning +dotnet_diagnostic.IDE0048.severity = warning + +# Add missing cases to switch statement +dotnet_diagnostic.IDE0010.severity = suggestion + +# Use object initializers +dotnet_diagnostic.IDE0017.severity = suggestion + +# Inline variable declaration +dotnet_diagnostic.IDE0018.severity = warning + +# Use collection initializers +dotnet_diagnostic.IDE0028.severity = suggestion + +# Use auto property +dotnet_diagnostic.IDE0032.severity = suggestion + +# Use explicitly provided tuple name +dotnet_diagnostic.IDE0033.severity = suggestion + +# Simplify 'default' expression +dotnet_diagnostic.IDE0034.severity = suggestion + +# Use inferred member name +dotnet_diagnostic.IDE0037.severity = suggestion + +# Use local function instead of lambda +dotnet_diagnostic.IDE0039.severity = suggestion + +# Deconstruct variable declaration +dotnet_diagnostic.IDE0042.severity = suggestion + +# Convert anonymous type to tuple +dotnet_diagnostic.IDE050.severity = suggestion + +# Use compound assignment +dotnet_diagnostic.IDE0054.severity = suggestion +dotnet_diagnostic.IDE0074.severity = suggestion + +# Simplify conditional expression +dotnet_diagnostic.IDE0075.severity = suggestion + +# Convert typeof to nameof +dotnet_diagnostic.IDE0082.severity = suggestion + +# Simplify new expression +dotnet_diagnostic.IDE0090.severity = suggestion + +# Use throw expression +dotnet_diagnostic.IDE0016.severity = warning + +# Use coalesce expression +dotnet_diagnostic.IDE0029.severity = suggestion +dotnet_diagnostic.IDE0030.severity = suggestion + +# Expression-level preferences + +# Use conditional expression for assignment +dotnet_diagnostic.IDE0045.severity = suggestion + +# Use conditional expression for return +dotnet_diagnostic.IDE0046.severity = suggestion + +dotnet_style_collection_initializer = true:warning +dotnet_style_explicit_tuple_names = true:warning +dotnet_style_object_initializer = true:warning +dotnet_style_prefer_auto_properties = true:warning +dotnet_style_prefer_compound_assignment = true:warning +dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion +dotnet_style_prefer_conditional_expression_over_return = false:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning +dotnet_style_prefer_inferred_tuple_names = true:warning +dotnet_style_prefer_simplified_boolean_expressions = false:silent +dotnet_style_prefer_simplified_interpolation = true:warning + +# Null-checking preferences +dotnet_style_coalesce_expression = true:warning +dotnet_style_null_propagation = true:warning +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = none + +# Use null propagation +dotnet_diagnostic.IDE0031.severity = suggestion + +# Use is null check +dotnet_diagnostic.IDE0041.severity = suggestion + +# Prefer 'null' check over type check +dotnet_diagnostic.IDE0050.severity = suggestion + +# Use conditional delegate call +dotnet_diagnostic.IDE1005.severity = suggestion + +# 'var' preferences +dotnet_diagnostic.IDE0007.severity = warning +dotnet_diagnostic.IDE0008.severity = warning + +# Use expression body for constructors +dotnet_diagnostic.IDE0021.severity = silent + +# Use expression body for methods +dotnet_diagnostic.IDE0022.severity = silent + +# Use expression body for operators +dotnet_diagnostic.IDE0023.severity = warning +dotnet_diagnostic.IDE0024.severity = silent + +# Use expression body for properties +dotnet_diagnostic.IDE0025.severity = warning + +# Use expression body for indexers +dotnet_diagnostic.IDE0026.severity = suggestion + +# Use expression body for accessors +dotnet_diagnostic.IDE0027.severity = suggestion + +# Use expression body for lambdas +dotnet_diagnostic.IDE0053.severity = suggestion + +# Use expression body for local functions +dotnet_diagnostic.IDE0061.severity = suggestion + +# Use pattern matching to avoid 'as' followed by a 'null' check +dotnet_diagnostic.IDE0019.severity = warning + +# Use pattern matching to avoid 'is' check followed by a cast +dotnet_diagnostic.IDE0020.severity = warning + +# Use coalesce expression (nullable types) +dotnet_diagnostic.IDE0030.severity = warning + +# Use pattern matching to avoid is check followed by a cast (without variable) +dotnet_diagnostic.IDE0038.severity = warning + +# Use switch expression +dotnet_diagnostic.IDE0066.severity = warning + +# Use pattern matching +dotnet_diagnostic.IDE0078.severity = suggestion + +# Use pattern matching (not operator) +dotnet_diagnostic.IDE0083.severity = suggestion + +# Use pattern matching (IsNot operator) +dotnet_diagnostic.IDE0084.severity = suggestion +visual_basic_style_prefer_isnot_expression = true : suggestion + +# Namespace declaration preferences +dotnet_diagnostic.IDE0160.severity = suggestion +dotnet_diagnostic.IDE0161.severity = suggestion + +# Simplify property pattern +dotnet_diagnostic.IDE0170.severity = suggestion + +# Use tuple to swap values +dotnet_diagnostic.IDE0180.severity = suggestion + +# Add braces +dotnet_diagnostic.IDE0011.severity = error + +# Use simple 'using' statement +dotnet_diagnostic.IDE0063.severity = suggestion + +# 'using' directive placement +dotnet_diagnostic.IDE0065.severity = error + +# Require file header +dotnet_diagnostic.IDE0073.severity = warning +file_header_template = unset + +# Fix formatting +dotnet_diagnostic.IDE0055.severity = suggestion + +# Organize usings +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = true + +# IDE1006 (Naming rule violation) +dotnet_diagnostic.IDE1006.severity = none +dotnet_naming_rule.public_members_must_be_capitalized.severity = warning +dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style +dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols +dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.public_symbols.applicable_accessibilities = public +dotnet_naming_symbols.public_symbols.applicable_kinds = property, method, field, event, delegate +dotnet_naming_symbols.public_symbols.required_modifiers = readonly +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum + +# RS0016: Add public types and members to the declared API +dotnet_public_api_analyzer.require_api_files = true + +# Do not use generic CodeAction.Create to create CodeAction +dotnet_diagnostic.RS0005.severity = none + +#### Design Rules #### +# CA1000: Do not declare static members on generic typesk +dotnet_diagnostic.CA1000.severity = suggestion + +# CA1001: Types that own disposable fields should be disposable +dotnet_diagnostic.CA1001.severity = error + +# CA1002: Do not expose generic lists +dotnet_diagnostic.CA1002.severity = error + +# CA1003: Use generic event handler instances +dotnet_diagnostic.CA1003.severity = warning + +# CA1005: Avoid excessive parameters on generic types +dotnet_diagnostic.CA1005.severity = warning + +# CA1008: Enums should have zero value +dotnet_diagnostic.CA1008.severity = warning + +# CA1010: Collections should implement generic interface +dotnet_diagnostic.CA1010.severity = warning + +# CA1012: Abstract types should not have public constructors +dotnet_diagnostic.CA1012.severity = error + +# CA1014: Mark assemblies with CLSCompliantAttribute +dotnet_diagnostic.CA1014.severity = none + +# CA1016: Mark assemblies with AssemblyVersionAttribute +dotnet_diagnostic.CA1016.severity = error + +# CA1017: Mark assemblies with ComVisibleAttribute +dotnet_diagnostic.CA1017.severity = silent + +# CA1018: Mark attributes with AttributeUsageAttribute +dotnet_diagnostic.CA1018.severity = suggestion + +# CA1019: Define accessors for attribute arguments +dotnet_diagnostic.CA1019.severity = suggestion + +# CA1021: Avoid out parameters +dotnet_diagnostic.CA1021.severity = suggestion + +# CA1024: Use properties where appropriate +dotnet_diagnostic.CA1024.severity = suggestion + +# CA1027: Mark enums with FlagsAttribute +dotnet_diagnostic.CA1027.severity = error + +# CA1028: Enum storage should be Int32 +dotnet_diagnostic.CA1028.severity = error + +# CA1030: Use events where appropriate +dotnet_diagnostic.CA1030.severity = suggestion + +# CA1031: Do not catch general exception types +# dotnet_diagnostic.CA1031.severity = error + +# CA1032: Implement standard exception constructors +dotnet_diagnostic.CA1032.severity = suggestion + +# CA1033: Interface methods should be callable by child types +dotnet_diagnostic.CA1033.severity = suggestion + +# CA1034: Nested types should not be visible +dotnet_diagnostic.CA1034.severity = error + +# CA1036: Override methods on comparable types +dotnet_diagnostic.CA1036.severity = suggestion + +# CA1040: Avoid empty interfaces +dotnet_diagnostic.CA1040.severity = suggestion + +# CA1041: Provide ObsoleteAttribute message +dotnet_diagnostic.CA1041.severity = warning + +# CA1043: Use integral or string argument for indexers +dotnet_diagnostic.CA1043.severity = suggestion + +# CA1044: Properties should not be write only +dotnet_diagnostic.CA1044.severity = error + +# CA1045: Do not pass types by reference +dotnet_diagnostic.CA1045.severity = warning + +# CA1046: Do not overload operator equals on reference types +dotnet_diagnostic.CA1046.severity = warning + +# CA1047: Do not declare protected members in sealed types +dotnet_diagnostic.CA1047.severity = error + +# CA1050: Declare types in namespaces +dotnet_diagnostic.CA1050.severity = warning + +# CA1051: Do not declare visible instance fields +dotnet_diagnostic.CA1051.severity = error + +# CA1052: Static holder types should be Static or NotInheritable +dotnet_diagnostic.CA1052.severity = warning + +# CA1053: Static holder types should not have default constructors +dotnet_diagnostic.CA1053.severity = warning + +# CA1054: URI parameters should not be strings +dotnet_diagnostic.CA1054.severity = warning + +# CA1055: URI return values should not be strings +dotnet_diagnostic.CA1055.severity = warning + +# CA1056: URI properties should not be strings +dotnet_diagnostic.CA1056.severity = warning + +# CA1058: Types should not extend certain base types +dotnet_diagnostic.CA1058.severity = warning + +# CA1060: Move P/Invokes to NativeMethods class +dotnet_diagnostic.CA1060.severity = warning + +# CA1061: Do not hide base class methods +dotnet_diagnostic.CA1061.severity = warning + +# CA1062: Validate arguments of public methods +dotnet_diagnostic.CA1062.severity = suggestion + +# CA1063: Implement IDisposable correctly +dotnet_diagnostic.CA1063.severity = error + +# CA1064: Exceptions should be public +dotnet_diagnostic.CA1064.severity = warning + +# CA1065: Do not raise exceptions in unexpected locations +dotnet_diagnostic.CA1065.severity = warning + +# CA1066: Implement IEquatable when overriding Equals +dotnet_diagnostic.CA1066.severity = warning + +# CA1067: Override Equals when implementing IEquatable +dotnet_diagnostic.CA1067.severity = warning + +# CA1068: CancellationToken parameters must come last +dotnet_diagnostic.CA1068.severity = warning + +# CA1069: Enums should not have duplicate values +dotnet_diagnostic.CA1069.severity = error + +# CA1070: Do not declare event fields as virtual +dotnet_diagnostic.CA1070.severity = warning + +#### Documentation Rules #### + +# CA1200: Avoid using cref tags with a prefix +dotnet_diagnostic.CA1200.severity = suggestion + +#### Globalization Rules #### + +# CA1303: Do not pass literals as localized parameters +dotnet_diagnostic.CA1303.severity = warning + +# CA1304: Specify CultureInfo +dotnet_diagnostic.CA1304.severity = error + +# CA1305: Specify IFormatProvider +dotnet_diagnostic.CA1305.severity = error + +# CA1307: Specify StringComparison for clarity +dotnet_diagnostic.CA1307.severity = error + +# CA1308: Normalize strings to uppercase +dotnet_diagnostic.CA1308.severity = warning + +# CA1309: Use ordinal StringComparison +dotnet_diagnostic.CA1309.severity = warning + +# CA1310: Specify StringComparison for correctness +dotnet_diagnostic.CA1310.severity = warning + +# CA1311: Specify a culture or use an invariant version +dotnet_diagnostic.CA1311.severity = warning + +# CA2101: Specify marshaling for P/Invoke string arguments +dotnet_diagnostic.CA2101.severity = warning + +#### SingleFile Rules #### + +# IL3000: Avoid using accessing Assembly file path when publishing as a single-file +dotnet_diagnostic.IL3000.severity = error + +# IL3001: Avoid using accessing Assembly file path when publishing as a single-file +dotnet_diagnostic.IL3001.severity = error + +# IL3002: Avoid calling members annotated with 'RequiresAssemblyFilesAttribute' when publishing as a single file. +dotnet_diagnostic.IL3002.severity = error + +# IL3003 'RequiresAssemblyFilesAttribute' annotations must match across all interface implementations or overrides. +dotnet_diagnostic.IL3003.severity = error + +#### Miscellaneous Rules #### + +#Remove invalid global 'SuppressMessageAttribute' (IDE0076) +dotnet_diagnostic.IDE0076.severity = suggestion + +#Avoid legacy format target in global 'SuppressMessageAttribute' (IDE0077) +dotnet_diagnostic.IDE0077.severity = suggestion + +#### StyleCop Rules #### + +#A violation of this rule occurs when a compilation (project) contains one or more files which are parsed with the DocumentationMode set to None. This most frequently occurs when the project is configured to not produce an XML documentation file during the build. +dotnet_diagnostic.SA0001.severity = warning + +# The spacing around a C# keyword is incorrect. +dotnet_diagnostic.SA1000.severity = warning + +# DoNotPrefixCallsWithBaseUnlessLocalImplementationExists +dotnet_diagnostic.SA1100.severity = warning + +# CommentsMustContainText +dotnet_diagnostic.SA1120.severity = warning + +# DoNotUseRegions +dotnet_diagnostic.SA1124.severity = warning + +# UsingDirectivesMustBePlacedCorrectly +dotnet_diagnostic.SA1200.severity = warning + +# ElementsMustAppearInTheCorrectOrder +dotnet_diagnostic.SA1201.severity = warning + +# ElementsMustBeOrderedByAccess +dotnet_diagnostic.SA1202.severity = warning + +# ConstantsMustAppearBeforeFields +dotnet_diagnostic.SA1202.severity = warning + +# ElementMustBeginWithUpperCaseLetter +dotnet_diagnostic.SA1300.severity = error + +# InterfaceNamesMustBeginWithI +dotnet_diagnostic.SA1302.severity = error + +# ConstFieldNamesMustBeginWithUpperCaseLetter +dotnet_diagnostic.SA1303.severity = error + +# FieldNamesMustNotUseHungarianNotation +dotnet_diagnostic.SA1305.severity = warning + +# VariableNamesMustNotBePrefixed +dotnet_diagnostic.SA1308.severity = error + +# A field name in C# begins with an underscore. +dotnet_diagnostic.SA1309.severity = warning + +# VariableNamesMustBeginWithLowerCaseLetter +dotnet_diagnostic.SA1312.severity = warning + +# ParameterNamesMustBeginWithLowerCaseLetter +dotnet_diagnostic.SA1313.severity = error + +# TupleElementNamesShouldUseCorrectCasing +dotnet_diagnostic.SA1316.severity = warning + +# A Code Analysis SuppressMessage attribute does not include a justification. +dotnet_diagnostic.SA1404.severity = error + +# BracesForMultiLineStatementsMustNotShareLine +dotnet_diagnostic.SA1500.severity = warning + +# ElementMustNotBeOnSingleLine +dotnet_diagnostic.SA1502.severity = warning + +# BracesMustNotBeOmitted +dotnet_diagnostic.SA1503.severity = warning + +# ClosingBraceMustBeFollowedByBlankLine +dotnet_diagnostic.SA1513.severity = warning + +# UseBracesConsistently +dotnet_diagnostic.SA1520.severity = warning + +# File header copyright text should match +dotnet_diagnostic.SA1636.severity = none + +# ElementDocumentationMustBeSpelledCorrectly +dotnet_diagnostic.SA1650.severity = warning + +# Do not return null +dotnet_diagnostic.RETURN0001.severity = warning + +#### Async Rules #### + +# Asynchronous method names should end with Async +dotnet_diagnostic.ASYNC0001.severity = error + +# Non asynchronous method names should end with Async +dotnet_diagnostic.ASYNC0002.severity = error + +# Avoid void returning asynchronous method +dotnet_diagnostic.ASYNC0003.severity = warning + +# Use ConfigureAwait(false) on await expression +dotnet_diagnostic.ASYNC0004.severity = error + +# Do not use blocking call (make method async) +dotnet_diagnostic.MA0045.severity = none + +# Call 'ConfigureAwait(false)'. +dotnet_diagnostic.RCS1090.severity = error + +# Return completed task instead of returning null +dotnet_diagnostic.RCS1210.severity = error + +# AsyncifyInvocation: Use Task Async +dotnet_diagnostic.AsyncifyInvocation.severity = error + +# AsyncifyVariable: Use Task Async +dotnet_diagnostic.AsyncifyVariable.severity = error + +# Use ConfigureAwait(bool) +dotnet_diagnostic.VSTHRD111.severity = error + +# Avoid returning a null Task +dotnet_diagnostic.VSTHRD114.severity = error + +# Use "Async" suffix for async methods +dotnet_diagnostic.VSTHRD200.severity = error + +# Asynchronous method name should end with 'Async'. +dotnet_diagnostic.RCS1046.severity = error + +# Use "Async" suffix for async methods +dotnet_diagnostic.VSTHRD200.severity = error + +# Non-asynchronous method name should not end with 'Async'. +dotnet_diagnostic.RCS1047.severity = error + +#### Class Rules #### + +# Seal Class +dotnet_diagnostic.CLASS0001.severity = warning + +#### Enum Rules #### + +# Default switch label +dotnet_diagnostic.ENUM0001.severity = error + +# Merge switch sections +dotnet_diagnostic.ENUM0002.severity = warning + +# Populate switch +dotnet_diagnostic.ENUM0003.severity = warning + +tab_width = 4 +dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion +dotnet_style_allow_statement_immediately_after_block_experimental = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion + +# Prefer "var" everywhere (Implicit and explicit types) +csharp_style_var_elsewhere = true:warning +csharp_style_var_for_built_in_types = true:warning +csharp_style_var_when_type_is_apparent = true:warning + +# Modifier preferences +csharp_prefer_static_local_function = true:warning +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning +dotnet_style_readonly_field = true:warning +dotnet_style_require_accessibility_modifiers = always:warning +visual_basic_preferred_modifier_order = Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, Async:warning + +# Code-block preferences +csharp_prefer_braces = true:suggestion +csharp_prefer_simple_using_statement = false:silent + +# C# Style Rules +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules +[*.{cs,csx,cake}] + +# Newline options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#new-line-options +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# C# Unnecessary code rules +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion + +# Simplify name +dotnet_diagnostic.IDE0001.severity = warning + +# Simplify member access +dotnet_diagnostic.IDE0002.severity = silent + +# Remove unnecessary cast +dotnet_diagnostic.IDE0004.severity = warning + +# Remove unnecessary import +dotnet_diagnostic.IDE0005.severity = warning + +#Remove unreachable code +dotnet_diagnostic.IDE0035.severity = warning + +#Remove unused private member +dotnet_diagnostic.IDE0051.severity = suggestion + +#Remove unread private member +dotnet_diagnostic.IDE0052.severity = error + +# Remove unnecessary expression value +dotnet_diagnostic.IDE0058.severity = warning + +# Remove unnecessary value assignment +dotnet_diagnostic.IDE0059.severity = error + +# Remove unused parameter +dotnet_diagnostic.IDE0060.severity = error + +# Remove unnecessary suppression +dotnet_diagnostic.IDE0079.severity = error + +# Remove unnecessary suppression operator +dotnet_diagnostic.IDE0080.severity = suggestion + +# Remove ByVal +dotnet_diagnostic.IDE0081.severity = warning + +# Remove unnecessary equality operator +dotnet_diagnostic.IDE0100.severity = warning + +# Use conditional delegate call +dotnet_diagnostic.IDE0105.severity = warning + +# Remove unnecessary discard +dotnet_diagnostic.IDE0110.severity = suggestion + +# Simplify object creation +dotnet_diagnostic.IDE0140.severity = suggestion + +# Prefer 'null' check over type check +dotnet_diagnostic.IDE0150.severity = suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:warning +csharp_style_deconstructed_variable_declaration = true:warning +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning +csharp_style_inlined_variable_declaration = true:warning +csharp_style_pattern_local_over_anonymous_function = true:warning +csharp_style_prefer_index_operator = true:warning +csharp_style_prefer_range_operator = true:warning + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:warning + +# Expression-Bodied members +csharp_style_expression_bodied_accessors = true:warning +csharp_style_expression_bodied_constructors = true:warning +csharp_style_expression_bodied_indexers = true:warning +csharp_style_expression_bodied_lambdas = true:warning +csharp_style_expression_bodied_local_functions = true:warning +csharp_style_expression_bodied_methods = true:warning +csharp_style_expression_bodied_operators = true:warning +csharp_style_expression_bodied_properties = true:warning + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:warning +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_prefer_not_pattern = true:warning +csharp_style_prefer_pattern_matching = true:warning +csharp_style_prefer_switch_expression = true:warning + +# "Null" checking preferences +csharp_style_conditional_delegate_call = true:warning +csharp_style_throw_expression = true:warning + +# Spacing options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#spacing-options +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrap options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#wrap-options +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = false + +#Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Namespace options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#namespace-options +csharp_style_namespace_declarations = file_scoped:warning + +#Wrapping preferences +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent +csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_null_check_over_type_check = true:warning +csharp_style_prefer_parameter_null_checking = true:suggestion +csharp_style_prefer_top_level_statements = true:silent +csharp_style_prefer_tuple_swap = true:suggestion + +# Simplify boolean comparison. +dotnet_diagnostic.RCS1049.severity = silent + +dotnet_diagnostic.CS9035.severity = none #this should be warning or error + +# [src/{VisualStudio}/**/*.{cs,vb}] +visual_basic_style_prefer_simplified_object_creation = all : suggestion + +[*.g.cs] +# Missing XML comment for publicly visible type or member 'Type_or_Member' +dotnet_diagnostic.CS1591.severity = none \ No newline at end of file diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 7def812..87122c0 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,164 +1,164 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", - "definitions": { - "build": { - "type": "object", - "properties": { - "configuration": { - "type": "string", - "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)" - }, - "containerDefaultRID": { - "type": "string", - "description": "GitLab Project Full Address" - }, - "containerRegistryImage": { - "type": "string", - "description": "GitLab Project CI_REGISTRY_IMAGE" - }, - "Continue": { - "type": "boolean", - "description": "Indicates to continue a previously failed build attempt" - }, - "gitlabPrivateToken": { - "type": "string", - "description": "GitLab private token" - }, - "Help": { - "type": "boolean", - "description": "Shows the help text for this build assembly" - }, - "Host": { - "type": "string", - "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] - }, - "isScheduled": { - "type": "boolean", - "description": "If the pipeline was triggered by a schedule (or manually)" - }, - "NoLogo": { - "type": "boolean", - "description": "Disables displaying the NUKE logo" - }, - "packageName": { - "type": "string", - "description": "package-name (default: SuCoS)" - }, - "Partition": { - "type": "string", - "description": "Partition to use on CI" - }, - "Plan": { - "type": "boolean", - "description": "Shows the execution plan (HTML)" - }, - "Profile": { - "type": "array", - "description": "Defines the profiles to load", - "items": { - "type": "string" - } - }, - "publishDirectory": { - "type": "string", - "description": "publish-directory (default: ./publish/{runtimeIdentifier})" - }, - "publishSelfContained": { - "type": "boolean", - "description": "publish-self-contained (default: true)" - }, - "publishSingleFile": { - "type": "boolean", - "description": "publish-single-file (default: true)" - }, - "publishTrimmed": { - "type": "boolean", - "description": "publish-trimmed (default: false)" - }, - "Root": { - "type": "string", - "description": "Root directory during build execution" - }, - "runtimeIdentifier": { - "type": "string", - "description": "Runtime identifier for the build (e.g., win-x64, linux-x64, osx-x64) (default: linux-x64)" - }, - "Skip": { - "type": "array", - "description": "List of targets to be skipped. Empty list skips all dependencies", - "items": { - "type": "string", - "enum": [ - "CheckNewCommits", - "Clean", - "Compile", - "CreateContainer", - "CreatePackage", - "GitLabCreateRelease", - "GitLabCreateTag", - "Publish", - "Restore", - "ShowCurrentVersion", - "Test", - "TestReport" - ] - } - }, - "solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, - "Target": { - "type": "array", - "description": "List of targets to be invoked. Default is '{default_target}'", - "items": { - "type": "string", - "enum": [ - "CheckNewCommits", - "Clean", - "Compile", - "CreateContainer", - "CreatePackage", - "GitLabCreateRelease", - "GitLabCreateTag", - "Publish", - "Restore", - "ShowCurrentVersion", - "Test", - "TestReport" - ] - } - }, - "Verbosity": { - "type": "string", - "description": "Logging verbosity during build execution. Default is 'Normal'", - "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" - ] - } - } - } - } -} +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/build", + "title": "Build Schema", + "definitions": { + "build": { + "type": "object", + "properties": { + "configuration": { + "type": "string", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)" + }, + "containerDefaultRID": { + "type": "string", + "description": "GitLab Project Full Address" + }, + "containerRegistryImage": { + "type": "string", + "description": "GitLab Project CI_REGISTRY_IMAGE" + }, + "Continue": { + "type": "boolean", + "description": "Indicates to continue a previously failed build attempt" + }, + "gitlabPrivateToken": { + "type": "string", + "description": "GitLab private token" + }, + "Help": { + "type": "boolean", + "description": "Shows the help text for this build assembly" + }, + "Host": { + "type": "string", + "description": "Host for execution. Default is 'automatic'", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "isScheduled": { + "type": "boolean", + "description": "If the pipeline was triggered by a schedule (or manually)" + }, + "NoLogo": { + "type": "boolean", + "description": "Disables displaying the NUKE logo" + }, + "packageName": { + "type": "string", + "description": "package-name (default: SuCoS)" + }, + "Partition": { + "type": "string", + "description": "Partition to use on CI" + }, + "Plan": { + "type": "boolean", + "description": "Shows the execution plan (HTML)" + }, + "Profile": { + "type": "array", + "description": "Defines the profiles to load", + "items": { + "type": "string" + } + }, + "publishDirectory": { + "type": "string", + "description": "publish-directory (default: ./publish/{runtimeIdentifier})" + }, + "publishSelfContained": { + "type": "boolean", + "description": "publish-self-contained (default: true)" + }, + "publishSingleFile": { + "type": "boolean", + "description": "publish-single-file (default: true)" + }, + "publishTrimmed": { + "type": "boolean", + "description": "publish-trimmed (default: false)" + }, + "Root": { + "type": "string", + "description": "Root directory during build execution" + }, + "runtimeIdentifier": { + "type": "string", + "description": "Runtime identifier for the build (e.g., win-x64, linux-x64, osx-x64) (default: linux-x64)" + }, + "Skip": { + "type": "array", + "description": "List of targets to be skipped. Empty list skips all dependencies", + "items": { + "type": "string", + "enum": [ + "CheckNewCommits", + "Clean", + "Compile", + "CreateContainer", + "CreatePackage", + "GitLabCreateRelease", + "GitLabCreateTag", + "Publish", + "Restore", + "ShowCurrentVersion", + "Test", + "TestReport" + ] + } + }, + "solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" + }, + "Target": { + "type": "array", + "description": "List of targets to be invoked. Default is '{default_target}'", + "items": { + "type": "string", + "enum": [ + "CheckNewCommits", + "Clean", + "Compile", + "CreateContainer", + "CreatePackage", + "GitLabCreateRelease", + "GitLabCreateTag", + "Publish", + "Restore", + "ShowCurrentVersion", + "Test", + "TestReport" + ] + } + }, + "Verbosity": { + "type": "string", + "description": "Logging verbosity during build execution. Default is 'Normal'", + "enum": [ + "Minimal", + "Normal", + "Quiet", + "Verbose" + ] + } + } + } + } +} diff --git a/source/Helpers/SourceFileWatcher.cs b/source/Helpers/SourceFileWatcher.cs index b857e4c..61b0375 100644 --- a/source/Helpers/SourceFileWatcher.cs +++ b/source/Helpers/SourceFileWatcher.cs @@ -3,7 +3,7 @@ namespace SuCoS.Helpers; /// /// The FileSystemWatcher object that monitors the source directory for file changes. /// -public class SourceFileWatcher : IFileWatcher +public sealed class SourceFileWatcher : IFileWatcher, IDisposable { /// /// The FileSystemWatcher object that monitors the source directory for file changes. @@ -41,4 +41,19 @@ public class SourceFileWatcher : IFileWatcher { fileWatcher?.Dispose(); } + + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + void Dispose(bool disposing) + { + if (disposing) + { + fileWatcher?.Dispose(); + } + } } diff --git a/source/Models/IPage.cs b/source/Models/IPage.cs index db7083a..83b7e0e 100644 --- a/source/Models/IPage.cs +++ b/source/Models/IPage.cs @@ -28,7 +28,7 @@ public interface IPage : IFrontMatter, IOutput /// /// Secondary URL patterns to be used to create the url. /// - public Collection? AliasesProcessed { get; set; } + public Collection? AliasesProcessed { get; } /// /// Other content that mention this content. @@ -50,7 +50,7 @@ public interface IPage : IFrontMatter, IOutput /// /// Page resources. All files that accompany a page. /// - public Collection? Resources { get; set; } + public Collection? Resources { get; } /// /// Plain markdown content, without HTML. @@ -82,7 +82,7 @@ public interface IPage : IFrontMatter, IOutput /// public int WordCount => Plain.Split(nonWords, StringSplitOptions.RemoveEmptyEntries).Length; - private static readonly char[] nonWords = { ' ', ',', ';', '.', '!', '"', '(', ')', '?', '\n', '\r' }; + private static readonly char[] nonWords = [' ', ',', ';', '.', '!', '"', '(', ')', '?', '\n', '\r']; /// /// The markdown content converted to HTML diff --git a/source/Models/Page.cs b/source/Models/Page.cs index 1e2a859..d64dd5c 100644 --- a/source/Models/Page.cs +++ b/source/Models/Page.cs @@ -154,7 +154,7 @@ public class Page : IPage /// public int WordCount => Plain.Split(nonWords, StringSplitOptions.RemoveEmptyEntries).Length; - private static readonly char[] nonWords = { ' ', ',', ';', '.', '!', '"', '(', ')', '?', '\n', '\r' }; + private static readonly char[] nonWords = [' ', ',', ';', '.', '!', '"', '(', ')', '?', '\n', '\r']; /// /// The markdown content converted to HTML diff --git a/source/Models/Site.cs b/source/Models/Site.cs index f88e1e5..0de88c9 100644 --- a/source/Models/Site.cs +++ b/source/Models/Site.cs @@ -343,7 +343,7 @@ public class Site : ISite } } - private IPage? ParseSourceFile(in string filePath, in IPage? parent, BundleType bundleType = BundleType.none) + private Page? ParseSourceFile(in string filePath, in IPage? parent, BundleType bundleType = BundleType.none) { Page? page = null; try diff --git a/source/Parser/YAMLParser.cs b/source/Parser/YAMLParser.cs index 72e9133..288acb1 100644 --- a/source/Parser/YAMLParser.cs +++ b/source/Parser/YAMLParser.cs @@ -75,7 +75,7 @@ public class YAMLParser : IFrontMatterParser return page; } - private IFrontMatter ParseYAML(in string fileFullPath, in string fileRelativePath, string yaml, in string rawContent) + private FrontMatter ParseYAML(in string fileFullPath, in string fileRelativePath, string yaml, in string rawContent) { var frontMatter = yamlDeserializerRigid.Deserialize(new StringReader(yaml)) ?? throw new FormatException("Error parsing front matter"); var section = SiteHelper.GetSection(fileRelativePath); diff --git a/source/Program.cs b/source/Program.cs index 26f78ee..231a56f 100644 --- a/source/Program.cs +++ b/source/Program.cs @@ -26,12 +26,12 @@ public class Program "; private ILogger logger; - private static readonly string[] aliases = new[] { "--source", "-s" }; - private static readonly string[] aliasesArray = new[] { "--draft", "-d" }; - private static readonly string[] aliasesArray0 = new[] { "--future", "-f" }; - private static readonly string[] aliasesArray1 = new[] { "--expired", "-e" }; - private static readonly string[] aliasesArray2 = new[] { "--verbose", "-v" }; - private static readonly string[] aliasesArray3 = new[] { "--output", "-o" }; + private static readonly string[] aliases = ["--source", "-s"]; + private static readonly string[] aliasesArray = ["--draft", "-d"]; + private static readonly string[] aliasesArray0 = ["--future", "-f"]; + private static readonly string[] aliasesArray1 = ["--expired", "-e"]; + private static readonly string[] aliasesArray2 = ["--verbose", "-v"]; + private static readonly string[] aliasesArray3 = ["--output", "-o"]; /// /// Entry point of the program diff --git a/source/ServeCommand.cs b/source/ServeCommand.cs index 50a3220..5a0c0d8 100644 --- a/source/ServeCommand.cs +++ b/source/ServeCommand.cs @@ -9,7 +9,7 @@ namespace SuCoS; /// /// Serve Command will live serve the site and watch any changes. /// -public class ServeCommand : BaseGeneratorCommand, IDisposable +public sealed class ServeCommand : BaseGeneratorCommand, IDisposable { private const string baseURLDefault = "http://localhost"; private const int portDefault = 1122; @@ -86,13 +86,13 @@ public class ServeCommand : BaseGeneratorCommand, IDisposable serverStartTime = DateTime.UtcNow; - handlers = new IServerHandlers[]{ + handlers = [ new PingRequests(), new StaticFileRequest(site.SourceStaticPath, false), new StaticFileRequest(site.SourceThemeStaticPath, true), new RegisteredPageRequest(site), new RegisteredPageResourceRequest(site) - }; + ]; listener = new HttpListener(); listener.Prefixes.Add($"{baseURL}:{port}/"); listener.Start(); diff --git a/source/ServerHandlers/RegisteredPageResourceRequest.cs b/source/ServerHandlers/RegisteredPageResourceRequest.cs index 0633c5f..88f8e4d 100644 --- a/source/ServerHandlers/RegisteredPageResourceRequest.cs +++ b/source/ServerHandlers/RegisteredPageResourceRequest.cs @@ -41,7 +41,7 @@ public class RegisteredPageResourceRequest : IServerHandlers { response.ContentType = resource.MimeType; await using var fileStream = new FileStream(resource.SourceFullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - await fileStream.CopyToAsync(response.OutputStream); + await fileStream.CopyToAsync(response.OutputStream).ConfigureAwait(false); return "resource"; } else diff --git a/source/ServerHandlers/StaticFileRequest.cs b/source/ServerHandlers/StaticFileRequest.cs index d3f3640..1b96211 100644 --- a/source/ServerHandlers/StaticFileRequest.cs +++ b/source/ServerHandlers/StaticFileRequest.cs @@ -48,7 +48,7 @@ public class StaticFileRequest : IServerHandlers response.ContentType = GetContentType(fileAbsolutePath!); await using var fileStream = new FileStream(fileAbsolutePath!, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); response.ContentLength64 = fileStream.Length; - await fileStream.CopyToAsync(response.OutputStream); + await fileStream.CopyToAsync(response.OutputStream).ConfigureAwait(false); return inTheme ? "themeSt" : "static"; } -- GitLab From 48e59e529d12f03791bf2725c24fe7dc6de89352 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Fri, 8 Mar 2024 12:44:36 -0500 Subject: [PATCH 07/10] chore: usee ArgumentNullException.ThrowIfNull for readability --- source/BaseGeneratorCommand.cs | 15 ++-------- source/Helpers/FileUtils.cs | 20 +++---------- source/Helpers/SiteHelper.cs | 15 ++-------- source/Helpers/SourceFileWatcher.cs | 5 +--- source/Models/Site.cs | 29 ++++++------------- source/Parser/YAMLParser.cs | 20 +++---------- source/ServerHandlers/PingRequests.cs | 6 ++-- .../ServerHandlers/RegisteredPageRequest.cs | 12 +++----- .../RegisteredPageResourceRequest.cs | 11 ++----- source/ServerHandlers/StaticFileRequest.cs | 16 +++------- 10 files changed, 37 insertions(+), 112 deletions(-) diff --git a/source/BaseGeneratorCommand.cs b/source/BaseGeneratorCommand.cs index 408f555..20579c7 100644 --- a/source/BaseGeneratorCommand.cs +++ b/source/BaseGeneratorCommand.cs @@ -45,10 +45,7 @@ public abstract class BaseGeneratorCommand /// The logger instance. Injectable for testing protected BaseGeneratorCommand(IGenerateOptions options, ILogger logger) { - if (options is null) - { - throw new ArgumentNullException(nameof(options)); - } + ArgumentNullException.ThrowIfNull(options); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); stopwatch = new(logger); @@ -68,14 +65,8 @@ public abstract class BaseGeneratorCommand /// protected static ValueTask WhereParamsFilter(FluidValue input, FilterArguments arguments, TemplateContext context) { - if (input is null) - { - throw new ArgumentNullException(nameof(input)); - } - if (arguments is null) - { - throw new ArgumentNullException(nameof(arguments)); - } + ArgumentNullException.ThrowIfNull(input); + ArgumentNullException.ThrowIfNull(arguments); List result = new(); var list = (input as ArrayValue)!.Values; diff --git a/source/Helpers/FileUtils.cs b/source/Helpers/FileUtils.cs index 5125bb8..0afcb81 100644 --- a/source/Helpers/FileUtils.cs +++ b/source/Helpers/FileUtils.cs @@ -17,14 +17,8 @@ public static class FileUtils /// The content of the template file. public static string GetTemplate(string themePath, Page page, SiteCacheManager cacheManager, bool isBaseTemplate = false) { - if (page is null) - { - throw new ArgumentNullException(nameof(page)); - } - if (cacheManager is null) - { - throw new ArgumentNullException(nameof(cacheManager)); - } + ArgumentNullException.ThrowIfNull(page); + ArgumentNullException.ThrowIfNull(cacheManager); var index = (page.Section, page.Kind, page.Type); @@ -53,10 +47,7 @@ public static class FileUtils /// The content of the template file, or an empty string if not found. private static string GetTemplate(List templatePaths) { - if (templatePaths is null) - { - throw new ArgumentNullException(nameof(templatePaths)); - } + ArgumentNullException.ThrowIfNull(templatePaths); // Iterate through the template paths and return the content of the first existing file foreach (var templatePath in templatePaths.Where(File.Exists)) @@ -76,10 +67,7 @@ public static class FileUtils /// The list of template paths in the lookup order. private static List GetTemplateLookupOrder(string themePath, Page page, bool isBaseTemplate) { - if (page is null) - { - throw new ArgumentNullException(nameof(page)); - } + ArgumentNullException.ThrowIfNull(page); // Generate the lookup order for template files based on the theme path, page section, type, and kind var sections = page.Section is not null ? new[] { page.Section, string.Empty } : new[] { string.Empty }; diff --git a/source/Helpers/SiteHelper.cs b/source/Helpers/SiteHelper.cs index ed9996b..64d2d10 100644 --- a/source/Helpers/SiteHelper.cs +++ b/source/Helpers/SiteHelper.cs @@ -27,10 +27,7 @@ public static class SiteHelper /// public static Site Init(string configFile, IGenerateOptions options, IFrontMatterParser frontMatterParser, FilterDelegate whereParamsFilter, ILogger logger, StopwatchReporter stopwatch) { - if (stopwatch is null) - { - throw new ArgumentNullException(nameof(stopwatch)); - } + ArgumentNullException.ThrowIfNull(stopwatch); SiteSettings siteSettings; try @@ -97,14 +94,8 @@ public static class SiteHelper /// The site settings. private static SiteSettings ParseSettings(string configFile, IGenerateOptions options, IFrontMatterParser frontMatterParser) { - if (options is null) - { - throw new ArgumentNullException(nameof(options)); - } - if (frontMatterParser is null) - { - throw new ArgumentNullException(nameof(frontMatterParser)); - } + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(frontMatterParser); try { diff --git a/source/Helpers/SourceFileWatcher.cs b/source/Helpers/SourceFileWatcher.cs index 61b0375..4da2e2d 100644 --- a/source/Helpers/SourceFileWatcher.cs +++ b/source/Helpers/SourceFileWatcher.cs @@ -16,10 +16,7 @@ public sealed class SourceFileWatcher : IFileWatcher, IDisposable /// public void Start(string SourceAbsolutePath, Action OnSourceFileChanged) { - if (OnSourceFileChanged is null) - { - throw new ArgumentNullException(nameof(OnSourceFileChanged)); - } + ArgumentNullException.ThrowIfNull(OnSourceFileChanged); fileWatcher = new FileSystemWatcher { diff --git a/source/Models/Site.cs b/source/Models/Site.cs index 0de88c9..4b56ce3 100644 --- a/source/Models/Site.cs +++ b/source/Models/Site.cs @@ -379,10 +379,7 @@ public class Site : ISite /// public void PostProcessPage(in IPage page, IPage? parent = null, bool overwrite = false) { - if (page is null) - { - throw new ArgumentNullException(nameof(page)); - } + ArgumentNullException.ThrowIfNull(page); page.Parent = parent; page.Permalink = page.CreatePermalink(); @@ -422,10 +419,8 @@ public class Site : ISite /// public bool IsValidPage(in IFrontMatter frontMatter, IGenerateOptions? options) { - if (frontMatter is null) - { - throw new ArgumentNullException(nameof(frontMatter)); - } + ArgumentNullException.ThrowIfNull(frontMatter); + return IsValidDate(frontMatter, options) && (frontMatter.Draft is null || frontMatter.Draft == false || (options?.Draft ?? false)); } @@ -433,10 +428,8 @@ public class Site : ISite /// public bool IsValidDate(in IFrontMatter frontMatter, IGenerateOptions? options) { - if (frontMatter is null) - { - throw new ArgumentNullException(nameof(frontMatter)); - } + ArgumentNullException.ThrowIfNull(frontMatter); + return (!IsDateExpired(frontMatter) || (options?.Expired ?? false)) && (IsDatePublishable(frontMatter) || (options?.Future ?? false)); } @@ -446,10 +439,8 @@ public class Site : ISite /// public bool IsDateExpired(in IFrontMatter frontMatter) { - if (frontMatter is null) - { - throw new ArgumentNullException(nameof(frontMatter)); - } + ArgumentNullException.ThrowIfNull(frontMatter); + return frontMatter.ExpiryDate is not null && frontMatter.ExpiryDate <= clock.Now; } @@ -458,10 +449,8 @@ public class Site : ISite /// public bool IsDatePublishable(in IFrontMatter frontMatter) { - if (frontMatter is null) - { - throw new ArgumentNullException(nameof(frontMatter)); - } + ArgumentNullException.ThrowIfNull(frontMatter); + return frontMatter.GetPublishDate is null || frontMatter.GetPublishDate <= clock.Now; } } \ No newline at end of file diff --git a/source/Parser/YAMLParser.cs b/source/Parser/YAMLParser.cs index 288acb1..f9b85d2 100644 --- a/source/Parser/YAMLParser.cs +++ b/source/Parser/YAMLParser.cs @@ -27,10 +27,7 @@ public class YAMLParser : IFrontMatterParser /// public IFrontMatter ParseFrontmatterAndMarkdownFromFile(in string fileFullPath, in string? sourceContentPath = null) { - if (fileFullPath is null) - { - throw new ArgumentNullException(nameof(fileFullPath)); - } + ArgumentNullException.ThrowIfNull(fileFullPath); string? fileContent; string? fileRelativePath; @@ -50,10 +47,7 @@ public class YAMLParser : IFrontMatterParser /// public IFrontMatter ParseFrontmatterAndMarkdown(in string fileFullPath, in string fileRelativePath, in string fileContent) { - if (fileRelativePath is null) - { - throw new ArgumentNullException(nameof(fileRelativePath)); - } + ArgumentNullException.ThrowIfNull(fileRelativePath); using var content = new StringReader(fileContent); var frontMatterBuilder = new StringBuilder(); @@ -112,14 +106,8 @@ public class YAMLParser : IFrontMatterParser /// yamlObject already parsed if available public void ParseParams(IParams settings, Type type, string yaml, object? yamlObject = null) { - if (settings is null) - { - throw new ArgumentNullException(nameof(settings)); - } - if (type is null) - { - throw new ArgumentNullException(nameof(type)); - } + ArgumentNullException.ThrowIfNull(settings); + ArgumentNullException.ThrowIfNull(type); yamlObject ??= yamlDeserializer.Deserialize(new StringReader(yaml)); if (yamlObject is not Dictionary yamlDictionary) diff --git a/source/ServerHandlers/PingRequests.cs b/source/ServerHandlers/PingRequests.cs index 02d4a43..3d2f571 100644 --- a/source/ServerHandlers/PingRequests.cs +++ b/source/ServerHandlers/PingRequests.cs @@ -14,10 +14,8 @@ public class PingRequests : IServerHandlers /// public async Task Handle(IHttpListenerResponse response, string requestPath, DateTime serverStartTime) { - if (response is null) - { - throw new ArgumentNullException(nameof(response)); - } + ArgumentNullException.ThrowIfNull(response); + var content = serverStartTime.ToString("o"); using var writer = new StreamWriter(response.OutputStream, leaveOpen: true); diff --git a/source/ServerHandlers/RegisteredPageRequest.cs b/source/ServerHandlers/RegisteredPageRequest.cs index 385cb1a..7c285aa 100644 --- a/source/ServerHandlers/RegisteredPageRequest.cs +++ b/source/ServerHandlers/RegisteredPageRequest.cs @@ -22,20 +22,16 @@ public class RegisteredPageRequest : IServerHandlers /// public bool Check(string requestPath) { - if (requestPath is null) - { - throw new ArgumentNullException(nameof(requestPath)); - } + ArgumentNullException.ThrowIfNull(requestPath); + return site.OutputReferences.TryGetValue(requestPath, out var item) && item is IPage _; } /// public async Task Handle(IHttpListenerResponse response, string requestPath, DateTime serverStartTime) { - if (response is null) - { - throw new ArgumentNullException(nameof(response)); - } + ArgumentNullException.ThrowIfNull(response); + if (site.OutputReferences.TryGetValue(requestPath, out var output) && output is IPage page) { var content = page.CompleteContent; diff --git a/source/ServerHandlers/RegisteredPageResourceRequest.cs b/source/ServerHandlers/RegisteredPageResourceRequest.cs index 88f8e4d..6ecd748 100644 --- a/source/ServerHandlers/RegisteredPageResourceRequest.cs +++ b/source/ServerHandlers/RegisteredPageResourceRequest.cs @@ -22,20 +22,15 @@ public class RegisteredPageResourceRequest : IServerHandlers /// public bool Check(string requestPath) { - if (requestPath is null) - { - throw new ArgumentNullException(nameof(requestPath)); - } + ArgumentNullException.ThrowIfNull(requestPath); + return site.OutputReferences.TryGetValue(requestPath, out var item) && item is IResource _; } /// public async Task Handle(IHttpListenerResponse response, string requestPath, DateTime serverStartTime) { - if (response is null) - { - throw new ArgumentNullException(nameof(response)); - } + ArgumentNullException.ThrowIfNull(response); if (site.OutputReferences.TryGetValue(requestPath, out var output) && output is IResource resource) { diff --git a/source/ServerHandlers/StaticFileRequest.cs b/source/ServerHandlers/StaticFileRequest.cs index 1b96211..1ca0203 100644 --- a/source/ServerHandlers/StaticFileRequest.cs +++ b/source/ServerHandlers/StaticFileRequest.cs @@ -24,10 +24,8 @@ public class StaticFileRequest : IServerHandlers /// public bool Check(string requestPath) { - if (requestPath is null) - { - throw new ArgumentNullException(nameof(requestPath)); - } + ArgumentNullException.ThrowIfNull(requestPath); + var fileAbsolutePath = Path.Combine(basePath, requestPath.TrimStart('/')); return File.Exists(fileAbsolutePath); } @@ -35,14 +33,8 @@ public class StaticFileRequest : IServerHandlers /// public async Task Handle(IHttpListenerResponse response, string requestPath, DateTime serverStartTime) { - if (requestPath is null) - { - throw new ArgumentNullException(nameof(requestPath)); - } - if (response is null) - { - throw new ArgumentNullException(nameof(response)); - } + ArgumentNullException.ThrowIfNull(requestPath); + ArgumentNullException.ThrowIfNull(response); var fileAbsolutePath = Path.Combine(basePath, requestPath.TrimStart('/')); response.ContentType = GetContentType(fileAbsolutePath!); -- GitLab From ff4af21379223633e79fac25d8d0714e81df9d9b Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Fri, 8 Mar 2024 13:19:34 -0500 Subject: [PATCH 08/10] fix: copying resources need to check if the folder exists --- source/BuildCommand.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/BuildCommand.cs b/source/BuildCommand.cs index 46f9bdc..c4bda47 100644 --- a/source/BuildCommand.cs +++ b/source/BuildCommand.cs @@ -54,10 +54,7 @@ public class BuildCommand : BaseGeneratorCommand var outputAbsolutePath = Path.Combine(options.Output, path); var outputDirectory = Path.GetDirectoryName(outputAbsolutePath); - if (!Directory.Exists(outputDirectory)) - { - _ = Directory.CreateDirectory(outputDirectory!); - } + _ = Directory.CreateDirectory(outputDirectory!); // Save the processed output to the final file var result = page.CompleteContent; @@ -73,6 +70,9 @@ public class BuildCommand : BaseGeneratorCommand { var outputAbsolutePath = Path.Combine(options.Output, resource.Permalink!.TrimStart('/')); + var outputDirectory = Path.GetDirectoryName(outputAbsolutePath); + _ = Directory.CreateDirectory(outputDirectory!); + // Copy the file to the output folder File.Copy(resource.SourceFullPath, outputAbsolutePath, overwrite: true); } -- GitLab From b3ae5d9328a4ed805654183292b067d4421e3861 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Fri, 8 Mar 2024 13:45:52 -0500 Subject: [PATCH 09/10] chore: make InjectReloadScript static --- source/ServerHandlers/RegisteredPageResourceRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ServerHandlers/RegisteredPageResourceRequest.cs b/source/ServerHandlers/RegisteredPageResourceRequest.cs index 6ecd748..4d117e3 100644 --- a/source/ServerHandlers/RegisteredPageResourceRequest.cs +++ b/source/ServerHandlers/RegisteredPageResourceRequest.cs @@ -51,7 +51,7 @@ public class RegisteredPageResourceRequest : IServerHandlers /// /// The content to inject the reload script into. /// The content with the reload script injected. - private string InjectReloadScript(string content) + private static string InjectReloadScript(string content) { // Read the content of the JavaScript file string scriptContent; -- GitLab From 17df55ea441e2b48bea23b856995dfed7014efb9 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Fri, 8 Mar 2024 13:46:32 -0500 Subject: [PATCH 10/10] fix: revert .editorconfig --- .editorconfig | 2340 ------------------------------------------------- 1 file changed, 2340 deletions(-) diff --git a/.editorconfig b/.editorconfig index 0407ca1..ad36a90 100644 --- a/.editorconfig +++ b/.editorconfig @@ -68,2343 +68,3 @@ dotnet_diagnostic.CS8019.severity = warning [**/obj/**/*.cs] dotnet_diagnostic.CS8019.severity = none # disable on debug genereated files -# dotNetDave's (David McCarter) Editor Config - dotNetTips.com -# Updates to this file are posted quarterly at: https://bit.ly/EditorConfig5 -# Updated August 2023 -# dotNetDave's books available at: http://bit.ly/RockYourCodeBooks -# Rockin' the Code World with dotNetDave (weekly live show): https://www.c-sharpcorner.com/live/rockin-the-code-world-with-dotnetdave - -root = true - -# All Files -[*] -charset = utf-8 -csharp_indent_labels = one_less_than_current -csharp_prefer_braces = true:suggestion -csharp_prefer_simple_default_expression = true:warning -csharp_prefer_simple_using_statement = false:silent -csharp_prefer_static_local_function = true:warning -csharp_space_around_binary_operators = before_and_after -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent -csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent -csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent -csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent -csharp_style_conditional_delegate_call = true:warning -csharp_style_deconstructed_variable_declaration = true:warning -csharp_style_expression_bodied_accessors = true:warning -csharp_style_expression_bodied_constructors = true:warning -csharp_style_expression_bodied_indexers = true:warning -csharp_style_expression_bodied_lambdas = true:warning -csharp_style_expression_bodied_local_functions = true:warning -csharp_style_expression_bodied_methods = true:warning -csharp_style_expression_bodied_operators = true:warning -csharp_style_expression_bodied_properties = true:warning -csharp_style_implicit_object_creation_when_type_is_apparent = true:warning -csharp_style_inlined_variable_declaration = true:warning -csharp_style_namespace_declarations = file_scoped:warning -csharp_style_pattern_matching_over_as_with_null_check = true:warning -csharp_style_pattern_matching_over_is_with_cast_check = true:warning -csharp_style_prefer_extended_property_pattern = true:suggestion -csharp_style_prefer_index_operator = true:warning -csharp_style_prefer_local_over_anonymous_function = true:suggestion -csharp_style_prefer_method_group_conversion = true:silent -csharp_style_prefer_not_pattern = true:warning -csharp_style_prefer_null_check_over_type_check = true:warning -csharp_style_prefer_pattern_matching = true:warning -csharp_style_prefer_range_operator = true:warning -csharp_style_prefer_readonly_struct = true:suggestion -csharp_style_prefer_switch_expression = true:warning -csharp_style_prefer_top_level_statements = true:silent -csharp_style_prefer_tuple_swap = true:suggestion -csharp_style_prefer_utf8_string_literals = true:suggestion -csharp_style_throw_expression = true:warning -csharp_style_unused_value_assignment_preference = discard_variable:suggestion -csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion -csharp_style_var_elsewhere = true:warning -csharp_style_var_for_built_in_types = true:warning -csharp_style_var_when_type_is_apparent = true:warning -csharp_using_directive_placement = outside_namespace:warning -end_of_line = crlf -indent_size = 4 -indent_style = tab -insert_final_newline = true - -# Visual Studio Solution Files -[*.sln] -indent_style = tab - -# Visual Studio XML Project Files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 - -# XML Configuration Files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,xml,stylecop}] -indent_size = 2 - -# JSON Files -[*.{json,json5,webmanifest}] -indent_size = 2 - -# YAML Files -[*.{yml,yaml}] -indent_size = 2 - -# Markdown Files -[*.{md,mdx}] -trim_trailing_whitespace = false - -# Bash Files -[*.sh] -end_of_line = lf - -# Batch Files -[*.{cmd,bat}] -end_of_line = crlf - -# Web Files -[*.{htm,html,js,jsm,ts,tsx,cjs,cts,ctsx,mjs,mts,mtsx,css,sass,scss,less,pcss,svg,vue}] -indent_size = 2 -insert_final_newline = true - -# Makefiles -[Makefile] -indent_style = tab - -########################################## -# Default .NET Code Style Severities -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/configuration-options#scope -########################################## - -########################################## -# Language Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules -########################################## - -# .NET Style Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules -[*.{cs,csx,cake,vb,vbx}] - -# CA1014: Mark assemblies with CLSCompliantAttribute -dotnet_diagnostic.CA1014.severity = none - -# Non-private static fields are PascalCase -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = warning -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields - -dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected -dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field -dotnet_naming_symbols.non_private_static_fields.required_modifiers = static - -dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case - -#Constants are PascalCase -dotnet_naming_rule.constants_should_be_pascal_case.severity = warning -dotnet_naming_rule.constants_should_be_pascal_case.style = non_private_static_field_style -dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants - -dotnet_naming_symbols.constants.required_modifiers = const -dotnet_naming_symbols.constants.applicable_kinds = field, local - -dotnet_naming_style.constant_style.capitalization = pascal_case - -#Locals and parameters are camelCase -dotnet_naming_rule.locals_should_be_camel_case.severity = warning -dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style -dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters - -# camel_case_style - Define the camelCase style -dotnet_naming_style.camel_case_style.capitalization = camel_case -dotnet_naming_style.static_field_style.required_prefix = s_ -dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local -dotnet_naming_symbols.static_fields.required_modifiers = static - -# first_upper_style - The first character must start with an upper-case character -dotnet_naming_style.first_upper_style.capitalization = first_word_upper - -# prefix_interface_with_i_style - Interfaces must be PascalCase and the first character of an interface must be an 'I' -dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case -dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I - -# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and the first character must be a 'T' -dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case -dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T - -# disallowed_style - Anything that has this style applied is marked as disallowed -dotnet_naming_style.disallowed_style.capitalization = pascal_case -dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____ -dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____ - -# internal_error_style - This style should never occur... if it does, it indicates a bug in file or in the parser using the file -dotnet_naming_style.internal_error_style.capitalization = pascal_case -dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____ -dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____ - -# Simplify interpolation -dotnet_diagnostic.IDE0071.severity = warning - -# ??? -dotnet_diagnostic.IDE2000.severity = suggestion - -# All public/protected/protected_internal constant fields must be PascalCase -# https://docs.microsoft.com/dotnet/standard/design-guidelines/field -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = non_private_static_field_style -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group -dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field -dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const - -# All public/protected/protected_internal static readonly fields must be PascalCase -# https://docs.microsoft.com/dotnet/standard/design-guidelines/field -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = non_private_static_field_style -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group -dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field -dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly - -# No other public/protected/protected_internal fields are allowed -# https://docs.microsoft.com/dotnet/standard/design-guidelines/field -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group -dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field - -########################################## -# StyleCop Field Naming Rules -# Naming rules for fields follow the StyleCop analyzers -# This does not override any rules using disallowed_style above -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers -########################################## - -########################################## -# All constant fields must be PascalCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = non_private_static_field_style -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group -dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private -dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field -dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const -########################################## - -########################################## -# All static readonly fields must be PascalCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = non_private_static_field_style -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group -dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private -dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field -dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly -########################################## - -########################################## -# No non-private instance fields are allowed -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group -dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected -dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field -########################################## - -########################################## -# Private fields must be camelCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group -dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private -dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field -########################################## - -########################################## -# Local variables must be camelCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group -dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local -dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local -########################################## - -########################################## -# This rule should never fire. However, it's included for at least two purposes: -# First, it helps to understand, reason about, and root-case certain types of issues, such as bugs in .editorconfig parsers. -# Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#). -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group -dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = * -dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field -########################################## - -########################################## -# All of the following must be PascalCase: -# - Namespaces -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-namespaces -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md -# - Classes and Enumerations -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md -# - Delegates -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces#names-of-common-types -# - Constructors, Properties, Events, Methods -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-type-members -dotnet_naming_rule.element_rule.severity = warning -dotnet_naming_rule.element_rule.style = non_private_static_field_style -dotnet_naming_rule.element_rule.symbols = element_group -dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property -########################################## - -########################################## -# Interfaces use PascalCase and are prefixed with uppercase 'I' -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -dotnet_naming_rule.interface_rule.severity = warning -dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style -dotnet_naming_rule.interface_rule.symbols = interface_group -dotnet_naming_symbols.interface_group.applicable_kinds = interface -########################################## - -########################################## -# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T' -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -dotnet_naming_rule.type_parameter_rule.severity = warning -dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style -dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group -dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter -########################################## - -########################################## -# Function parameters use camelCase -# https://docs.microsoft.com/dotnet/standard/design-guidelines/naming-parameters -dotnet_naming_rule.parameters_rule.severity = warning -dotnet_naming_rule.parameters_rule.style = camel_case_style -dotnet_naming_rule.parameters_rule.symbols = parameters_group -dotnet_naming_symbols.parameters_group.applicable_kinds = parameter -########################################## - -# Type Parameters -dotnet_naming_style.type_parameter_style.required_prefix = T -dotnet_naming_style.type_parameter_style.capitalization = pascal_case - -dotnet_naming_rule.type_parameter_naming.severity = warning -dotnet_naming_rule.type_parameter_naming.style = type_parameter_style -dotnet_naming_rule.type_parameter_naming.symbols = type_parameter_symbol -dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = * -dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter - -# Instance fields are camelCase and start with _ -dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion -dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style -dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields -dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion -dotnet_naming_rule.instance_fields_should_be_camel_case.style = camel_case_underscore_style -dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields -dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case -dotnet_naming_style.camel_case_underscore_style.required_prefix = _ -dotnet_naming_style.instance_field_style.capitalization = camel_case -dotnet_naming_style.instance_field_style.required_prefix = _ -dotnet_naming_symbols.instance_fields.applicable_kinds = field -dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal -dotnet_naming_symbols.private_internal_fields.applicable_kinds = field - -# Local functions are PascalCase -dotnet_diagnostic.CS8618.severity = silent -dotnet_naming_rule.local_functions_should_be_pascal_case.severity = warning -dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style -dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = all_members -dotnet_naming_style.local_function_style.capitalization = pascal_case -dotnet_naming_symbols.local_functions.applicable_kinds = local_function - -# "this." and "Me." qualifiers -# dotnet_style_qualification_for_event = true:warning -# dotnet_style_qualification_for_field = true:warning -# dotnet_style_qualification_for_method = true:warning -# dotnet_style_qualification_for_property = true:warning - -# Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning - -# Undocumented -dotnet_style_operator_placement_when_wrapping = end_of_line - -# Naming styles -dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning -dotnet_naming_rule.interface_should_be_begins_with_i.style = prefix_interface_with_i_style -dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface -dotnet_naming_rule.types_should_be_pascal_case.severity = warning -dotnet_naming_rule.types_should_be_pascal_case.style = non_private_static_field_style -dotnet_naming_rule.types_should_be_pascal_case.symbols = types - -# By default, name items with PascalCase -dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning -dotnet_naming_rule.non_field_members_should_be_pascal_case.style = non_private_static_field_style -dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members - -# pascal_case_style - Define the PascalCase style -dotnet_naming_style.pascal_case_style.capitalization = pascal_case -dotnet_naming_symbols.all_members.applicable_kinds = * - -# Symbol specifications -dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method -dotnet_naming_symbols.non_field_members.required_modifiers = * - -# Naming styles -dotnet_naming_style.begins_with_i.capitalization = pascal_case -dotnet_naming_style.begins_with_i.required_prefix = I -dotnet_naming_style.begins_with_i.required_suffix = -dotnet_naming_style.begins_with_i.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = - -#### Interoperability #### - -# P/Invokes should not be visible -dotnet_diagnostic.CA1401.severity = error - -# Validate platform compatibility -dotnet_diagnostic.CA1416.severity = suggestion - -# Do not use OutAttribute on string parameters for P/Invokes -dotnet_diagnostic.CA1417.severity = suggestion - -# Validate platform compatibility -dotnet_diagnostic.CA1418.severity = suggestion - -# Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle' -dotnet_diagnostic.CA1419.severity = suggestion - -# Property, type, or attribute requires runtime marshalling -dotnet_diagnostic.CA1420.severity = suggestion - -# Method uses runtime marshalling when DisableRuntimeMarshallingAttribute is applied -dotnet_diagnostic.CA1421.severity = warning - -# Validate platform compatibility - obsoleted APIs -dotnet_diagnostic.CA1422.severity = warning - -#### Diagnostic #### - -# Avoid problematic synchronous waits -dotnet_diagnostic.VSTHRD002.severity = error - -# Avoid excessive inheritance -dotnet_diagnostic.CA1501.severity = warning - -# Avoid excessive complexity -dotnet_diagnostic.CA1502.severity = warning - -# Avoid unmaintainable code -dotnet_diagnostic.CA1505.severity = warning - -# Avoid excessive class coupling -dotnet_diagnostic.CA1506.severity = warning - -# Use nameof in place of string -dotnet_diagnostic.CA1507.severity = suggestion - -# Avoid dead conditional code -dotnet_diagnostic.CA1508.severity = warning - -# Invalid entry in code metrics configuration file -dotnet_diagnostic.CA1509.severity = suggestion - -# StatementMustNotUseUnnecessaryParenthesis -dotnet_diagnostic.SA1119.severity = suggestion - -# AccessModifierMustBeDeclared -dotnet_diagnostic.SA1400.severity = warning - -# FieldsMustBePrivate -dotnet_diagnostic.SA1401.severity = warning - -# FileMayOnlyContainASingleNamespace -dotnet_diagnostic.SA1403.severity = warning - -# DebugAssertMustProvideMessageText -dotnet_diagnostic.SA1405.severity = warning - -# DebugFailMustProvideMessageText -dotnet_diagnostic.SA1406.severity = warning - -# RemoveUnnecessaryCode -dotnet_diagnostic.SA1409.severity = warning - -# Dispose created -dotnet_diagnostic.IDISP001.severity = error - -# Dispose member -dotnet_diagnostic.IDISP002.severity = error - -# Dispose previous before re-assigning -dotnet_diagnostic.IDISP003.severity = error - -# Don't ignore created IDisposable -dotnet_diagnostic.IDISP004.severity = error - -# Return type should indicate that the value should be disposed -dotnet_diagnostic.IDISP005.severity = error - -# Implement IDisposable -dotnet_diagnostic.IDISP006.severity = error - -# Don't dispose injected -dotnet_diagnostic.IDISP007.severity = error - -# Don't assign member with injected and created disposables -dotnet_diagnostic.IDISP008.severity = error - -# Add IDisposable interface -dotnet_diagnostic.IDISP009.severity = error - -# Call base.Dispose(disposing) -dotnet_diagnostic.IDISP010.severity = error - -# Don't return disposed instance -dotnet_diagnostic.IDISP011.severity = warning - -# Property should not return created disposable -dotnet_diagnostic.IDISP012.severity = error - -# Await in using -dotnet_diagnostic.IDISP013.severity = error - -# Use a single instance of HttpClient -dotnet_diagnostic.IDISP014.severity = warning - -# Member should not return created and cached instance -dotnet_diagnostic.IDISP015.severity = error - -# Don't use disposed instance -dotnet_diagnostic.IDISP016.severity = error - -# Prefer using -dotnet_diagnostic.IDISP017.severity = error - -# Call SuppressFinalize -dotnet_diagnostic.IDISP018.severity = error - -# Call SuppressFinalize -dotnet_diagnostic.IDISP019.severity = error - -# Call SuppressFinalize(this) -dotnet_diagnostic.IDISP020.severity = error - -# Call this.Dispose(true) -dotnet_diagnostic.IDISP021.severity = error - -# Call this.Dispose(false) -dotnet_diagnostic.IDISP022.severity = error - -# Don't use reference types in finalizer context -dotnet_diagnostic.IDISP023.severity = error - -# Don't call GC.SuppressFinalize(this) when the type is sealed and has no finalizer -dotnet_diagnostic.IDISP024.severity = error - -# Class with no virtual dispose method should be sealed -dotnet_diagnostic.IDISP025.severity = error - -# Class with no virtual DisposeAsyncCore method should be sealed -dotnet_diagnostic.IDISP026.severity = error - -# Namespace does not match folder structure -dotnet_diagnostic.IDE0130.severity = warning - -#### Naming #### - -# Do not name enum values 'Reserved' -dotnet_diagnostic.CA1700.severity = warning - -# Identifiers should not contain underscores -dotnet_diagnostic.CA1707.severity = suggestion - -# Identifiers should differ by more than case -dotnet_diagnostic.CA1708.severity = error - -# Identifiers should have correct suffix -dotnet_diagnostic.CA1710.severity = suggestion - -# Identifiers should not have incorrect suffix -dotnet_diagnostic.CA1711.severity = silent - -# Do not prefix enum values with type name -dotnet_diagnostic.CA1712.severity = warning - -# Events should not have before or after prefix -dotnet_diagnostic.CA1713.severity = warning - -# Flags enums should have plural names -dotnet_diagnostic.CA1714.severity = error - -# Identifiers should have correct prefix -dotnet_diagnostic.CA1715.severity = error - -# Identifiers should not match keywords -dotnet_diagnostic.CA1716.severity = warning - -# Only FlagsAttribute enums should have plural names -dotnet_diagnostic.CA1717.severity = error - -# Identifiers should not contain type names -dotnet_diagnostic.CA1720.severity = warning - -# Property names should not match get methods -dotnet_diagnostic.CA1721.severity = warning - -# Type names should not match namespaces -dotnet_diagnostic.CA1724.severity = suggestion - -# Parameter names should match base declaration -dotnet_diagnostic.CA1725.severity = warning - -# Use PascalCase for named placeholders -dotnet_diagnostic.CA1727.severity = warning - -#### Code Quality #### -dotnet_code_quality_unused_parameters = all:warning - -#### Performance #### - -# Use Literals Where Appropriate -dotnet_diagnostic.CA1802.severity = suggestion - -# Do not initialize unnecessarily. -dotnet_diagnostic.CA1805.severity = error - -# Do not ignore method results -dotnet_diagnostic.CA1806.severity = error - -# Initialize reference type static fields inline -dotnet_diagnostic.CA1810.severity = error - -# Avoid uninstantiated internal classes -dotnet_diagnostic.CA1812.severity = warning - -# Avoid unsealed attributes -dotnet_diagnostic.CA1813.severity = error - -# Prefer jagged arrays over multidimensional -dotnet_diagnostic.CA1814.severity = warning - -# Override equals and operator equals on value types -dotnet_diagnostic.CA1815.severity = warning - -# Properties should not return arrays -dotnet_diagnostic.CA1819.severity = warning - -# Test for empty strings using string length -dotnet_diagnostic.CA1820.severity = warning - -# Remove empty finalizers -dotnet_diagnostic.CA1821.severity = error - -# Mark members as static -dotnet_diagnostic.CA1822.severity = warning - -# Avoid unused private fields -dotnet_diagnostic.CA1823.severity = error - -# Mark assemblies with NeutralResourcesLanguageAttribute -dotnet_diagnostic.CA1824.severity = suggestion - -# Avoid zero-length array allocations -dotnet_diagnostic.CA1825.severity = warning - -# Use property instead of Linq Enumerable method -dotnet_diagnostic.CA1826.severity = warning - -# Do not use Count/LongCount when Any can be used -dotnet_diagnostic.CA1827.severity = suggestion - -# Do not use CountAsync/LongCountAsync when AnyAsync can be used -dotnet_diagnostic.CA1828.severity = suggestion - -# Use Length/Count property instead of Enumerable.Count method -dotnet_diagnostic.CA1829.severity = warning - -# Prefer strongly-typed Append and Insert method overloads on StringBuilder. -dotnet_diagnostic.CA1830.severity = warning - -# Use AsSpan instead of Range-based indexers for string when appropriate -dotnet_diagnostic.CA1831.severity = warning - -# Use AsSpan or AsMemory instead of Range-based indexers for getting ReadOnlySpan or ReadOnlyMemory portion of an array -dotnet_diagnostic.CA1832.severity = warning - -# Use AsSpan or AsMemory instead of Range-based indexers for getting Span or Memory portion of an array -dotnet_diagnostic.CA1833.severity = warning - -# Use StringBuilder.Append(char) for single character strings -dotnet_diagnostic.CA1834.severity = warning - -# Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes -dotnet_diagnostic.CA1835.severity = warning - -# Prefer IsEmpty over Count when available -dotnet_diagnostic.CA1836.severity = warning - -# Use Environment.ProcessId instead of Process.GetCurrentProcess().Id -dotnet_diagnostic.CA1837.severity = warning - -# Avoid StringBuilder parameters for P/Invokes -dotnet_diagnostic.CA1838.severity = warning - -# Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName -dotnet_diagnostic.CA1839.severity = warning - -# Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId -dotnet_diagnostic.CA1840.severity = warning - -# Prefer Dictionary Contains methods -dotnet_diagnostic.CA1841.severity = warning - -# Do not use 'WhenAll' with a single task -dotnet_diagnostic.CA1842.severity = error - -# Do not use 'WaitAll' with a single task -dotnet_diagnostic.CA1843.severity = error - -# Provide memory-based overrides of async methods when subclassing 'Stream' -dotnet_diagnostic.CA1844.severity = warning - -# Use span-based 'string.Concat' -dotnet_diagnostic.CA1845.severity = warning - -# Prefer AsSpan over Substring -dotnet_diagnostic.CA1846.severity = warning - -# Use string.Contains(char) instead of string.Contains(string) with single character -dotnet_diagnostic.CA1847.severity = warning - -# Use the LoggerMessage delegates -dotnet_diagnostic.CA1848.severity = warning - -# Call async methods when in an async method -dotnet_diagnostic.CA1849.severity = error - -# Prefer static HashData method over ComputeHash -dotnet_diagnostic.CA1850.severity = error - -# Possible multiple enumerations of IEnumerable collection -dotnet_diagnostic.CA1851.severity = warning - -# Seal internal types -dotnet_diagnostic.CA1852.severity = error - -# Unnecessary call to 'Dictionary.ContainsKey(key)' -dotnet_diagnostic.CA1853.severity = error - -# Prefer the IDictionary.TryGetValue(TKey, out TValue) method -dotnet_diagnostic.CA1854.severity = error - -# Use Span.Clear() instead of Span.Fill() -dotnet_diagnostic.CA1855.severity = error - -# Use StartsWith instead of IndexOf -dotnet_diagnostic.CA1858.severity = error - -# Avoid using 'Enumerable.Any()' extension method -dotnet_diagnostic.CA1860.severity = error - -# Use Span.Clear() instead of Span.Fill() -dotnet_analyzer_diagnostic.category-Performance.severity = error - -# Use StartsWith instead of IndexOf -dotnet_analyzer_diagnostic.category-Performance.severity = error - -# Add readonly modifier -dotnet_diagnostic.IDE0044.severity = warning - -# Use 'System.HashCode.Combine' -dotnet_diagnostic.IDE0070.severity = warning - -# The UTF-7 encoding is insecure -dotnet_diagnostic.SYSLIB0001.severity = error - -# PrincipalPermissionAttribute is obsolete -dotnet_diagnostic.SYSLIB0002.severity = error - -# Code access security is not supported -dotnet_diagnostic.SYSLIB0003.severity = error - -# The constrained execution region (CER) feature is not supported -dotnet_diagnostic.SYSLIB0004.severity = error - -# The global assembly cache (GAC) is not supported -dotnet_diagnostic.SYSLIB0005.severity = error - -# Thread.Abort is not supported -dotnet_diagnostic.SYSLIB0006.severity = error - -# Default implementations of cryptography algorithms not supported -dotnet_diagnostic.SYSLIB0007.severity = error - -# CreatePdbGenerator is not supported -dotnet_diagnostic.SYSLIB0008.severity = error - -# The AuthenticationManager Authenticate and PreAuthenticate methods are not supported -dotnet_diagnostic.SYSLIB0009.severity = error - -# Unsupported remoting APIs -dotnet_diagnostic.SYSLIB0010.severity = error - -# BinaryFormatter serialization is obsolete -dotnet_diagnostic.SYSLIB0011.severity = error - -# Type or member is obsolete -dotnet_diagnostic.SYSLIB0012.severity = error - -# EscapeUriString is obsolete -dotnet_diagnostic.SYSLIB0013.severity = error - -# WebRequest, HttpWebRequest, ServicePoint, WebClient are obsolete -dotnet_diagnostic.SYSLIB0014.severity = error - -# DisablePrivateReflectionAttribute is obsolete -dotnet_diagnostic.SYSLIB0015.severity = error - -# GetContextInfo() is obsolete -dotnet_diagnostic.SYSLIB0016.severity = error - -# Strong-name signing is not supported and throws PlatformNotSupportedException -dotnet_diagnostic.SYSLIB0017.severity = error - -# Reflection-only loading is not supported and throws PlatformNotSupportedException -dotnet_diagnostic.SYSLIB0018.severity = error - -# Some RuntimeEnvironment APIs are obsolete -dotnet_diagnostic.SYSLIB0019.severity = error - -# IgnoreNullValues is obsolete -dotnet_diagnostic.SYSLIB0020.severity = error - -# Derived cryptographic types are obsolete -dotnet_diagnostic.SYSLIB0021.severity = error - -# The Rijndael and RijndaelManaged types are obsolete -dotnet_diagnostic.SYSLIB0022.severity = error - -# RNGCryptoServiceProvider is obsolete -dotnet_diagnostic.SYSLIB0023.severity = error - -# Creating and unloading AppDomains is not supported and throws an exception -dotnet_diagnostic.SYSLIB0024.severity = error - -# SuppressIldasmAttribute is obsolete -dotnet_diagnostic.SYSLIB0025.severity = error - -# X509Certificate and X509Certificate2 are immutable -dotnet_diagnostic.SYSLIB0026.severity = error - -# PublicKey.Key is obsolete -dotnet_diagnostic.SYSLIB0027.severity = error - -# X509Certificate2.PrivateKey is obsolete -dotnet_diagnostic.SYSLIB0028.severity = error - -# ProduceLegacyHmacValues is obsolete -dotnet_diagnostic.SYSLIB0029.severity = error - -# HMACSHA1 always uses the algorithm implementation provided by the platform -dotnet_diagnostic.SYSLIB0030.severity = error - -# EncodeOID is obsolete -dotnet_diagnostic.SYSLIB0031.severity = error - -# Recovery from corrupted process state exceptions is not supported -dotnet_diagnostic.SYSLIB0032.severity = error - -# Rfc2898DeriveBytes.CryptDeriveKey is obsolete -dotnet_diagnostic.SYSLIB0033.severity = error - -# CmsSigner(CspParameters) constructor is obsolete -dotnet_diagnostic.SYSLIB0034.severity = error - -# ComputeCounterSignature without specifying a CmsSigner is obsolete -dotnet_diagnostic.SYSLIB0035.severity = error - -# Regex.CompileToAssembly is obsolete -dotnet_diagnostic.SYSLIB0036.severity = error - -# AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete -dotnet_diagnostic.SYSLIB0037.severity = error - -# SerializationFormat.Binary is obsolete -dotnet_diagnostic.SYSLIB0038.severity = error - -# SslProtocols.Tls and SslProtocols.Tls11 are obsolete -dotnet_diagnostic.SYSLIB0039.severity = error - -# EncryptionPolicy.NoEncryption and EncryptionPolicy.AllowNoEncryption are obsolete -dotnet_diagnostic.SYSLIB0040.severity = error - -# Some Rfc2898DeriveBytes constructors are obsolete -dotnet_diagnostic.SYSLIB0041.severity = error - -# FromXmlString and ToXmlString on ECC types are obsolete -dotnet_diagnostic.SYSLIB0042.severity = error - -# ECDiffieHellmanPublicKey.ToByteArray is obsolete -dotnet_diagnostic.SYSLIB0043.severity = error - -# AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete -dotnet_diagnostic.SYSLIB0044.severity = error - -# Some cryptographic factory methods are obsolete -dotnet_diagnostic.SYSLIB0045.severity = error - -# ControlledExecution.Run should not be used -dotnet_diagnostic.SYSLIB0046.severity = error - -# XmlSecureResolver is obsolete -dotnet_diagnostic.SYSLIB0047.severity = error - -# RSA.EncryptValue and DecryptValue are obsolete -dotnet_diagnostic.SYSLIB0048.severity = error - -# Logging method names can't start with an underscore -dotnet_diagnostic.SYSLIB1001.severity = error - -# Don't include log level parameters as templates in the logging message -dotnet_diagnostic.SYSLIB1002.severity = error - -# Logging method parameter names can't start with an underscore -dotnet_diagnostic.SYSLIB1003.severity = error - -# Could not find a required type definition -dotnet_diagnostic.SYSLIB1005.severity = error - -# Multiple logging methods cannot use the same event ID -dotnet_diagnostic.SYSLIB1006.severity = error - -# Logging methods must return void -dotnet_diagnostic.SYSLIB1007.severity = error - -# One of the arguments to a logging method must implement the ILogger interface -dotnet_diagnostic.SYSLIB1008.severity = error - -# Logging methods must be static -dotnet_diagnostic.SYSLIB1009.severity = error - -# Logging methods must be partial -dotnet_diagnostic.SYSLIB1010.severity = error - -# Logging methods cannot be generic -dotnet_diagnostic.SYSLIB1011.severity = error - -# Redundant qualifier in logging message -dotnet_diagnostic.SYSLIB1012.severity = error - -# Don't include exception parameters as templates in the logging message -dotnet_diagnostic.SYSLIB1013.severity = error - -# Logging template has no corresponding method argument -dotnet_diagnostic.SYSLIB1014.severity = error - -# Argument is not referenced from the logging message -dotnet_diagnostic.SYSLIB1015.severity = error - -# Logging methods cannot have a body -dotnet_diagnostic.SYSLIB1016.severity = error - -# A LogLevel value must be supplied in the LoggerMessage attribute or as a parameter to the logging method -dotnet_diagnostic.SYSLIB1017.severity = error - -# Don't include logger parameters as templates in the logging message -dotnet_diagnostic.SYSLIB1018.severity = error - -# Couldn't find a field of type ILogger -dotnet_diagnostic.SYSLIB1019.severity = error - -# Found multiple fields of type ILogger -dotnet_diagnostic.SYSLIB1020.severity = error - -# Multiple message-template item names differ only by case -dotnet_diagnostic.SYSLIB1021.severity = error - -# Can't have malformed format strings -dotnet_diagnostic.SYSLIB1022.severity = error - -# Generating more than six arguments is not supported -dotnet_diagnostic.SYSLIB1023.severity = error - -# System.Text.Json source generator did not generate output for type -dotnet_diagnostic.SYSLIB1030.severity = error - -# System.Text.Json source generator encountered a duplicate type info property name -dotnet_diagnostic.SYSLIB1031.severity = error - -# Context classes to be augmented by the System.Text.Json source generator must be declared as partial -dotnet_diagnostic.SYSLIB1032.severity = error - -# System.Text.Json source generator encountered a type with multiple [JsonConstructor] annotations -dotnet_diagnostic.SYSLIB1033.severity = error - -# System.Text.Json source generator encountered a type with multiple [JsonExtensionData] annotations -dotnet_diagnostic.SYSLIB1035.severity = error - -# System.Text.Json source generator encountered an invalid [JsonExtensionData] annotation -dotnet_diagnostic.SYSLIB1036.severity = error - -# System.Text.Json source generator encountered a type with init-only properties which are not supported for deserialization -dotnet_diagnostic.SYSLIB1037.severity = error - -# System.Text.Json source generator encountered a property annotated with [JsonInclude] but with inaccessible accessors -dotnet_diagnostic.SYSLIB1038.severity = error - -# Invalid GeneratedRegexAttribute usage. -dotnet_diagnostic.SYSLIB1040.severity = error - -# Multiple GeneratedRegexAttribute attributes were applied to the same method, but only one is allowed. -dotnet_diagnostic.SYSLIB1041.severity = error - -# The specified regular expression is invalid. -dotnet_diagnostic.SYSLIB1042.severity = error - -# A GeneratedRegexAttribute method must be partial, parameterless, non-generic, and non-abstract, and return Regex. -dotnet_diagnostic.SYSLIB1043.severity = error - -# The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. -dotnet_diagnostic.SYSLIB1044.severity = error - -# Use GeneratedRegexAttribute to generate the regular expression implementation at compile time. -dotnet_diagnostic.SYSLIB1045.severity = suggestion #CHANGE TO WARNING - -# Invalid LibraryImportAttribute usage. -dotnet_diagnostic.SYSLIB1050.severity = error - -# The specified type is not supported by source-generated p/invokes. -dotnet_diagnostic.SYSLIB1051.severity = error - -# The specified configuration is not supported by source-generated p/invokes. -dotnet_diagnostic.SYSLIB1052.severity = error - -# The specified LibraryImportAttribute arguments cannot be forwarded to DllImportAttribute. -dotnet_diagnostic.SYSLIB1053.severity = error - -# Use LibraryImportAttribute instead of DllImportAttribute to generate p/invoke marshalling code at compile time. -dotnet_diagnostic.SYSLIB1054.severity = suggestion #SHOULD BE ERROR - -# Invalid CustomMarshallerAttribute usage. -dotnet_diagnostic.SYSLIB1055.severity = error - -# The specified native type is invalid. -dotnet_diagnostic.SYSLIB1056.severity = error - -# The marshaller type does not have the required shape. -dotnet_diagnostic.SYSLIB1057.severity = error - -# Invalid NativeMarshallingAttribute usage -dotnet_diagnostic.SYSLIB1058.severity = error - -# The marshaller type does not support an allocating constructor. -dotnet_diagnostic.SYSLIB1059.severity = error - -# The specified marshaller type is invalid. -dotnet_diagnostic.SYSLIB1060.severity = error - -# The marshaller type has incompatible method signatures. -dotnet_diagnostic.SYSLIB1061.severity = error - -# The project must be updated with true. -dotnet_diagnostic.SYSLIB1062.severity = error - -# Invalid JSImportAttribute usage. -dotnet_diagnostic.SYSLIB1070.severity = error - -# Invalid JSExportAttribute usage. -dotnet_diagnostic.SYSLIB1071.severity = error - -# The specified type is not supported by source-generated JavaScript interop. -dotnet_diagnostic.SYSLIB1072.severity = error - -# The specified configuration is not supported by source-generated JavaScript interop. -dotnet_diagnostic.SYSLIB1073.severity = error - -# JSImportAttribute requires unsafe code. -dotnet_diagnostic.SYSLIB1074.severity = error - -# JSExportAttribute requires unsafe code. -dotnet_diagnostic.SYSLIB1075.severity = error - - -dotnet_diagnostic.SYSLIB1070.severity = error - - -dotnet_diagnostic.SYSLIB1070.severity = error - -dotnet_diagnostic.RemoveUnnecessaryImportsFixable.severity = warning - -#### Reliability #### - -# Dispose objects before losing scope -dotnet_diagnostic.CA2000.severity = error - -# Do not lock on objects with weak identity -dotnet_diagnostic.CA2002.severity = error - -# Do not directly await a Task -dotnet_diagnostic.CA2007.severity = error - -# Do not create tasks without passing a TaskScheduler -dotnet_diagnostic.CA2008.severity = suggestion - -# Do not call ToImmutableCollection on an ImmutableCollection value -dotnet_diagnostic.CA2009.severity = error - -# Do not assign property within its setter -dotnet_diagnostic.CA2011.severity = error - -# Use ValueTasks correctly -dotnet_diagnostic.CA2012.severity = error - -# Do not use ReferenceEquals with value types -dotnet_diagnostic.CA2013.severity = suggestion - -# Do not use stackalloc in loops -dotnet_diagnostic.CA2014.severity = error - -# Do not define finalizers for types derived from MemoryManager -dotnet_diagnostic.CA2015.severity = error - -# Forward the CancellationToken parameter to methods that take one -dotnet_diagnostic.CA2016.severity = suggestion - -# Parameter count mismatch -dotnet_diagnostic.CA2017.severity = error - -# The count argument to Buffer.BlockCopy should specify the number of bytes to copy -dotnet_diagnostic.CA2018.severity = warning - -# ThreadStatic fields should not use inline initialization -dotnet_diagnostic.CA2019.severity = warning - -# Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr -dotnet_diagnostic.CA2020.severity = warning - -#### Security Rules #### - -# Review SQL queries for security vulnerabilities -dotnet_diagnostic.CA2100.severity = error - -# Review visible event handlers -dotnet_diagnostic.CA2109.severity = warning - -# Seal methods that satisfy private interfaces -dotnet_diagnostic.CA2119.severity = warning - -# Avoid handling Corrupted State Exceptions -dotnet_diagnostic.CA2153.severity = warning - -# Do not use insecure deserializer BinaryFormatter -dotnet_diagnostic.CA2300.severity = warning - -# Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder -dotnet_diagnostic.CA2301.severity = warning - -# Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize -dotnet_diagnostic.CA2302.severity = warning - -# Do not use insecure deserializer LosFormatter -dotnet_diagnostic.CA2305.severity = warning - -# Do not use insecure deserializer NetDataContractSerializer -dotnet_diagnostic.CA2310.severity = warning - -# Do not deserialize without first setting NetDataContractSerializer.Binder -dotnet_diagnostic.CA2311.severity = warning - -# Ensure NetDataContractSerializer.Binder is set before deserializing -dotnet_diagnostic.CA2312.severity = warning - -# Do not use insecure deserializer ObjectStateFormatter -dotnet_diagnostic.CA2315.severity = warning - -# Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver -dotnet_diagnostic.CA2321.severity = warning - -# Ensure JavaScriptSerializer is not initialized with SimpleTypeResolver before deserializing -dotnet_diagnostic.CA2322.severity = warning - -# Do not use TypeNameHandling values other than None -dotnet_diagnostic.CA2326.severity = warning - -# Do not use insecure JsonSerializerSettings -dotnet_diagnostic.CA2327.severity = warning - -# Ensure that JsonSerializerSettings are secure -dotnet_diagnostic.CA2328.severity = warning - -# Do not deserialize with JsonSerializer using an insecure configuration -dotnet_diagnostic.CA2329.severity = warning - -# Ensure that JsonSerializer has a secure configuration when deserializing -dotnet_diagnostic.CA2330.severity = warning - -# Ensure DataTable.ReadXml()'s input is trusted -dotnet_diagnostic.CA2350.severity = warning - -# Ensure DataSet.ReadXml()'s input is trusted -dotnet_diagnostic.CA2351.severity = warning - -# Unsafe DataSet or DataTable in serializable type can be vulnerable to remote code execution attacks -dotnet_diagnostic.CA2352.severity = warning - -# Unsafe DataSet or DataTable in serializable type -dotnet_diagnostic.CA2353.severity = warning - -# Unsafe DataSet or DataTable in deserialized object graph can be vulnerable to remote code execution attack -dotnet_diagnostic.CA2354.severity = warning - -# Unsafe DataSet or DataTable in deserialized object graph -dotnet_diagnostic.CA2355.severity = warning - -# Unsafe DataSet or DataTable type in web deserialized object graph -dotnet_diagnostic.CA2356.severity = warning - -# Ensure autogenerated class containing DataSet.ReadXml() is not used with untrusted data -dotnet_diagnostic.CA2361.severity = warning - -# Unsafe DataSet or DataTable in autogenerated serializable type can be vulnerable to remote code execution attacks -dotnet_diagnostic.CA2362.severity = warning - -# Review code for SQL injection vulnerabilities -dotnet_diagnostic.CA3001.severity = warning - -# Review code for XSS vulnerabilities -dotnet_diagnostic.CA3002.severity = warning - -# Review code for file path injection vulnerabilities -dotnet_diagnostic.CA3003.severity = warning - -# Review code for information disclosure vulnerabilities -dotnet_diagnostic.CA3004.severity = warning - -# Review code for LDAP injection vulnerabilities -dotnet_diagnostic.CA3005.severity = warning - -# Review code for process command injection vulnerabilities -dotnet_diagnostic.CA3006.severity = warning - -# Review code for open redirect vulnerabilities -dotnet_diagnostic.CA3007.severity = warning - -# Review code for XPath injection vulnerabilities -dotnet_diagnostic.CA3008.severity = warning - -# Review code for XML injection vulnerabilities -dotnet_diagnostic.CA3009.severity = warning - -# Review code for XAML injection vulnerabilities -dotnet_diagnostic.CA3010.severity = warning - -# Review code for DLL injection vulnerabilities -dotnet_diagnostic.CA3011.severity = warning - -# Review code for regex injection vulnerabilities -dotnet_diagnostic.CA3012.severity = warning - -# Do Not Add Schema By URL -dotnet_diagnostic.CA3061.severity = warning - -# Insecure DTD processing in XML -dotnet_diagnostic.CA3075.severity = warning - -# Insecure XSLT script processing. -dotnet_diagnostic.CA3076.severity = warning - -# Insecure Processing in API Design, XmlDocument and XmlTextReader -dotnet_diagnostic.CA3077.severity = warning - -# Mark Verb Handlers With Validate Antiforgery Token -dotnet_diagnostic.CA3147.severity = warning - -# Do Not Use Weak Cryptographic Algorithms -dotnet_diagnostic.CA5350.severity = warning - -# Do Not Use Broken Cryptographic Algorithms -dotnet_diagnostic.CA5351.severity = warning - -# Do Not Use Unsafe Cipher Modes -dotnet_diagnostic.CA5358.severity = warning - -# Do Not Disable Certificate Validation -dotnet_diagnostic.CA5359.severity = warning - -# Do Not Call Dangerous Methods In Deserialization -dotnet_diagnostic.CA5360.severity = warning - -# Do Not Disable SChannel Use of Strong Crypto -dotnet_diagnostic.CA5361.severity = warning - -# Do Not Refer Self In Serializable Class -dotnet_diagnostic.CA5362.severity = error - -# Do Not Disable Request Validation -dotnet_diagnostic.CA5363.severity = warning - -# Do Not Use Deprecated Security Protocols -dotnet_diagnostic.CA5364.severity = warning - -# Do Not Disable HTTP Header Checking -dotnet_diagnostic.CA5365.severity = warning - -# Use XmlReader For DataSet Read Xml -dotnet_diagnostic.CA5366.severity = warning - -# Do Not Serialize Types With Pointer Fields -dotnet_diagnostic.CA5367.severity = warning - -# Set ViewStateUserKey For Classes Derived From Page -dotnet_diagnostic.CA5368.severity = warning - -# Use XmlReader For Deserialize -dotnet_diagnostic.CA5369.severity = warning - -# Use XmlReader For Validating Reader -dotnet_diagnostic.CA5370.severity = warning - -# Use XmlReader For Schema Read -dotnet_diagnostic.CA5371.severity = warning - -# Use XmlReader For XPathDocument -dotnet_diagnostic.CA5372.severity = warning - -# Do not use obsolete key derivation function -dotnet_diagnostic.CA5373.severity = warning - -# Do Not Use XslTransform -dotnet_diagnostic.CA5374.severity = warning - -# Do Not Use Account Shared Access Signature -dotnet_diagnostic.CA5375.severity = warning - -# Use SharedAccessProtocol HttpsOnly -dotnet_diagnostic.CA5376.severity = warning - -# Use Container Level Access Policy -dotnet_diagnostic.CA5377.severity = warning - -# Do not disable ServicePointManagerSecurityProtocols -dotnet_diagnostic.CA5378.severity = warning - -# Do Not Use Weak Key Derivation Function Algorithm -dotnet_diagnostic.CA5379.severity = warning - -# Do Not Add Certificates To Root Store -dotnet_diagnostic.CA5380.severity = warning - -# Ensure Certificates Are Not Added To Root Store -dotnet_diagnostic.CA5381.severity = warning - -# Use Secure Cookies In ASP.Net Core -dotnet_diagnostic.CA5382.severity = warning - -# Ensure Use Secure Cookies In ASP.Net Core -dotnet_diagnostic.CA5383.severity = warning - -# Do Not Use Digital Signature Algorithm (DSA) -dotnet_diagnostic.CA5384.severity = warning - -# Use Rivest–Shamir–Adleman (RSA) Algorithm With Sufficient Key Size -dotnet_diagnostic.CA5385.severity = warning - -# Avoid hardcoding SecurityProtocolType value -dotnet_diagnostic.CA5386.severity = warning - -# Do Not Use Weak Key Derivation Function With Insufficient Iteration Count -dotnet_diagnostic.CA5387.severity = warning - -# Ensure Sufficient Iteration Count When Using Weak Key Derivation Function -dotnet_diagnostic.CA5388.severity = warning - -# Do Not Add Archive Item's Path To The Target File System Path -dotnet_diagnostic.CA5389.severity = suggestion - -# Do Not Hard Code Encryption Key -dotnet_diagnostic.CA5390.severity = error - -# Use antiforgery tokens in ASP.NET Core MVC controllers -dotnet_diagnostic.CA5391.severity = warning - -# Use DefaultDllImportSearchPaths attribute for P/Invokes -dotnet_diagnostic.CA5392.severity = warning - -# Do not use unsafe DllImportSearchPath value -dotnet_diagnostic.CA5393.severity = warning - -# Do not use insecure randomness -dotnet_diagnostic.CA5394.severity = warning - -# Miss HttpVerb attribute for action methods -dotnet_diagnostic.CA5395.severity = warning - -# Set HttpOnly to true for HttpCookie -dotnet_diagnostic.CA5396.severity = warning - -# Do not use deprecated SslProtocols values -dotnet_diagnostic.CA5397.severity = warning - -# Avoid hardcoded SslProtocols values -dotnet_diagnostic.CA5398.severity = warning - -# Definitely disable HttpClient certificate revocation list check -dotnet_diagnostic.CA5399.severity = warning - -# Ensure HttpClient certificate revocation list check is not disabled -dotnet_diagnostic.CA5400.severity = warning - -# Do not use CreateEncryptor with non-default IV -dotnet_diagnostic.CA5401.severity = suggestion - -# Use CreateEncryptor with the default IV -dotnet_diagnostic.CA5402.severity = warning - -# Do not hard-code certificate -dotnet_diagnostic.CA5403.severity = error - -# Do not disable token validation checks -dotnet_diagnostic.CA5404.severity = error - -# Do not always skip token validation in delegates -dotnet_diagnostic.CA5404.severity = error - -# Do not always skip token validation in delegates -dotnet_diagnostic.CA5405.severity = error - -#### Usage Rules #### -# Review unused parameters -dotnet_diagnostic.CA1801.severity = warning - -# Call GC.SuppressFinalize correctly -dotnet_diagnostic.CA1816.severity = error - -# Rethrow to preserve stack details -dotnet_diagnostic.CA2200.severity = error - -# Do not raise reserved exception types -dotnet_diagnostic.CA2201.severity = error - -# Initialize value type static fields inline -dotnet_diagnostic.CA2207.severity = warning - -# Instantiate argument exceptions correctly -dotnet_diagnostic.CA2208.severity = error - -# Non-constant fields should not be visible -dotnet_diagnostic.CA2211.severity = error - -# Disposable fields should be disposed -dotnet_diagnostic.CA2213.severity = error - -# Do not call overridable methods in constructors -dotnet_diagnostic.CA2214.severity = warning - -# Dispose methods should call base class dispose -dotnet_diagnostic.CA2215.severity = warning - -# Disposable types should declare finalizer -dotnet_diagnostic.CA2216.severity = warning - -# Do not mark enums with FlagsAttribute -dotnet_diagnostic.CA2217.severity = error - -# Override GetHashCode on overriding Equals -dotnet_diagnostic.CA2218.severity = warning - -# Do not raise exceptions in exception clauses -dotnet_diagnostic.CA2219.severity = error - -# Override Equals on overloading operator equals -dotnet_diagnostic.CA2224.severity = warning - -# Operator overloads have named alternates -dotnet_diagnostic.CA2225.severity = warning - -# Operators should have symmetrical overloads -dotnet_diagnostic.CA2226.severity = warning - -# Collection properties should be read only -dotnet_diagnostic.CA2227.severity = warning - -# Implement serialization constructors -dotnet_diagnostic.CA2229.severity = warning - -# Overload operator equals on overriding ValueType.Equals -dotnet_diagnostic.CA2231.severity = warning - -# Pass System.Uri objects instead of strings -dotnet_diagnostic.CA2234.severity = warning - -# Mark all non-serializable fields -dotnet_diagnostic.CA2235.severity = suggestion - -# Mark ISerializable types with SerializableAttribute -dotnet_diagnostic.CA2237.severity = warning - -# Provide correct arguments to formatting methods -dotnet_diagnostic.CA2241.severity = warning - -# Test for NaN correctly -dotnet_diagnostic.CA2242.severity = warning - -# Attribute string literals should parse correctly -dotnet_diagnostic.CA2243.severity = warning - -# Do not duplicate indexed element initializations -dotnet_diagnostic.CA2244.severity = warning - -# Do not assign a property to itself -dotnet_diagnostic.CA2245.severity = warning - -# Do not assign a symbol and its member in the same statement -dotnet_diagnostic.CA2246.severity = warning - -# Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum -dotnet_diagnostic.CA2247.severity = warning - -# Provide correct enum argument to Enum.HasFlag -dotnet_diagnostic.CA2248.severity = warning - -# Consider using String.Contains instead of String.IndexOf -dotnet_diagnostic.CA2249.severity = warning - -# Use ThrowIfCancellationRequested -dotnet_diagnostic.CA2250.severity = warning - -# Use String.Equals over String.Compare -dotnet_diagnostic.CA2251.severity = warning - -# Opt in to preview features -dotnet_diagnostic.CA2252.severity = suggestion - -# Named placeholders should not be numeric values -dotnet_diagnostic.CA2253.severity = warning - -# Template should be a static expression -dotnet_diagnostic.CA2254.severity = warning - -# The ModuleInitializer attribute should not be used in libraries -dotnet_diagnostic.CA2255.severity = warning - -# All members declared in parent interfaces must have an implementation in a DynamicInterfaceCastableImplementation-attributed interface -dotnet_diagnostic.CA2256.severity = warning - -# Members defined on an interface with 'DynamicInterfaceCastableImplementationAttribute' should be 'static' -dotnet_diagnostic.CA2257.severity = warning - -# Providing a 'DynamicInterfaceCastableImplementation' interface in Visual Basic is unsupported -dotnet_diagnostic.CA2258.severity = warning - -# Ensure ThreadStatic is only used with static fields -dotnet_diagnostic.CA2259.severity = warning - -# Implement generic math interfaces correctly -dotnet_diagnostic.CA2260.severity = warning - -#### Language Rules #### -# this and Me preferences -dotnet_diagnostic.IDE0003.severity = suggestion -dotnet_diagnostic.IDE0009.severity = suggestion -dotnet_style_qualification_for_field = true:suggestion - -# Simplify 'default' expression -dotnet_diagnostic.IDE0034.severity = suggestion - -# Order modifiers -dotnet_diagnostic.IDE0036.severity = warning - -# Add accessibility modifiers -dotnet_diagnostic.IDE0040.severity = error - -# Format string contains invalid placeholder -dotnet_diagnostic.IDE0043.severity = warning - -# Add readonly modifier -dotnet_diagnostic.IDE0044.severity = warning - -# Language keywords instead of framework type names for type references -dotnet_style_predefined_type_for_locals_parameters_members = true:warning -dotnet_style_predefined_type_for_member_access = true:warning - -# Use language keywords instead of framework type names for type references -dotnet_diagnostic.IDE0049.severity = suggestion - -# Convert anonymous type to tuple -dotnet_diagnostic.IDE0050.severity = suggestion - -# Use index operator -dotnet_diagnostic.IDE0056.severity = suggestion - -# Use range operator -dotnet_diagnostic.IDE0057.severity = suggestion - -# Make local function static -dotnet_diagnostic.IDE0062.severity = suggestion - -# Add missing cases to switch expression -dotnet_diagnostic.IDE0072.severity = suggestion - -# Simplify new expression -dotnet_diagnostic.IDE0090.severity = suggestion - -# ??? -dotnet_diagnostic.IDE0120.severity = suggestion - -# Make struct fields writable -dotnet_diagnostic.IDE0064.severity = suggestion - -# Parentheses preferences -dotnet_diagnostic.IDE0047.severity = warning -dotnet_diagnostic.IDE0048.severity = warning - -# Add missing cases to switch statement -dotnet_diagnostic.IDE0010.severity = suggestion - -# Use object initializers -dotnet_diagnostic.IDE0017.severity = suggestion - -# Inline variable declaration -dotnet_diagnostic.IDE0018.severity = warning - -# Use collection initializers -dotnet_diagnostic.IDE0028.severity = suggestion - -# Use auto property -dotnet_diagnostic.IDE0032.severity = suggestion - -# Use explicitly provided tuple name -dotnet_diagnostic.IDE0033.severity = suggestion - -# Simplify 'default' expression -dotnet_diagnostic.IDE0034.severity = suggestion - -# Use inferred member name -dotnet_diagnostic.IDE0037.severity = suggestion - -# Use local function instead of lambda -dotnet_diagnostic.IDE0039.severity = suggestion - -# Deconstruct variable declaration -dotnet_diagnostic.IDE0042.severity = suggestion - -# Convert anonymous type to tuple -dotnet_diagnostic.IDE050.severity = suggestion - -# Use compound assignment -dotnet_diagnostic.IDE0054.severity = suggestion -dotnet_diagnostic.IDE0074.severity = suggestion - -# Simplify conditional expression -dotnet_diagnostic.IDE0075.severity = suggestion - -# Convert typeof to nameof -dotnet_diagnostic.IDE0082.severity = suggestion - -# Simplify new expression -dotnet_diagnostic.IDE0090.severity = suggestion - -# Use throw expression -dotnet_diagnostic.IDE0016.severity = warning - -# Use coalesce expression -dotnet_diagnostic.IDE0029.severity = suggestion -dotnet_diagnostic.IDE0030.severity = suggestion - -# Expression-level preferences - -# Use conditional expression for assignment -dotnet_diagnostic.IDE0045.severity = suggestion - -# Use conditional expression for return -dotnet_diagnostic.IDE0046.severity = suggestion - -dotnet_style_collection_initializer = true:warning -dotnet_style_explicit_tuple_names = true:warning -dotnet_style_object_initializer = true:warning -dotnet_style_prefer_auto_properties = true:warning -dotnet_style_prefer_compound_assignment = true:warning -dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion -dotnet_style_prefer_conditional_expression_over_return = false:suggestion -dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning -dotnet_style_prefer_inferred_tuple_names = true:warning -dotnet_style_prefer_simplified_boolean_expressions = false:silent -dotnet_style_prefer_simplified_interpolation = true:warning - -# Null-checking preferences -dotnet_style_coalesce_expression = true:warning -dotnet_style_null_propagation = true:warning -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning - -# Suppression preferences -dotnet_remove_unnecessary_suppression_exclusions = none - -# Use null propagation -dotnet_diagnostic.IDE0031.severity = suggestion - -# Use is null check -dotnet_diagnostic.IDE0041.severity = suggestion - -# Prefer 'null' check over type check -dotnet_diagnostic.IDE0050.severity = suggestion - -# Use conditional delegate call -dotnet_diagnostic.IDE1005.severity = suggestion - -# 'var' preferences -dotnet_diagnostic.IDE0007.severity = warning -dotnet_diagnostic.IDE0008.severity = warning - -# Use expression body for constructors -dotnet_diagnostic.IDE0021.severity = silent - -# Use expression body for methods -dotnet_diagnostic.IDE0022.severity = silent - -# Use expression body for operators -dotnet_diagnostic.IDE0023.severity = warning -dotnet_diagnostic.IDE0024.severity = silent - -# Use expression body for properties -dotnet_diagnostic.IDE0025.severity = warning - -# Use expression body for indexers -dotnet_diagnostic.IDE0026.severity = suggestion - -# Use expression body for accessors -dotnet_diagnostic.IDE0027.severity = suggestion - -# Use expression body for lambdas -dotnet_diagnostic.IDE0053.severity = suggestion - -# Use expression body for local functions -dotnet_diagnostic.IDE0061.severity = suggestion - -# Use pattern matching to avoid 'as' followed by a 'null' check -dotnet_diagnostic.IDE0019.severity = warning - -# Use pattern matching to avoid 'is' check followed by a cast -dotnet_diagnostic.IDE0020.severity = warning - -# Use coalesce expression (nullable types) -dotnet_diagnostic.IDE0030.severity = warning - -# Use pattern matching to avoid is check followed by a cast (without variable) -dotnet_diagnostic.IDE0038.severity = warning - -# Use switch expression -dotnet_diagnostic.IDE0066.severity = warning - -# Use pattern matching -dotnet_diagnostic.IDE0078.severity = suggestion - -# Use pattern matching (not operator) -dotnet_diagnostic.IDE0083.severity = suggestion - -# Use pattern matching (IsNot operator) -dotnet_diagnostic.IDE0084.severity = suggestion -visual_basic_style_prefer_isnot_expression = true : suggestion - -# Namespace declaration preferences -dotnet_diagnostic.IDE0160.severity = suggestion -dotnet_diagnostic.IDE0161.severity = suggestion - -# Simplify property pattern -dotnet_diagnostic.IDE0170.severity = suggestion - -# Use tuple to swap values -dotnet_diagnostic.IDE0180.severity = suggestion - -# Add braces -dotnet_diagnostic.IDE0011.severity = error - -# Use simple 'using' statement -dotnet_diagnostic.IDE0063.severity = suggestion - -# 'using' directive placement -dotnet_diagnostic.IDE0065.severity = error - -# Require file header -dotnet_diagnostic.IDE0073.severity = warning -file_header_template = unset - -# Fix formatting -dotnet_diagnostic.IDE0055.severity = suggestion - -# Organize usings -dotnet_separate_import_directive_groups = false -dotnet_sort_system_directives_first = true - -# IDE1006 (Naming rule violation) -dotnet_diagnostic.IDE1006.severity = none -dotnet_naming_rule.public_members_must_be_capitalized.severity = warning -dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style -dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols -dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper -dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.interface.applicable_kinds = interface -dotnet_naming_symbols.public_symbols.applicable_accessibilities = public -dotnet_naming_symbols.public_symbols.applicable_kinds = property, method, field, event, delegate -dotnet_naming_symbols.public_symbols.required_modifiers = readonly -dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum - -# RS0016: Add public types and members to the declared API -dotnet_public_api_analyzer.require_api_files = true - -# Do not use generic CodeAction.Create to create CodeAction -dotnet_diagnostic.RS0005.severity = none - -#### Design Rules #### -# CA1000: Do not declare static members on generic typesk -dotnet_diagnostic.CA1000.severity = suggestion - -# CA1001: Types that own disposable fields should be disposable -dotnet_diagnostic.CA1001.severity = error - -# CA1002: Do not expose generic lists -dotnet_diagnostic.CA1002.severity = error - -# CA1003: Use generic event handler instances -dotnet_diagnostic.CA1003.severity = warning - -# CA1005: Avoid excessive parameters on generic types -dotnet_diagnostic.CA1005.severity = warning - -# CA1008: Enums should have zero value -dotnet_diagnostic.CA1008.severity = warning - -# CA1010: Collections should implement generic interface -dotnet_diagnostic.CA1010.severity = warning - -# CA1012: Abstract types should not have public constructors -dotnet_diagnostic.CA1012.severity = error - -# CA1014: Mark assemblies with CLSCompliantAttribute -dotnet_diagnostic.CA1014.severity = none - -# CA1016: Mark assemblies with AssemblyVersionAttribute -dotnet_diagnostic.CA1016.severity = error - -# CA1017: Mark assemblies with ComVisibleAttribute -dotnet_diagnostic.CA1017.severity = silent - -# CA1018: Mark attributes with AttributeUsageAttribute -dotnet_diagnostic.CA1018.severity = suggestion - -# CA1019: Define accessors for attribute arguments -dotnet_diagnostic.CA1019.severity = suggestion - -# CA1021: Avoid out parameters -dotnet_diagnostic.CA1021.severity = suggestion - -# CA1024: Use properties where appropriate -dotnet_diagnostic.CA1024.severity = suggestion - -# CA1027: Mark enums with FlagsAttribute -dotnet_diagnostic.CA1027.severity = error - -# CA1028: Enum storage should be Int32 -dotnet_diagnostic.CA1028.severity = error - -# CA1030: Use events where appropriate -dotnet_diagnostic.CA1030.severity = suggestion - -# CA1031: Do not catch general exception types -# dotnet_diagnostic.CA1031.severity = error - -# CA1032: Implement standard exception constructors -dotnet_diagnostic.CA1032.severity = suggestion - -# CA1033: Interface methods should be callable by child types -dotnet_diagnostic.CA1033.severity = suggestion - -# CA1034: Nested types should not be visible -dotnet_diagnostic.CA1034.severity = error - -# CA1036: Override methods on comparable types -dotnet_diagnostic.CA1036.severity = suggestion - -# CA1040: Avoid empty interfaces -dotnet_diagnostic.CA1040.severity = suggestion - -# CA1041: Provide ObsoleteAttribute message -dotnet_diagnostic.CA1041.severity = warning - -# CA1043: Use integral or string argument for indexers -dotnet_diagnostic.CA1043.severity = suggestion - -# CA1044: Properties should not be write only -dotnet_diagnostic.CA1044.severity = error - -# CA1045: Do not pass types by reference -dotnet_diagnostic.CA1045.severity = warning - -# CA1046: Do not overload operator equals on reference types -dotnet_diagnostic.CA1046.severity = warning - -# CA1047: Do not declare protected members in sealed types -dotnet_diagnostic.CA1047.severity = error - -# CA1050: Declare types in namespaces -dotnet_diagnostic.CA1050.severity = warning - -# CA1051: Do not declare visible instance fields -dotnet_diagnostic.CA1051.severity = error - -# CA1052: Static holder types should be Static or NotInheritable -dotnet_diagnostic.CA1052.severity = warning - -# CA1053: Static holder types should not have default constructors -dotnet_diagnostic.CA1053.severity = warning - -# CA1054: URI parameters should not be strings -dotnet_diagnostic.CA1054.severity = warning - -# CA1055: URI return values should not be strings -dotnet_diagnostic.CA1055.severity = warning - -# CA1056: URI properties should not be strings -dotnet_diagnostic.CA1056.severity = warning - -# CA1058: Types should not extend certain base types -dotnet_diagnostic.CA1058.severity = warning - -# CA1060: Move P/Invokes to NativeMethods class -dotnet_diagnostic.CA1060.severity = warning - -# CA1061: Do not hide base class methods -dotnet_diagnostic.CA1061.severity = warning - -# CA1062: Validate arguments of public methods -dotnet_diagnostic.CA1062.severity = suggestion - -# CA1063: Implement IDisposable correctly -dotnet_diagnostic.CA1063.severity = error - -# CA1064: Exceptions should be public -dotnet_diagnostic.CA1064.severity = warning - -# CA1065: Do not raise exceptions in unexpected locations -dotnet_diagnostic.CA1065.severity = warning - -# CA1066: Implement IEquatable when overriding Equals -dotnet_diagnostic.CA1066.severity = warning - -# CA1067: Override Equals when implementing IEquatable -dotnet_diagnostic.CA1067.severity = warning - -# CA1068: CancellationToken parameters must come last -dotnet_diagnostic.CA1068.severity = warning - -# CA1069: Enums should not have duplicate values -dotnet_diagnostic.CA1069.severity = error - -# CA1070: Do not declare event fields as virtual -dotnet_diagnostic.CA1070.severity = warning - -#### Documentation Rules #### - -# CA1200: Avoid using cref tags with a prefix -dotnet_diagnostic.CA1200.severity = suggestion - -#### Globalization Rules #### - -# CA1303: Do not pass literals as localized parameters -dotnet_diagnostic.CA1303.severity = warning - -# CA1304: Specify CultureInfo -dotnet_diagnostic.CA1304.severity = error - -# CA1305: Specify IFormatProvider -dotnet_diagnostic.CA1305.severity = error - -# CA1307: Specify StringComparison for clarity -dotnet_diagnostic.CA1307.severity = error - -# CA1308: Normalize strings to uppercase -dotnet_diagnostic.CA1308.severity = warning - -# CA1309: Use ordinal StringComparison -dotnet_diagnostic.CA1309.severity = warning - -# CA1310: Specify StringComparison for correctness -dotnet_diagnostic.CA1310.severity = warning - -# CA1311: Specify a culture or use an invariant version -dotnet_diagnostic.CA1311.severity = warning - -# CA2101: Specify marshaling for P/Invoke string arguments -dotnet_diagnostic.CA2101.severity = warning - -#### SingleFile Rules #### - -# IL3000: Avoid using accessing Assembly file path when publishing as a single-file -dotnet_diagnostic.IL3000.severity = error - -# IL3001: Avoid using accessing Assembly file path when publishing as a single-file -dotnet_diagnostic.IL3001.severity = error - -# IL3002: Avoid calling members annotated with 'RequiresAssemblyFilesAttribute' when publishing as a single file. -dotnet_diagnostic.IL3002.severity = error - -# IL3003 'RequiresAssemblyFilesAttribute' annotations must match across all interface implementations or overrides. -dotnet_diagnostic.IL3003.severity = error - -#### Miscellaneous Rules #### - -#Remove invalid global 'SuppressMessageAttribute' (IDE0076) -dotnet_diagnostic.IDE0076.severity = suggestion - -#Avoid legacy format target in global 'SuppressMessageAttribute' (IDE0077) -dotnet_diagnostic.IDE0077.severity = suggestion - -#### StyleCop Rules #### - -#A violation of this rule occurs when a compilation (project) contains one or more files which are parsed with the DocumentationMode set to None. This most frequently occurs when the project is configured to not produce an XML documentation file during the build. -dotnet_diagnostic.SA0001.severity = warning - -# The spacing around a C# keyword is incorrect. -dotnet_diagnostic.SA1000.severity = warning - -# DoNotPrefixCallsWithBaseUnlessLocalImplementationExists -dotnet_diagnostic.SA1100.severity = warning - -# CommentsMustContainText -dotnet_diagnostic.SA1120.severity = warning - -# DoNotUseRegions -dotnet_diagnostic.SA1124.severity = warning - -# UsingDirectivesMustBePlacedCorrectly -dotnet_diagnostic.SA1200.severity = warning - -# ElementsMustAppearInTheCorrectOrder -dotnet_diagnostic.SA1201.severity = warning - -# ElementsMustBeOrderedByAccess -dotnet_diagnostic.SA1202.severity = warning - -# ConstantsMustAppearBeforeFields -dotnet_diagnostic.SA1202.severity = warning - -# ElementMustBeginWithUpperCaseLetter -dotnet_diagnostic.SA1300.severity = error - -# InterfaceNamesMustBeginWithI -dotnet_diagnostic.SA1302.severity = error - -# ConstFieldNamesMustBeginWithUpperCaseLetter -dotnet_diagnostic.SA1303.severity = error - -# FieldNamesMustNotUseHungarianNotation -dotnet_diagnostic.SA1305.severity = warning - -# VariableNamesMustNotBePrefixed -dotnet_diagnostic.SA1308.severity = error - -# A field name in C# begins with an underscore. -dotnet_diagnostic.SA1309.severity = warning - -# VariableNamesMustBeginWithLowerCaseLetter -dotnet_diagnostic.SA1312.severity = warning - -# ParameterNamesMustBeginWithLowerCaseLetter -dotnet_diagnostic.SA1313.severity = error - -# TupleElementNamesShouldUseCorrectCasing -dotnet_diagnostic.SA1316.severity = warning - -# A Code Analysis SuppressMessage attribute does not include a justification. -dotnet_diagnostic.SA1404.severity = error - -# BracesForMultiLineStatementsMustNotShareLine -dotnet_diagnostic.SA1500.severity = warning - -# ElementMustNotBeOnSingleLine -dotnet_diagnostic.SA1502.severity = warning - -# BracesMustNotBeOmitted -dotnet_diagnostic.SA1503.severity = warning - -# ClosingBraceMustBeFollowedByBlankLine -dotnet_diagnostic.SA1513.severity = warning - -# UseBracesConsistently -dotnet_diagnostic.SA1520.severity = warning - -# File header copyright text should match -dotnet_diagnostic.SA1636.severity = none - -# ElementDocumentationMustBeSpelledCorrectly -dotnet_diagnostic.SA1650.severity = warning - -# Do not return null -dotnet_diagnostic.RETURN0001.severity = warning - -#### Async Rules #### - -# Asynchronous method names should end with Async -dotnet_diagnostic.ASYNC0001.severity = error - -# Non asynchronous method names should end with Async -dotnet_diagnostic.ASYNC0002.severity = error - -# Avoid void returning asynchronous method -dotnet_diagnostic.ASYNC0003.severity = warning - -# Use ConfigureAwait(false) on await expression -dotnet_diagnostic.ASYNC0004.severity = error - -# Do not use blocking call (make method async) -dotnet_diagnostic.MA0045.severity = none - -# Call 'ConfigureAwait(false)'. -dotnet_diagnostic.RCS1090.severity = error - -# Return completed task instead of returning null -dotnet_diagnostic.RCS1210.severity = error - -# AsyncifyInvocation: Use Task Async -dotnet_diagnostic.AsyncifyInvocation.severity = error - -# AsyncifyVariable: Use Task Async -dotnet_diagnostic.AsyncifyVariable.severity = error - -# Use ConfigureAwait(bool) -dotnet_diagnostic.VSTHRD111.severity = error - -# Avoid returning a null Task -dotnet_diagnostic.VSTHRD114.severity = error - -# Use "Async" suffix for async methods -dotnet_diagnostic.VSTHRD200.severity = error - -# Asynchronous method name should end with 'Async'. -dotnet_diagnostic.RCS1046.severity = error - -# Use "Async" suffix for async methods -dotnet_diagnostic.VSTHRD200.severity = error - -# Non-asynchronous method name should not end with 'Async'. -dotnet_diagnostic.RCS1047.severity = error - -#### Class Rules #### - -# Seal Class -dotnet_diagnostic.CLASS0001.severity = warning - -#### Enum Rules #### - -# Default switch label -dotnet_diagnostic.ENUM0001.severity = error - -# Merge switch sections -dotnet_diagnostic.ENUM0002.severity = warning - -# Populate switch -dotnet_diagnostic.ENUM0003.severity = warning - -tab_width = 4 -dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion -dotnet_style_allow_statement_immediately_after_block_experimental = true:suggestion -dotnet_style_namespace_match_folder = true:suggestion - -# Prefer "var" everywhere (Implicit and explicit types) -csharp_style_var_elsewhere = true:warning -csharp_style_var_for_built_in_types = true:warning -csharp_style_var_when_type_is_apparent = true:warning - -# Modifier preferences -csharp_prefer_static_local_function = true:warning -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning -dotnet_style_readonly_field = true:warning -dotnet_style_require_accessibility_modifiers = always:warning -visual_basic_preferred_modifier_order = Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, Async:warning - -# Code-block preferences -csharp_prefer_braces = true:suggestion -csharp_prefer_simple_using_statement = false:silent - -# C# Style Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules -[*.{cs,csx,cake}] - -# Newline options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#new-line-options -csharp_new_line_before_catch = true -csharp_new_line_before_else = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_open_brace = all -csharp_new_line_between_query_expression_clauses = true - -# C# Unnecessary code rules -csharp_style_unused_value_assignment_preference = discard_variable:suggestion -csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion - -# Simplify name -dotnet_diagnostic.IDE0001.severity = warning - -# Simplify member access -dotnet_diagnostic.IDE0002.severity = silent - -# Remove unnecessary cast -dotnet_diagnostic.IDE0004.severity = warning - -# Remove unnecessary import -dotnet_diagnostic.IDE0005.severity = warning - -#Remove unreachable code -dotnet_diagnostic.IDE0035.severity = warning - -#Remove unused private member -dotnet_diagnostic.IDE0051.severity = suggestion - -#Remove unread private member -dotnet_diagnostic.IDE0052.severity = error - -# Remove unnecessary expression value -dotnet_diagnostic.IDE0058.severity = warning - -# Remove unnecessary value assignment -dotnet_diagnostic.IDE0059.severity = error - -# Remove unused parameter -dotnet_diagnostic.IDE0060.severity = error - -# Remove unnecessary suppression -dotnet_diagnostic.IDE0079.severity = error - -# Remove unnecessary suppression operator -dotnet_diagnostic.IDE0080.severity = suggestion - -# Remove ByVal -dotnet_diagnostic.IDE0081.severity = warning - -# Remove unnecessary equality operator -dotnet_diagnostic.IDE0100.severity = warning - -# Use conditional delegate call -dotnet_diagnostic.IDE0105.severity = warning - -# Remove unnecessary discard -dotnet_diagnostic.IDE0110.severity = suggestion - -# Simplify object creation -dotnet_diagnostic.IDE0140.severity = suggestion - -# Prefer 'null' check over type check -dotnet_diagnostic.IDE0150.severity = suggestion - -# Expression-level preferences -csharp_prefer_simple_default_expression = true:warning -csharp_style_deconstructed_variable_declaration = true:warning -csharp_style_implicit_object_creation_when_type_is_apparent = true:warning -csharp_style_inlined_variable_declaration = true:warning -csharp_style_pattern_local_over_anonymous_function = true:warning -csharp_style_prefer_index_operator = true:warning -csharp_style_prefer_range_operator = true:warning - -# 'using' directive preferences -csharp_using_directive_placement = outside_namespace:warning - -# Expression-Bodied members -csharp_style_expression_bodied_accessors = true:warning -csharp_style_expression_bodied_constructors = true:warning -csharp_style_expression_bodied_indexers = true:warning -csharp_style_expression_bodied_lambdas = true:warning -csharp_style_expression_bodied_local_functions = true:warning -csharp_style_expression_bodied_methods = true:warning -csharp_style_expression_bodied_operators = true:warning -csharp_style_expression_bodied_properties = true:warning - -# Pattern matching preferences -csharp_style_pattern_matching_over_as_with_null_check = true:warning -csharp_style_pattern_matching_over_is_with_cast_check = true:warning -csharp_style_prefer_not_pattern = true:warning -csharp_style_prefer_pattern_matching = true:warning -csharp_style_prefer_switch_expression = true:warning - -# "Null" checking preferences -csharp_style_conditional_delegate_call = true:warning -csharp_style_throw_expression = true:warning - -# Spacing options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#spacing-options -csharp_space_after_cast = false -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_after_comma = true -csharp_space_after_dot = false -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_after_semicolon_in_for_statement = true -csharp_space_around_binary_operators = before_and_after -csharp_space_around_declaration_statements = false -csharp_space_before_colon_in_inheritance_clause = true -csharp_space_before_comma = false -csharp_space_before_dot = false -csharp_space_before_open_square_brackets = false -csharp_space_before_semicolon_in_for_statement = false -csharp_space_between_empty_square_brackets = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_declaration_name_and_open_parenthesis = false -csharp_space_between_method_declaration_parameter_list_parentheses = false -csharp_space_between_parentheses = false -csharp_space_between_square_brackets = false - -# Wrap options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#wrap-options -csharp_preserve_single_line_blocks = true -csharp_preserve_single_line_statements = false - -#Indentation preferences -csharp_indent_block_contents = true -csharp_indent_braces = false -csharp_indent_case_contents = true -csharp_indent_case_contents_when_block = true -csharp_indent_labels = one_less_than_current -csharp_indent_switch_labels = true - -# Namespace options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#namespace-options -csharp_style_namespace_declarations = file_scoped:warning - -#Wrapping preferences -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent -csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent -csharp_style_prefer_extended_property_pattern = true:suggestion -csharp_style_prefer_local_over_anonymous_function = true:suggestion -csharp_style_prefer_method_group_conversion = true:silent -csharp_style_prefer_null_check_over_type_check = true:warning -csharp_style_prefer_parameter_null_checking = true:suggestion -csharp_style_prefer_top_level_statements = true:silent -csharp_style_prefer_tuple_swap = true:suggestion - -# Simplify boolean comparison. -dotnet_diagnostic.RCS1049.severity = silent - -dotnet_diagnostic.CS9035.severity = none #this should be warning or error - -# [src/{VisualStudio}/**/*.{cs,vb}] -visual_basic_style_prefer_simplified_object_creation = all : suggestion - -[*.g.cs] -# Missing XML comment for publicly visible type or member 'Type_or_Member' -dotnet_diagnostic.CS1591.severity = none \ No newline at end of file -- GitLab