diff --git a/Documentation/Synergy.Documentation/Api/ApiDescription.cs b/Documentation/Synergy.Documentation/Api/ApiDescription.cs index a03b460..bb834f1 100644 --- a/Documentation/Synergy.Documentation/Api/ApiDescription.cs +++ b/Documentation/Synergy.Documentation/Api/ApiDescription.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; -using JetBrains.Annotations; using Synergy.Catalogue; using Synergy.Catalogue.Reflection; @@ -179,11 +178,9 @@ private static string GetPropertyName(PropertyInfo property) private static bool IsStatic(this PropertyInfo source, bool nonPublic = false) => source.GetAccessors(nonPublic).Any(x => x.IsStatic); - [Pure] private static bool In(this T value, params T[] values) => values.Contains(value); - [Pure] private static bool NotIn(this T value, params T[] values) => value.In(values) == false; diff --git a/Documentation/Synergy.Documentation/Code/CodeFile.cs b/Documentation/Synergy.Documentation/Code/CodeFile.cs index 1302677..62b3dc1 100644 --- a/Documentation/Synergy.Documentation/Code/CodeFile.cs +++ b/Documentation/Synergy.Documentation/Code/CodeFile.cs @@ -1,5 +1,4 @@ using System.Runtime.CompilerServices; -using Synergy.Contracts; namespace Synergy.Documentation.Code; @@ -17,7 +16,7 @@ public static CodeFolder Current([CallerFilePath] string path = "") public CodeFile(string filePath) { - FilePath = filePath.OrFailIfWhiteSpace(nameof(filePath)); + FilePath = filePath; } public CodeFolder Folder diff --git a/Documentation/Synergy.Documentation/Markup/Markdown.cs b/Documentation/Synergy.Documentation/Markup/Markdown.cs index f711f5a..71295a8 100644 --- a/Documentation/Synergy.Documentation/Markup/Markdown.cs +++ b/Documentation/Synergy.Documentation/Markup/Markdown.cs @@ -1,11 +1,8 @@ using System.Collections; using System.Text; using Synergy.Catalogue; -using Synergy.Contracts; using Synergy.Documentation.Code; -// TODO: Marcin Celej [from: Marcin Celej on: 21-05-2023]: Stop referencing Synergy.Contracts from Synergy.Documentation - namespace Synergy.Documentation.Markup { #if INTERNAL_MARKDOWN @@ -28,14 +25,12 @@ public class Document : IEnumerable public Document Append(IElement element) { - Fail.IfArgumentNull(element, nameof(element)); this.elements.Add(element); return this; } public Document Append(IEnumerable newElements) { - Fail.IfArgumentNull(newElements, nameof(newElements)); this.elements.AddRange(newElements); return this; } @@ -71,8 +66,7 @@ public abstract class Header : IElement protected Header(int level, string header) { this.level = level; - this.header = header.OrFail(nameof(header)) - .Trim(); + this.header = header.Trim(); } public override string ToString() => $"{new string('#', this.level)} {this.header}{Markdown.NL}"; @@ -116,8 +110,6 @@ public Code(string? text = null, string? language = "csharp") public Code Line(string line) { - Fail.IfNull(line, nameof(line)); - if (this.text == null) return new Code(line, this.language); return new Code(this.text + Markdown.NL + line, this.language); @@ -137,12 +129,10 @@ public class Paragraph : IElement private readonly string text; public Paragraph(string text) - => this.text = text.OrFail(nameof(text)) - .Trim(); + => this.text = text.Trim(); public Paragraph Line(string line) { - Fail.IfArgumentWhiteSpace(line, nameof(line)); return new Paragraph(this.text + Markdown.NL + line); } @@ -164,15 +154,13 @@ public Quote(string? text) this.lines = new List() { - text.OrFail(nameof(text)) - .Trim() + text.Trim() }; } public Quote Line(string line) { - this.lines.Add(line.OrFail(nameof(line)) - .Trim()); + this.lines.Add(line.Trim()); return this; } diff --git a/Documentation/Synergy.Documentation/Synergy.Documentation.csproj b/Documentation/Synergy.Documentation/Synergy.Documentation.csproj index 32b228b..a98d588 100644 --- a/Documentation/Synergy.Documentation/Synergy.Documentation.csproj +++ b/Documentation/Synergy.Documentation/Synergy.Documentation.csproj @@ -47,9 +47,4 @@ - - - - - diff --git a/Synergy.Catalogue/Extensions/EnumerableExtensions.cs b/Synergy.Catalogue/Extensions/EnumerableExtensions.cs index fdd6576..a5c05e4 100644 --- a/Synergy.Catalogue/Extensions/EnumerableExtensions.cs +++ b/Synergy.Catalogue/Extensions/EnumerableExtensions.cs @@ -1,6 +1,5 @@ using System.Collections; using System.Collections.ObjectModel; -using Synergy.Contracts; namespace Synergy.Catalogue { @@ -12,10 +11,10 @@ namespace Synergy.Catalogue static class EnumerableExtensions { public static bool IsEmpty(IEnumerable collection) - => collection.OrFail(nameof(collection)).Any() == false; + => collection.Any() == false; public static bool IsNotEmpty(IEnumerable collection) - => collection.OrFail(nameof(collection)).Any(); + => collection.Any(); public static bool In(this T value, params T[] values) => values.Contains(value); @@ -45,8 +44,8 @@ public static List ToList(this IEnumerable collection, int expectedCapa } public static List ConvertAll(this IEnumerable source, Func converter) - => source.OrFail(nameof(source)) - .Select(converter.OrFail(nameof(converter))) + => source + .Select(converter) .ToList(source.ExpectedCapacity()); private static int ExpectedCapacity(this IEnumerable source)