diff --git a/src/Cake.Issues.InspectCode/InspectCodeIssuesProvider.cs b/src/Cake.Issues.InspectCode/InspectCodeIssuesProvider.cs
index 6cfc89cc7..da176fbd1 100644
--- a/src/Cake.Issues.InspectCode/InspectCodeIssuesProvider.cs
+++ b/src/Cake.Issues.InspectCode/InspectCodeIssuesProvider.cs
@@ -241,7 +241,7 @@ private static IssuePriority GetPriority(string severity) =>
///
/// Description of an issue type.
///
- private class IssueType
+ private sealed class IssueType
{
///
/// Gets the description of the issue.
diff --git a/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliJsonLogFileFormat.cs b/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliJsonLogFileFormat.cs
index 414420ef7..554c359b4 100644
--- a/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliJsonLogFileFormat.cs
+++ b/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliJsonLogFileFormat.cs
@@ -102,7 +102,7 @@ private static string GetFilePath(
#pragma warning disable CS0649 // Field 'field' is never assigned to, and will always have its default value 'value'
[DataContract]
- private class LogFileEntry
+ private sealed class LogFileEntry
{
[DataMember]
public string fileName;
diff --git a/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliLogFileFormat.cs b/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliLogFileFormat.cs
index f9f04ad13..720e6618f 100644
--- a/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliLogFileFormat.cs
+++ b/src/Cake.Issues.Markdownlint/LogFileFormat/MarkdownlintCliLogFileFormat.cs
@@ -10,7 +10,7 @@
/// Logfile format as written by markdownlint-cli.
///
/// The Cake log instance.
-internal class MarkdownlintCliLogFileFormat(ICakeLog log)
+internal partial class MarkdownlintCliLogFileFormat(ICakeLog log)
: BaseMarkdownlintLogFileFormat(log)
{
private static readonly string[] Separator = ["\r\n", "\r", "\n"];
@@ -25,9 +25,9 @@ public override IEnumerable ReadIssues(
repositorySettings.NotNull();
markdownlintIssuesSettings.NotNull();
- var regex = new Regex(@"(?.*[^:\d+]): ?(?\d+):?(?\d+)? (?MD\d+)/(?(?:\w*-*/*)*) (?.*)");
+ var regex = LineParsingRegEx();
- foreach (var line in markdownlintIssuesSettings.LogFileContent.ToStringUsingEncoding().Split(Separator, StringSplitOptions.None).ToList().Where(s => !string.IsNullOrEmpty(s)))
+ foreach (var line in markdownlintIssuesSettings.LogFileContent.ToStringUsingEncoding().Split(Separator, StringSplitOptions.None).Where(s => !string.IsNullOrEmpty(s)))
{
var groups = regex.Match(line).Groups;
@@ -57,6 +57,9 @@ public override IEnumerable ReadIssues(
}
}
+ [GeneratedRegex(@"(?.*[^:\d+]): ?(?\d+):?(?\d+)? (?MD\d+)/(?(?:\w*-*/*)*) (?.*)")]
+ private static partial Regex LineParsingRegEx();
+
///
/// Reads the affected file path from a parsed entry.
///
diff --git a/src/Cake.Issues.Markdownlint/MarkdownlintRuleUrlResolver.cs b/src/Cake.Issues.Markdownlint/MarkdownlintRuleUrlResolver.cs
index c6bbc3a03..bd508830d 100644
--- a/src/Cake.Issues.Markdownlint/MarkdownlintRuleUrlResolver.cs
+++ b/src/Cake.Issues.Markdownlint/MarkdownlintRuleUrlResolver.cs
@@ -6,7 +6,7 @@
///
/// Class for retrieving a URL linking to a site describing a rule.
///
-internal class MarkdownlintRuleUrlResolver : BaseRuleUrlResolver
+internal partial class MarkdownlintRuleUrlResolver : BaseRuleUrlResolver
{
private static readonly Lazy InstanceValue =
new(() => new MarkdownlintRuleUrlResolver());
@@ -28,7 +28,7 @@ internal MarkdownlintRuleUrlResolver()
///
protected override bool TryGetRuleDescription(string rule, MarkdownlintRuleDescription ruleDescription)
{
- var regex = new Regex(@"^MD(\d*)$");
+ var regex = RuleDescriptionRegEx();
var match = regex.Match(rule);
if (!match.Success)
@@ -52,4 +52,7 @@ protected override bool TryGetRuleDescription(string rule, MarkdownlintRuleDescr
return true;
}
+
+ [GeneratedRegex(@"^MD(\d*)$")]
+ private static partial Regex RuleDescriptionRegEx();
}
\ No newline at end of file
diff --git a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs
index ef3b401fa..b5f35ed23 100644
--- a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs
+++ b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs
@@ -34,13 +34,15 @@ public void Should_Throw_If_Settings_Are_Null()
public sealed class TheInternalCreateReportMethod
{
public static IEnumerable