diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 03efa87b..db21a0ae 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "csharpier": { - "version": "0.29.2", + "version": "0.30.1", "commands": [ "dotnet-csharpier" ] diff --git a/Src/CrispyWaffle/Cryptography/Security.cs b/Src/CrispyWaffle/Cryptography/Security.cs index 882ecee7..095e72dd 100644 --- a/Src/CrispyWaffle/Cryptography/Security.cs +++ b/Src/CrispyWaffle/Cryptography/Security.cs @@ -150,13 +150,12 @@ public static string Hash(string value, HashAlgorithmType type) /// /// The hash algorithms. /// - private static readonly Dictionary _hashAlgorithms = - new() - { - { HashAlgorithmType.Md5, MD5.Create() }, - { HashAlgorithmType.Sha1, SHA1.Create() }, - { HashAlgorithmType.Sha256, SHA256.Create() }, - { HashAlgorithmType.Sha384, SHA384.Create() }, - { HashAlgorithmType.Sha512, SHA512.Create() }, - }; + private static readonly Dictionary _hashAlgorithms = new() + { + { HashAlgorithmType.Md5, MD5.Create() }, + { HashAlgorithmType.Sha1, SHA1.Create() }, + { HashAlgorithmType.Sha256, SHA256.Create() }, + { HashAlgorithmType.Sha384, SHA384.Create() }, + { HashAlgorithmType.Sha512, SHA512.Create() }, + }; } diff --git a/Src/CrispyWaffle/Scheduler/CronSchedulerValidations.cs b/Src/CrispyWaffle/Scheduler/CronSchedulerValidations.cs index bdcff084..c05c8893 100644 --- a/Src/CrispyWaffle/Scheduler/CronSchedulerValidations.cs +++ b/Src/CrispyWaffle/Scheduler/CronSchedulerValidations.cs @@ -13,38 +13,49 @@ public static class CronSchedulerValidations /// A regular expression that matches cron syntax with the division operator (e.g., "*/5"). /// This expression is used to match fields that represent intervals (e.g., every 5th minute). /// - public static readonly Regex DividedRegex = - new(@"(\*/\d+)", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + public static readonly Regex DividedRegex = new( + @"(\*/\d+)", + RegexOptions.Compiled, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression that matches cron syntax with a range and optional divisor (e.g., "1-5/2"). /// This expression is used to match fields with ranges (e.g., from 1 to 5) and optionally a step value (e.g., every second value). /// - public static readonly Regex RangeRegex = - new(@"(\d+\-\d+)\/?(\d+)?", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + public static readonly Regex RangeRegex = new( + @"(\d+\-\d+)\/?(\d+)?", + RegexOptions.Compiled, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression that matches the wildcard character (*) in cron expressions. /// The wildcard is used to match all values in a field (e.g., every minute, every day of the month). /// - public static readonly Regex WildRegex = - new(@"(\*)", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + public static readonly Regex WildRegex = new( + @"(\*)", + RegexOptions.Compiled, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression that matches lists of values separated by commas (e.g., "1,5,10"). /// This expression is used to match fields that specify multiple discrete values. /// - public static readonly Regex ListRegex = - new(@"(((\d+,)*\d+)+)", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + public static readonly Regex ListRegex = new( + @"(((\d+,)*\d+)+)", + RegexOptions.Compiled, + TimeSpan.FromSeconds(5) + ); /// /// A combined validation regular expression that can match any of the individual cron syntax features. /// This includes division, ranges, wildcards, and lists, and is used to validate entire cron expressions. /// - public static readonly Regex ValidationRegex = - new( - DividedRegex + "|" + RangeRegex + "|" + WildRegex + "|" + ListRegex, - RegexOptions.Compiled, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex ValidationRegex = new( + DividedRegex + "|" + RangeRegex + "|" + WildRegex + "|" + ListRegex, + RegexOptions.Compiled, + TimeSpan.FromSeconds(5) + ); } diff --git a/Src/CrispyWaffle/TemplateRendering/Engines/MustachePatterns.cs b/Src/CrispyWaffle/TemplateRendering/Engines/MustachePatterns.cs index afff02ec..a325a0e5 100644 --- a/Src/CrispyWaffle/TemplateRendering/Engines/MustachePatterns.cs +++ b/Src/CrispyWaffle/TemplateRendering/Engines/MustachePatterns.cs @@ -15,15 +15,14 @@ internal static class MustachePatterns /// /// This pattern captures the property being iterated over and the content inside the loop. /// - public static readonly Regex LoopPattern = - new( - @"{{\#each (?.+?)}}(?.+?){{/each}}", - RegexOptions.Compiled - | RegexOptions.CultureInvariant - | RegexOptions.IgnoreCase - | RegexOptions.Singleline, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex LoopPattern = new( + @"{{\#each (?.+?)}}(?.+?){{/each}}", + RegexOptions.Compiled + | RegexOptions.CultureInvariant + | RegexOptions.IgnoreCase + | RegexOptions.Singleline, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression pattern that matches a "with" construct (e.g., {{#with property}}...{{/with}}) in a Mustache template. @@ -31,15 +30,14 @@ internal static class MustachePatterns /// /// This pattern captures the property being used and the content inside the "with" block. /// - public static readonly Regex WithPattern = - new( - @"{{\#with (?.+?)}}(?.+?){{/with}}", - RegexOptions.Compiled - | RegexOptions.CultureInvariant - | RegexOptions.IgnoreCase - | RegexOptions.Singleline, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex WithPattern = new( + @"{{\#with (?.+?)}}(?.+?){{/with}}", + RegexOptions.Compiled + | RegexOptions.CultureInvariant + | RegexOptions.IgnoreCase + | RegexOptions.Singleline, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression pattern that matches a conditional block (e.g., {{#condition}}...{{/condition}}) in a Mustache template. @@ -48,15 +46,14 @@ internal static class MustachePatterns /// /// This pattern captures the condition being evaluated, the content for the "true" case, and optionally, the content for the "else" case. /// - public static readonly Regex ConditionalPattern = - new( - @"{{\#(?.+?)}}(?.+?)(?:{{\#else}}(?.+?))?{{/\1}}", - RegexOptions.Compiled - | RegexOptions.CultureInvariant - | RegexOptions.IgnoreCase - | RegexOptions.Singleline, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex ConditionalPattern = new( + @"{{\#(?.+?)}}(?.+?)(?:{{\#else}}(?.+?))?{{/\1}}", + RegexOptions.Compiled + | RegexOptions.CultureInvariant + | RegexOptions.IgnoreCase + | RegexOptions.Singleline, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression pattern that matches a simple property reference (e.g., {{property}}) in a Mustache template. @@ -64,12 +61,11 @@ internal static class MustachePatterns /// /// This pattern captures the name of the property to be replaced in the template. /// - public static readonly Regex PropertyPattern = - new( - "{{(?.+?)}}", - RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex PropertyPattern = new( + "{{(?.+?)}}", + RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression pattern that matches the "this" reference (e.g., {{this}}) in a Mustache template. @@ -78,12 +74,11 @@ internal static class MustachePatterns /// /// This pattern is used specifically in loops to refer to the current item in context. /// - public static readonly Regex LoopPropertyPattern = - new( - "{{this}}", - RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex LoopPropertyPattern = new( + "{{this}}", + RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// A regular expression pattern that matches an import statement (e.g., {{>import file="filename"}}) in a Mustache template. @@ -91,10 +86,9 @@ internal static class MustachePatterns /// /// This pattern captures key-value pairs in the import statement, specifically looking for "file" or "type" attributes. /// - public static readonly Regex ImportPattern = - new( - "{{>import (?(?file|type)=\"(?.+?)\"\\s?){2}}}", - RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex ImportPattern = new( + "{{>import (?(?file|type)=\"(?.+?)\"\\s?){2}}}", + RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); } diff --git a/Src/CrispyWaffle/Validations/StringValidations.cs b/Src/CrispyWaffle/Validations/StringValidations.cs index 7d259dfa..fbfb04f4 100644 --- a/Src/CrispyWaffle/Validations/StringValidations.cs +++ b/Src/CrispyWaffle/Validations/StringValidations.cs @@ -19,70 +19,63 @@ public static class StringValidations /// /// The Portuguese preposition pattern. /// - public static readonly Regex PortuguesePrepositionPattern = - new( - "^(da|de|do|das|dos|no|na|nos|nas|-|etapa)$", - RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex PortuguesePrepositionPattern = new( + "^(da|de|do|das|dos|no|na|nos|nas|-|etapa)$", + RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// The parentheses pattern (matches any content inside parentheses). /// - public static readonly Regex ParenthesesPattern = - new( - @"\((.+?)\)", - RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex ParenthesesPattern = new( + @"\((.+?)\)", + RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// The non-alphanumeric pattern (matches characters that are not letters, digits, or .@-). /// - public static readonly Regex NonAlphanumericPattern = - new( - @"[^\w\.@-]", - RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex NonAlphanumericPattern = new( + @"[^\w\.@-]", + RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// The non-numeric pattern (matches any character that is not a digit). /// - public static readonly Regex NonNumericPattern = - new( - "[^0-9]", - RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex NonNumericPattern = new( + "[^0-9]", + RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// The spaces pattern (matches any space character). /// - public static readonly Regex SpacesPattern = - new( - @"\s+", - RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex SpacesPattern = new( + @"\s+", + RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// The multiple spaces pattern (matches sequences of two or more spaces or tabs). /// - public static readonly Regex MultipleSpacesPattern = - new( - @"[\t|\s]{2,}", - RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex MultipleSpacesPattern = new( + @"[\t|\s]{2,}", + RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); /// /// The invalid file name pattern (matches invalid file name characters). /// - public static readonly Regex InvalidFileName = - new( - $@"([{_invalidPathChars}]*\.+$)|([{_invalidPathChars}]+)", - RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, - TimeSpan.FromSeconds(5) - ); + public static readonly Regex InvalidFileName = new( + $@"([{_invalidPathChars}]*\.+$)|([{_invalidPathChars}]+)", + RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, + TimeSpan.FromSeconds(5) + ); }