From 39252c36eec75e4ecb045f559f6e7e8e87cebaf9 Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Tue, 10 Aug 2021 15:06:26 +0100 Subject: [PATCH 1/6] Update .editorconfig from 2.1.0 to 3.0.0 --- .editorconfig | 13 ++++++++----- .../Properties/AssemblyInfo.cs | 3 +++ Directory.Build.props | 1 + Source/Common/ValuesJsonConverter.cs | 2 +- .../Schema.NET.Pending/Properties/AssemblyInfo.cs | 3 +++ Source/Schema.NET/Properties/AssemblyInfo.cs | 3 +++ Tools/Schema.NET.Tool/SchemaSourceGenerator.cs | 1 - Tools/Schema.NET.Tool/Services/SchemaService.cs | 2 +- Tools/Schema.NET.Updater/Program.cs | 2 +- Tools/Schema.NET.Updater/Properties/AssemblyInfo.cs | 3 +++ 10 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 Benchmarks/Schema.NET.Benchmarks/Properties/AssemblyInfo.cs create mode 100644 Source/Schema.NET.Pending/Properties/AssemblyInfo.cs create mode 100644 Source/Schema.NET/Properties/AssemblyInfo.cs create mode 100644 Tools/Schema.NET.Updater/Properties/AssemblyInfo.cs diff --git a/.editorconfig b/.editorconfig index 652ed7c2..35621d51 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ -# Version: 2.1.0 (Using https://semver.org/) -# Updated: 2021-03-03 +# Version: 3.0.0 (Using https://semver.org/) +# Updated: 2021-08-09 # See https://github.com/RehanSaeed/EditorConfig/releases for release notes. # See https://github.com/RehanSaeed/EditorConfig for updates to this file. # See http://EditorConfig.org for more information about .editorconfig files. @@ -48,7 +48,7 @@ indent_size = 2 trim_trailing_whitespace = false # Web Files -[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,svg,vue}] +[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,pcss,svg,vue}] indent_size = 2 # Batch Files @@ -97,7 +97,7 @@ dotnet_style_readonly_field = true:warning dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning # Expression-level preferences dotnet_style_object_initializer = true:warning dotnet_style_collection_initializer = true:warning @@ -121,7 +121,10 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning # If you use StyleCop, you'll need to disable SA1636: File header copyright text should match. # dotnet_diagnostic.SA1636.severity = none # Undocumented -dotnet_style_operator_placement_when_wrapping = end_of_line +dotnet_style_operator_placement_when_wrapping = end_of_line:warning +csharp_style_prefer_null_check_over_type_check = true:warning +dotnet_style_namespace_match_folder = true:suggestion +dotnet_diagnostic.IDE0130.severity = suggestion # C# Style Rules # https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules diff --git a/Benchmarks/Schema.NET.Benchmarks/Properties/AssemblyInfo.cs b/Benchmarks/Schema.NET.Benchmarks/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0270020d --- /dev/null +++ b/Benchmarks/Schema.NET.Benchmarks/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System; + +[assembly: CLSCompliant(true)] diff --git a/Directory.Build.props b/Directory.Build.props index 0213f32c..3d74e83d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,6 +3,7 @@ latest true + Default latest en-GB enable diff --git a/Source/Common/ValuesJsonConverter.cs b/Source/Common/ValuesJsonConverter.cs index 5354ba3e..9984039b 100644 --- a/Source/Common/ValuesJsonConverter.cs +++ b/Source/Common/ValuesJsonConverter.cs @@ -415,7 +415,7 @@ private static bool TryGetConcreteType( if (localType is not null && ThingInterfaceTypeInfo.IsAssignableFrom(localType.GetTypeInfo())) { type = localType; - return type is not null; + return true; } else { diff --git a/Source/Schema.NET.Pending/Properties/AssemblyInfo.cs b/Source/Schema.NET.Pending/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0270020d --- /dev/null +++ b/Source/Schema.NET.Pending/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System; + +[assembly: CLSCompliant(true)] diff --git a/Source/Schema.NET/Properties/AssemblyInfo.cs b/Source/Schema.NET/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0270020d --- /dev/null +++ b/Source/Schema.NET/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System; + +[assembly: CLSCompliant(true)] diff --git a/Tools/Schema.NET.Tool/SchemaSourceGenerator.cs b/Tools/Schema.NET.Tool/SchemaSourceGenerator.cs index eacbb9f6..7bc263b2 100644 --- a/Tools/Schema.NET.Tool/SchemaSourceGenerator.cs +++ b/Tools/Schema.NET.Tool/SchemaSourceGenerator.cs @@ -1,7 +1,6 @@ namespace Schema.NET.Tool { using System; - using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.CodeAnalysis; diff --git a/Tools/Schema.NET.Tool/Services/SchemaService.cs b/Tools/Schema.NET.Tool/Services/SchemaService.cs index 02b5f66d..40938819 100644 --- a/Tools/Schema.NET.Tool/Services/SchemaService.cs +++ b/Tools/Schema.NET.Tool/Services/SchemaService.cs @@ -220,7 +220,7 @@ private static GeneratorSchemaClass TranslateClass( HashSet knownSchemaClasses, bool includePending) { - var className = StartsWithNumber.IsMatch(schemaClass.Label) ? $"_{schemaClass.Label}" : schemaClass.Label; + var className = StartsWithNumber.IsMatch(schemaClass.Label) ? $"Type{schemaClass.Label}" : schemaClass.Label; var @class = new GeneratorSchemaClass(schemaClass.Layer, schemaClass.Id, className, schemaClass.Comment); @class.Parents.AddRange(schemaClass.SubClassOfIds diff --git a/Tools/Schema.NET.Updater/Program.cs b/Tools/Schema.NET.Updater/Program.cs index eea3114b..4f5af178 100644 --- a/Tools/Schema.NET.Updater/Program.cs +++ b/Tools/Schema.NET.Updater/Program.cs @@ -17,7 +17,7 @@ private static async Task Main() { Console.WriteLine("Downloading '{0}'...", SchemaJsonSourceUrl); using var httpClient = new HttpClient(); - using var stream = await httpClient.GetStreamAsync(SchemaJsonSourceUrl).ConfigureAwait(true); + using var stream = await httpClient.GetStreamAsync(new Uri(SchemaJsonSourceUrl)).ConfigureAwait(true); Console.WriteLine("Saving to '{0}'...", SchemaJsonDestinationFilePath); using var fileStream = File.Open(SchemaJsonDestinationFilePath, FileMode.Create); await stream.CopyToAsync(fileStream).ConfigureAwait(true); diff --git a/Tools/Schema.NET.Updater/Properties/AssemblyInfo.cs b/Tools/Schema.NET.Updater/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0270020d --- /dev/null +++ b/Tools/Schema.NET.Updater/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System; + +[assembly: CLSCompliant(true)] From 07f829e52a3b93660875c6762fda8d6ac97b9562 Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Tue, 10 Aug 2021 15:54:48 +0100 Subject: [PATCH 2/6] Set AnalysisMode to AllEnabledByDefault --- Directory.Build.props | 2 +- Source/Common/ContextJsonConverter.cs | 7 +++++ Source/Common/EnumHelper.cs | 2 ++ Source/Common/OneOrMany{T}.cs | 4 +++ Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs | 30 +++++++++++++++++++ Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs | 26 ++++++++++++++++ Source/Common/Values{T1,T2,T3,T4}.cs | 18 +++++++++++ Source/Common/Values{T1,T2,T3}.cs | 14 +++++++++ Source/Common/Values{T1,T2}.cs | 10 +++++++ Tests/.editorconfig | 5 ++++ Tools/.editorconfig | 10 +++++++ Tools/Schema.NET.Tool/CollectionExtensions.cs | 26 ++++++++++++++++ .../GeneratorModels/GeneratorSchemaClass.cs | 8 ++--- .../GeneratorSchemaEnumeration.cs | 2 +- .../GeneratorSchemaProperty.cs | 2 +- .../GeneratorSchemaPropertyType.cs | 2 +- Tools/Schema.NET.Tool/Models/SchemaClass.cs | 4 +-- Tools/Schema.NET.Tool/Models/SchemaObject.cs | 4 +-- .../Schema.NET.Tool/Models/SchemaProperty.cs | 4 +-- .../Schema.NET.Tool/Models/SchemaTreeClass.cs | 2 +- Tools/Schema.NET.Tool/SourceUtility.cs | 10 +++++++ Tools/Schema.NET.Updater/Program.cs | 2 ++ 22 files changed, 179 insertions(+), 15 deletions(-) create mode 100644 Tools/Schema.NET.Tool/CollectionExtensions.cs diff --git a/Directory.Build.props b/Directory.Build.props index 3d74e83d..97bba90f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ latest true - Default + AllEnabledByDefault latest en-GB enable diff --git a/Source/Common/ContextJsonConverter.cs b/Source/Common/ContextJsonConverter.cs index 8827ed2c..d18e4cfb 100644 --- a/Source/Common/ContextJsonConverter.cs +++ b/Source/Common/ContextJsonConverter.cs @@ -23,6 +23,11 @@ public override JsonLdContext ReadJson(JsonReader reader, Type objectType, JsonL throw new ArgumentNullException(nameof(objectType)); } + if (hasExistingValue && existingValue is null) + { + throw new ArgumentNullException(nameof(existingValue)); + } + if (serializer is null) { throw new ArgumentNullException(nameof(serializer)); @@ -48,8 +53,10 @@ public override JsonLdContext ReadJson(JsonReader reader, Type objectType, JsonL language = languageProperty?.Value?.ToString(); } +#pragma warning disable CA1062 // Validate arguments of public methods context.Name = name; context.Language = language; +#pragma warning restore CA1062 // Validate arguments of public methods return context; } diff --git a/Source/Common/EnumHelper.cs b/Source/Common/EnumHelper.cs index 384d2696..f0e1429c 100644 --- a/Source/Common/EnumHelper.cs +++ b/Source/Common/EnumHelper.cs @@ -30,7 +30,9 @@ public static bool TryParse( result = Enum.Parse(enumType, value); return true; } +#pragma warning disable CA1031 // Do not catch general exception types catch +#pragma warning restore CA1031 // Do not catch general exception types { result = null; return false; diff --git a/Source/Common/OneOrMany{T}.cs b/Source/Common/OneOrMany{T}.cs index e9d8b14c..26f3cb92 100644 --- a/Source/Common/OneOrMany{T}.cs +++ b/Source/Common/OneOrMany{T}.cs @@ -160,7 +160,9 @@ public OneOrMany(IEnumerable collection) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator OneOrMany(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -193,7 +195,9 @@ public OneOrMany(IEnumerable collection) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(OneOrMany oneOrMany) => oneOrMany.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// diff --git a/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs b/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs index 97206cef..a603f85d 100644 --- a/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs +++ b/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs @@ -494,7 +494,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -503,7 +505,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -512,7 +516,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -521,7 +527,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -530,7 +538,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -539,7 +549,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -548,7 +560,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -566,7 +580,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -665,7 +681,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -687,7 +705,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -709,7 +729,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -731,7 +753,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value4.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -753,7 +777,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value5.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -775,7 +801,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value6.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -797,7 +825,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value7.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// diff --git a/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs b/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs index 7656a5e0..fb249c72 100644 --- a/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs +++ b/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs @@ -418,7 +418,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -427,7 +429,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -436,7 +440,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -445,7 +451,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -454,7 +462,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -463,7 +473,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -481,7 +493,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -569,7 +583,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -591,7 +607,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -613,7 +631,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -635,7 +655,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value4.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -657,7 +679,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value5.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -679,7 +703,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value6.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// diff --git a/Source/Common/Values{T1,T2,T3,T4}.cs b/Source/Common/Values{T1,T2,T3,T4}.cs index b2af1fc5..b5c12f75 100644 --- a/Source/Common/Values{T1,T2,T3,T4}.cs +++ b/Source/Common/Values{T1,T2,T3,T4}.cs @@ -284,7 +284,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -293,7 +295,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -302,7 +306,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -311,7 +317,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -329,7 +337,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -395,7 +405,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -417,7 +429,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -439,7 +453,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -461,7 +477,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value4.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// diff --git a/Source/Common/Values{T1,T2,T3}.cs b/Source/Common/Values{T1,T2,T3}.cs index 44fa01fd..6f90a31f 100644 --- a/Source/Common/Values{T1,T2,T3}.cs +++ b/Source/Common/Values{T1,T2,T3}.cs @@ -222,7 +222,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -231,7 +233,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -240,7 +244,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -258,7 +264,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -313,7 +321,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -335,7 +345,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -357,7 +369,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// diff --git a/Source/Common/Values{T1,T2}.cs b/Source/Common/Values{T1,T2}.cs index 251c608a..6b6e1c3b 100644 --- a/Source/Common/Values{T1,T2}.cs +++ b/Source/Common/Values{T1,T2}.cs @@ -163,7 +163,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -172,7 +174,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -190,7 +194,9 @@ public Values(IEnumerable items) /// The list of values. /// The result of the conversion. #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -234,7 +240,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// @@ -256,7 +264,9 @@ public Values(IEnumerable items) /// The result of the conversion. /// #pragma warning disable CA2225 // Operator overloads have named alternates +#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); +#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates /// diff --git a/Tests/.editorconfig b/Tests/.editorconfig index e0c0be7d..c5b5bf78 100644 --- a/Tests/.editorconfig +++ b/Tests/.editorconfig @@ -34,6 +34,11 @@ dotnet_diagnostic.SA1633.severity = none ########################################## [*.cs] +# CA1014: Mark assemblies with CLSCompliant. +# Justification: Not needed here +# https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1014 +dotnet_diagnostic.CA1014.severity = none + # CA1062: Validate arguments of public methods # Justification: xUnit Theory method parameters don't need to be validated # https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1062 diff --git a/Tools/.editorconfig b/Tools/.editorconfig index 27d5df69..6b78fba2 100644 --- a/Tools/.editorconfig +++ b/Tools/.editorconfig @@ -28,3 +28,13 @@ dotnet_diagnostic.SA1602.severity = none # Justification: Comments turned off # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1633.md dotnet_diagnostic.SA1633.severity = none + +########################################## +# StyleCop +########################################## + +[*.cs] +# CA1014: Mark assemblies with CLSCompliant. +# Justification: Not needed here +# https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1014 +dotnet_diagnostic.CA1014.severity = none diff --git a/Tools/Schema.NET.Tool/CollectionExtensions.cs b/Tools/Schema.NET.Tool/CollectionExtensions.cs new file mode 100644 index 00000000..845929c4 --- /dev/null +++ b/Tools/Schema.NET.Tool/CollectionExtensions.cs @@ -0,0 +1,26 @@ +namespace Schema.NET.Tool +{ + using System; + using System.Collections.Generic; + + public static class CollectionExtensions + { + public static void AddRange(this ICollection collection, IEnumerable items) + { + if (collection is null) + { + throw new ArgumentNullException(nameof(collection)); + } + + if (items is null) + { + throw new ArgumentNullException(nameof(items)); + } + + foreach (var item in items) + { + collection.Add(item); + } + } + } +} diff --git a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaClass.cs b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaClass.cs index ce179151..116653b0 100644 --- a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaClass.cs +++ b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaClass.cs @@ -25,9 +25,9 @@ public GeneratorSchemaClass(string layer, Uri id, string name, string descriptio .Traverse(this, x => x.Parents) .Where(x => x != this); - public List Children { get; } = new List(); + public ICollection Children { get; } = new List(); - public List CombinationOf { get; } = new List(); + public ICollection CombinationOf { get; } = new List(); public IEnumerable Descendants => EnumerableExtensions .Traverse(this, x => x.Children) @@ -64,8 +64,8 @@ public IEnumerable DeclaredProperties public bool IsThingType => string.Equals(this.Name, "Thing", StringComparison.Ordinal); - public List Parents { get; } = new List(); + public ICollection Parents { get; } = new List(); - public List Properties { get; } = new List(); + public ICollection Properties { get; } = new List(); } } diff --git a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaEnumeration.cs b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaEnumeration.cs index a16ddee6..e5c9e710 100644 --- a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaEnumeration.cs +++ b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaEnumeration.cs @@ -11,6 +11,6 @@ public GeneratorSchemaEnumeration(string layer, string name, string description) { } - public List Values { get; } = new List(); + public ICollection Values { get; } = new List(); } } diff --git a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaProperty.cs b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaProperty.cs index b1a8acf0..8309354a 100644 --- a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaProperty.cs +++ b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaProperty.cs @@ -26,7 +26,7 @@ public GeneratorSchemaProperty(GeneratorSchemaClass @class, string jsonName, str public int Order { get; set; } - public List Types { get; } = new List(); + public ICollection Types { get; } = new List(); public string PropertyTypeString { diff --git a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaPropertyType.cs b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaPropertyType.cs index b99b14e4..ee98d7e9 100644 --- a/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaPropertyType.cs +++ b/Tools/Schema.NET.Tool/GeneratorModels/GeneratorSchemaPropertyType.cs @@ -18,7 +18,7 @@ public GeneratorSchemaPropertyType(string name, IEnumerable csharpTypeSt this.CSharpTypeStrings = new List(csharpTypeStrings); } - public List CSharpTypeStrings { get; } + public ICollection CSharpTypeStrings { get; } public string Name { get; } diff --git a/Tools/Schema.NET.Tool/Models/SchemaClass.cs b/Tools/Schema.NET.Tool/Models/SchemaClass.cs index f6921798..82109df1 100644 --- a/Tools/Schema.NET.Tool/Models/SchemaClass.cs +++ b/Tools/Schema.NET.Tool/Models/SchemaClass.cs @@ -26,8 +26,8 @@ public SchemaClass(string layer, Uri id, string label, string comment) .Traverse(this, x => x.SubClassOf) .Any(x => string.Equals(x.Layer, LayerName.Meta, StringComparison.OrdinalIgnoreCase)); - public List SubClassOf { get; } = new List(); + public ICollection SubClassOf { get; } = new List(); - public List SubClassOfIds { get; } = new List(); + public ICollection SubClassOfIds { get; } = new List(); } } diff --git a/Tools/Schema.NET.Tool/Models/SchemaObject.cs b/Tools/Schema.NET.Tool/Models/SchemaObject.cs index 1de5f995..7d6c0280 100644 --- a/Tools/Schema.NET.Tool/Models/SchemaObject.cs +++ b/Tools/Schema.NET.Tool/Models/SchemaObject.cs @@ -30,7 +30,7 @@ public abstract class SchemaObject "PronounceableText", }; - public SchemaObject(string layer, Uri id, string label, string comment) + protected SchemaObject(string layer, Uri id, string label, string comment) { this.Layer = layer; this.Id = id; @@ -46,7 +46,7 @@ public SchemaObject(string layer, Uri id, string label, string comment) public string Layer { get; } - public List Types { get; } = new List(); + public ICollection Types { get; } = new List(); public virtual bool IsArchived => string.Equals(this.Layer, LayerName.Archived, StringComparison.OrdinalIgnoreCase); diff --git a/Tools/Schema.NET.Tool/Models/SchemaProperty.cs b/Tools/Schema.NET.Tool/Models/SchemaProperty.cs index a0b8a235..62eb9a35 100644 --- a/Tools/Schema.NET.Tool/Models/SchemaProperty.cs +++ b/Tools/Schema.NET.Tool/Models/SchemaProperty.cs @@ -10,8 +10,8 @@ public SchemaProperty(string layer, Uri id, string label, string comment) { } - public List DomainIncludes { get; } = new List(); + public ICollection DomainIncludes { get; } = new List(); - public List RangeIncludes { get; } = new List(); + public ICollection RangeIncludes { get; } = new List(); } } diff --git a/Tools/Schema.NET.Tool/Models/SchemaTreeClass.cs b/Tools/Schema.NET.Tool/Models/SchemaTreeClass.cs index ab85ee37..40b0c7a1 100644 --- a/Tools/Schema.NET.Tool/Models/SchemaTreeClass.cs +++ b/Tools/Schema.NET.Tool/Models/SchemaTreeClass.cs @@ -8,7 +8,7 @@ namespace Schema.NET.Tool.Models public class SchemaTreeClass { [DataMember] - public List Children { get; set; } = new List(); + public ICollection Children { get; set; } = new List(); [DataMember] public string? Description { get; set; } diff --git a/Tools/Schema.NET.Tool/SourceUtility.cs b/Tools/Schema.NET.Tool/SourceUtility.cs index 7744bc12..031b3b17 100644 --- a/Tools/Schema.NET.Tool/SourceUtility.cs +++ b/Tools/Schema.NET.Tool/SourceUtility.cs @@ -23,6 +23,16 @@ public static string RenderItems(bool canRender, IEnumerable items, Func(IEnumerable items, Func action) { + if (items is null) + { + throw new ArgumentNullException(nameof(items)); + } + + if (action is null) + { + throw new ArgumentNullException(nameof(action)); + } + var stringBuilder = new StringBuilder(); foreach (var item in items) { diff --git a/Tools/Schema.NET.Updater/Program.cs b/Tools/Schema.NET.Updater/Program.cs index 4f5af178..4cb09d6e 100644 --- a/Tools/Schema.NET.Updater/Program.cs +++ b/Tools/Schema.NET.Updater/Program.cs @@ -15,6 +15,7 @@ internal class Program private static async Task Main() { +#pragma warning disable CA1303 // Do not pass literals as localized parameters Console.WriteLine("Downloading '{0}'...", SchemaJsonSourceUrl); using var httpClient = new HttpClient(); using var stream = await httpClient.GetStreamAsync(new Uri(SchemaJsonSourceUrl)).ConfigureAwait(true); @@ -22,6 +23,7 @@ private static async Task Main() using var fileStream = File.Open(SchemaJsonDestinationFilePath, FileMode.Create); await stream.CopyToAsync(fileStream).ConfigureAwait(true); Console.WriteLine("Update complete!"); +#pragma warning restore CA1303 // Do not pass literals as localized parameters } } } From 0f2ac7b222f5a7cdc30a197623994e2aa75991aa Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Tue, 10 Aug 2021 17:03:26 +0100 Subject: [PATCH 3/6] Workaround warnings that only occur in .NET 5 and are fixed in .NET 6 SDK --- Source/Common/OneOrMany{T}.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Common/OneOrMany{T}.cs b/Source/Common/OneOrMany{T}.cs index 26f3cb92..60cab645 100644 --- a/Source/Common/OneOrMany{T}.cs +++ b/Source/Common/OneOrMany{T}.cs @@ -23,7 +23,9 @@ public readonly struct OneOrMany /// The single item value. public OneOrMany(T item) { +#pragma warning disable CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed. if (item is null || (item is string itemAsString && string.IsNullOrWhiteSpace(itemAsString))) +#pragma warning restore CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed. { this.collection = null; this.HasOne = false; @@ -51,7 +53,9 @@ public OneOrMany(ReadOnlySpan span) for (var i = 0; i < span.Length; i++) { var item = span[i]; +#pragma warning disable CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed. if (!string.IsNullOrWhiteSpace(item as string)) +#pragma warning restore CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed. { items[index] = item; index++; @@ -63,7 +67,9 @@ public OneOrMany(ReadOnlySpan span) for (var i = 0; i < span.Length; i++) { var item = span[i]; +#pragma warning disable CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed. if (item is not null) +#pragma warning restore CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed. { items[index] = item; index++; From 0d60948b2f7bc1cdfc4d390913b08d3a92cfbf1c Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Wed, 11 Aug 2021 17:16:07 +0100 Subject: [PATCH 4/6] Clean up suppressions --- Source/Common/HashCode.cs | 2 - Source/Common/OneOrMany{T}.cs | 2 - Source/Common/Thing.Partial.cs | 2 - Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs | 122 +----------------- Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs | 107 +-------------- Source/Common/Values{T1,T2,T3,T4}.cs | 73 +---------- Source/Common/Values{T1,T2,T3}.cs | 58 +-------- Source/Common/Values{T1,T2}.cs | 42 +----- 8 files changed, 20 insertions(+), 388 deletions(-) diff --git a/Source/Common/HashCode.cs b/Source/Common/HashCode.cs index 91d0c1d0..2c915ea4 100644 --- a/Source/Common/HashCode.cs +++ b/Source/Common/HashCode.cs @@ -114,9 +114,7 @@ public override bool Equals(object? obj) [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => #pragma warning disable CA1065 // Do not raise exceptions in unexpected locations -#pragma warning disable CA1303 // Do not pass literals as localized parameters throw new NotSupportedException("Implicitly convert this struct to an int to get the hash code."); -#pragma warning restore CA1303 // Do not pass literals as localized parameters #pragma warning restore CA1065 // Do not raise exceptions in unexpected locations private static int CombineHashCodes(int h1, int h2) diff --git a/Source/Common/OneOrMany{T}.cs b/Source/Common/OneOrMany{T}.cs index 60cab645..dd738018 100644 --- a/Source/Common/OneOrMany{T}.cs +++ b/Source/Common/OneOrMany{T}.cs @@ -10,10 +10,8 @@ namespace Schema.NET /// /// The type of the values. /// -#pragma warning disable CA1710 // Identifiers should have correct suffix public readonly struct OneOrMany : IReadOnlyCollection, IEnumerable, IValues, IEquatable> -#pragma warning restore CA1710 // Identifiers should have correct suffix { private readonly T[]? collection; diff --git a/Source/Common/Thing.Partial.cs b/Source/Common/Thing.Partial.cs index 9818ccc3..23c95498 100644 --- a/Source/Common/Thing.Partial.cs +++ b/Source/Common/Thing.Partial.cs @@ -5,9 +5,7 @@ namespace Schema.NET /// /// The most generic type of item. /// -#pragma warning disable CA1040 // Avoid empty interfaces public partial interface IThing -#pragma warning restore CA1040 // Avoid empty interfaces { } diff --git a/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs b/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs index a603f85d..694d5465 100644 --- a/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs +++ b/Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs @@ -15,10 +15,8 @@ namespace Schema.NET /// The fifth type the values can take. /// The sixth type the values can take. /// The seventh type the values can take. -#pragma warning disable CA1710 // Identifiers should have correct suffix public readonly struct Values : IReadOnlyCollection, IEnumerable, IValues, IEquatable> -#pragma warning restore CA1710 // Identifiers should have correct suffix { /// /// Initializes a new instance of the struct. @@ -366,21 +364,20 @@ public Values(IEnumerable items) /// public OneOrMany Value7 { get; } +#pragma warning disable CA1002 // Do not expose generic lists +#pragma warning disable CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2 item) => new(item); /// @@ -388,24 +385,20 @@ public Values(IEnumerable items) /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T4 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates + /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T5 item) => new(item); /// @@ -413,177 +406,126 @@ public Values(IEnumerable items) /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T6 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T7 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T4[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates + /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T5[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T6[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T7[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from array to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(object[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -592,9 +534,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1?(Values values) => values.Value1.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -603,9 +543,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2?(Values values) => values.Value2.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -614,9 +552,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3?(Values values) => values.Value3.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -625,9 +561,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T4?(Values values) => values.Value4.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -636,9 +570,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T5?(Values values) => values.Value5.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -647,9 +579,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T6?(Values values) => values.Value6.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -658,9 +588,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T7?(Values values) => values.Value7.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -669,9 +597,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1[](Values values) => values.Value1.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -680,11 +606,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -693,9 +615,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2[](Values values) => values.Value2.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -704,11 +624,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -717,9 +633,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3[](Values values) => values.Value3.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -728,11 +642,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -741,9 +651,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T4[](Values values) => values.Value4.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -752,11 +660,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value4.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -765,9 +669,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T5[](Values values) => values.Value5.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -776,11 +678,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value5.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -789,9 +687,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T6[](Values values) => values.Value6.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -800,11 +696,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value6.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -813,9 +705,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T7[](Values values) => values.Value7.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -824,11 +714,9 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value7.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates +#pragma warning restore CA1002 // Do not expose generic lists /// /// Implements the operator ==. diff --git a/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs b/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs index fb249c72..79f52f11 100644 --- a/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs +++ b/Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs @@ -14,10 +14,8 @@ namespace Schema.NET /// The fourth type the values can take. /// The fifth type the values can take. /// The sixth type the values can take. -#pragma warning disable CA1710 // Identifiers should have correct suffix public readonly struct Values : IReadOnlyCollection, IEnumerable, IValues, IEquatable> -#pragma warning restore CA1710 // Identifiers should have correct suffix { /// /// Initializes a new instance of the struct. @@ -309,21 +307,20 @@ public Values(IEnumerable items) /// public OneOrMany Value6 { get; } +#pragma warning disable CA1002 // Do not expose generic lists +#pragma warning disable CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2 item) => new(item); /// @@ -331,24 +328,20 @@ public Values(IEnumerable items) /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T4 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates + /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T5 item) => new(item); /// @@ -356,147 +349,105 @@ public Values(IEnumerable items) /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T6 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T4[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates + /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T5[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T6[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates + /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from array to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(object[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -505,9 +456,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1?(Values values) => values.Value1.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -516,9 +465,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2?(Values values) => values.Value2.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -527,9 +474,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3?(Values values) => values.Value3.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -538,9 +483,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T4?(Values values) => values.Value4.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -549,9 +492,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T5?(Values values) => values.Value5.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -560,9 +501,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T6?(Values values) => values.Value6.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -571,9 +510,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1[](Values values) => values.Value1.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -582,11 +519,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -595,9 +528,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2[](Values values) => values.Value2.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -606,11 +537,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -619,9 +546,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3[](Values values) => values.Value3.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -630,11 +555,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -643,9 +564,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T4[](Values values) => values.Value4.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -654,11 +573,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value4.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -667,9 +582,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T5[](Values values) => values.Value5.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -678,11 +591,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value5.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -691,9 +600,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T6[](Values values) => values.Value6.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -702,11 +609,9 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value6.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates +#pragma warning restore CA1002 // Do not expose generic lists /// /// Implements the operator ==. diff --git a/Source/Common/Values{T1,T2,T3,T4}.cs b/Source/Common/Values{T1,T2,T3,T4}.cs index b5c12f75..655d86b4 100644 --- a/Source/Common/Values{T1,T2,T3,T4}.cs +++ b/Source/Common/Values{T1,T2,T3,T4}.cs @@ -12,10 +12,8 @@ namespace Schema.NET /// The second type the values can take. /// The third type the values can take. /// The fourth type the values can take. -#pragma warning disable CA1710 // Identifiers should have correct suffix public readonly struct Values : IReadOnlyCollection, IEnumerable, IValues, IEquatable> -#pragma warning restore CA1710 // Identifiers should have correct suffix { /// /// Initializes a new instance of the struct. @@ -207,21 +205,20 @@ public Values(IEnumerable items) /// public OneOrMany Value4 { get; } +#pragma warning disable CA1002 // Do not expose generic lists +#pragma warning disable CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2 item) => new(item); /// @@ -229,118 +226,84 @@ public Values(IEnumerable items) /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T4 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T4[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from array to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(object[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -349,9 +312,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1?(Values values) => values.Value1.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -360,9 +321,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2?(Values values) => values.Value2.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -371,9 +330,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3?(Values values) => values.Value3.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -382,9 +339,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T4?(Values values) => values.Value4.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -393,9 +348,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1[](Values values) => values.Value1.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -404,11 +357,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -417,9 +366,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2[](Values values) => values.Value2.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -428,11 +375,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -441,9 +384,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3[](Values values) => values.Value3.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -452,11 +393,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -465,9 +402,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T4[](Values values) => values.Value4.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -476,11 +411,9 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value4.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates +#pragma warning restore CA1002 // Do not expose generic lists /// /// Implements the operator ==. diff --git a/Source/Common/Values{T1,T2,T3}.cs b/Source/Common/Values{T1,T2,T3}.cs index 6f90a31f..811d67fd 100644 --- a/Source/Common/Values{T1,T2,T3}.cs +++ b/Source/Common/Values{T1,T2,T3}.cs @@ -11,10 +11,8 @@ namespace Schema.NET /// The first type the values can take. /// The second type the values can take. /// The third type the values can take. -#pragma warning disable CA1710 // Identifiers should have correct suffix public readonly struct Values : IReadOnlyCollection, IEnumerable, IValues, IEquatable> -#pragma warning restore CA1710 // Identifiers should have correct suffix { /// /// Initializes a new instance of the struct. @@ -162,112 +160,84 @@ public Values(IEnumerable items) /// public OneOrMany Value3 { get; } +#pragma warning disable CA1002 // Do not expose generic lists +#pragma warning disable CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T3[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from array to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(object[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -276,9 +246,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1?(Values values) => values.Value1.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -287,9 +255,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2?(Values values) => values.Value2.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -298,9 +264,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3?(Values values) => values.Value3.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -309,9 +273,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1[](Values values) => values.Value1.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -320,11 +282,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -333,9 +291,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2[](Values values) => values.Value2.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -344,11 +300,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -357,9 +309,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T3[](Values values) => values.Value3.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -368,11 +318,9 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value3.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates +#pragma warning restore CA1002 // Do not expose generic lists /// /// Implements the operator ==. diff --git a/Source/Common/Values{T1,T2}.cs b/Source/Common/Values{T1,T2}.cs index 6b6e1c3b..6e0cf66c 100644 --- a/Source/Common/Values{T1,T2}.cs +++ b/Source/Common/Values{T1,T2}.cs @@ -10,10 +10,8 @@ namespace Schema.NET /// /// The first type the values can take. /// The second type the values can take. -#pragma warning disable CA1710 // Identifiers should have correct suffix public readonly struct Values : IReadOnlyCollection, IEnumerable, IValues, IEquatable> -#pragma warning restore CA1710 // Identifiers should have correct suffix { /// /// Initializes a new instance of the struct. @@ -121,83 +119,63 @@ public Values(IEnumerable items) /// public OneOrMany Value2 { get; } +#pragma warning disable CA1002 // Do not expose generic lists +#pragma warning disable CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The single item value. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2 item) => new(item); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T1[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(T2[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from array to . /// /// The array of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Values(object[] array) => new(array); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . /// /// The list of values. /// The result of the conversion. -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator Values(List list) => new(list); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -206,9 +184,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1?(Values values) => values.Value1.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to the first item of type . @@ -217,9 +193,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2?(Values values) => values.Value2.FirstOrDefault(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -228,9 +202,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T1[](Values values) => values.Value1.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -239,11 +211,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value1.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to an array of . @@ -252,9 +220,7 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator T2[](Values values) => values.Value2.ToArray(); -#pragma warning restore CA2225 // Operator overloads have named alternates /// /// Performs an implicit conversion from to . @@ -263,11 +229,9 @@ public Values(IEnumerable items) /// /// The result of the conversion. /// -#pragma warning disable CA2225 // Operator overloads have named alternates -#pragma warning disable CA1002 // Do not expose generic lists public static implicit operator List(Values values) => values.Value2.ToList(); -#pragma warning restore CA1002 // Do not expose generic lists #pragma warning restore CA2225 // Operator overloads have named alternates +#pragma warning restore CA1002 // Do not expose generic lists /// /// Implements the operator ==. From 5f3c092a930f45e44dca229cf6df179192f2a7ab Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Thu, 12 Aug 2021 08:47:54 +0100 Subject: [PATCH 5/6] Increase timeout to 15 mins --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b45d574c..38374f0c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,7 +39,7 @@ stages: vmImageName: windows-latest pool: vmImage: $(vmImageName) - timeoutInMinutes: 10 + timeoutInMinutes: 15 steps: - checkout: self lfs: true From f8bec441ee55adeaf85b0af3e3353c11f7e081dc Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Thu, 12 Aug 2021 16:55:09 +0100 Subject: [PATCH 6/6] Increase timeout to 20 minutes --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 38374f0c..327055e5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,7 +39,7 @@ stages: vmImageName: windows-latest pool: vmImage: $(vmImageName) - timeoutInMinutes: 15 + timeoutInMinutes: 20 steps: - checkout: self lfs: true