diff --git a/GitVersion.yml b/GitVersion.yml index 635c123..31931af 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -20,5 +20,5 @@ branches: - feature - support - hotfix -next-version: "1.0" +next-version: "1.2" diff --git a/Solutions/Corvus.UriTemplate.Benchmarking/Corvus.UriTemplate.Benchmarking.csproj b/Solutions/Corvus.UriTemplate.Benchmarking/Corvus.UriTemplate.Benchmarking.csproj index 53066f4..55035b8 100644 --- a/Solutions/Corvus.UriTemplate.Benchmarking/Corvus.UriTemplate.Benchmarking.csproj +++ b/Solutions/Corvus.UriTemplate.Benchmarking/Corvus.UriTemplate.Benchmarking.csproj @@ -9,6 +9,11 @@ false pdbonly true + + + $(NoWarn);CA1822 @@ -18,9 +23,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -32,8 +37,4 @@ true - - - - diff --git a/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterExtraction.cs b/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterExtraction.cs index 69b98ff..c751005 100644 --- a/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterExtraction.cs +++ b/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterExtraction.cs @@ -60,10 +60,13 @@ public void ExtractParametersTavis() /// /// Extract parameters from a URI template using the Corvus implementation of the Tavis API. /// + /// + /// A result, to ensure that the code under test does not get optimized out of existence. + /// [Benchmark] - public void ExtractParametersCorvusTavis() + public IDictionary? ExtractParametersCorvusTavis() { - IDictionary? result = this.corvusTavisTemplate!.GetParameters(TavisUri); + return this.corvusTavisTemplate!.GetParameters(TavisUri); } /// @@ -83,7 +86,9 @@ public void ExtractParametersCorvusTavisWithParameterCache() // We can't use the state } +#pragma warning disable RCS1163 // Unused parameter. static void HandleParameters(ReadOnlySpan name, ReadOnlySpan value, ref int state) +#pragma warning restore RCS1163 // Unused parameter. { state++; } @@ -98,7 +103,9 @@ public void ExtractParametersCorvus() int state = 0; this.corvusTemplate!.ParseUri(Uri, HandleParameterMatching, ref state); +#pragma warning disable RCS1163 // Unused parameter. static void HandleParameterMatching(bool reset, ReadOnlySpan name, ReadOnlySpan value, ref int state) +#pragma warning restore RCS1163 // Unused parameter. { if (reset) { diff --git a/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterSetting.cs b/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterSetting.cs index fae0bdd..fba3ed1 100644 --- a/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterSetting.cs +++ b/Solutions/Corvus.UriTemplate.Benchmarking/UriTemplateParameterSetting.cs @@ -15,7 +15,7 @@ public class UriTemplateParameterSetting { private const string UriTemplate = "http://example.org/location{?value*}"; private static readonly Dictionary Value = new() { { "foo", "bar" }, { "bar", "baz" }, { "baz", "bob" } }; - private static readonly Dictionary Parameters = new() { { "value", Value } }; + private static readonly Dictionary InputParameters = new() { { "value", Value } }; private readonly JsonDocument jsonValues = JsonDocument.Parse("{\"value\": { \"foo\": \"bar\", \"bar\": \"baz\", \"baz\": \"bob\" }}"); private Tavis.UriTemplates.UriTemplate? tavisTemplate; @@ -72,7 +72,9 @@ public void ResolveUriCorvusJson() { object? nullState = default; JsonUriTemplateResolver.TryResolveResult(UriTemplate.AsSpan(), false, this.jsonValues.RootElement, HandleResult, ref nullState); +#pragma warning disable RCS1163 // Unused parameter. static void HandleResult(ReadOnlySpan resolvedTemplate, ref object? state) +#pragma warning restore RCS1163 // Unused parameter. { // NOP } @@ -85,8 +87,10 @@ static void HandleResult(ReadOnlySpan resolvedTemplate, ref object? state) public void ResolveUriCorvusDictionary() { object? nullState = default; - DictionaryUriTemplateResolver.TryResolveResult(UriTemplate.AsSpan(), false, Parameters, HandleResult, ref nullState); + DictionaryUriTemplateResolver.TryResolveResult(UriTemplate.AsSpan(), false, InputParameters, HandleResult, ref nullState); +#pragma warning disable RCS1163 // Unused parameter. static void HandleResult(ReadOnlySpan resolvedTemplate, ref object? state) +#pragma warning restore RCS1163 // Unused parameter. { // NOP } diff --git a/Solutions/Corvus.UriTemplate.Benchmarking/packages.lock.json b/Solutions/Corvus.UriTemplate.Benchmarking/packages.lock.json index 1148d58..16b768e 100644 --- a/Solutions/Corvus.UriTemplate.Benchmarking/packages.lock.json +++ b/Solutions/Corvus.UriTemplate.Benchmarking/packages.lock.json @@ -4,49 +4,47 @@ "net7.0": { "BenchmarkDotNet": { "type": "Direct", - "requested": "[0.13.2, )", - "resolved": "0.13.2", - "contentHash": "82IflYxY8qnQXEA3kXtqC9pntrkJYJZbQ9PV7hEV/XcfCtOdwLz84ilyO8tLRVbiliWttvmt/v44P+visN+fPQ==", + "requested": "[0.13.5, )", + "resolved": "0.13.5", + "contentHash": "PiwINqvreKV7L+BQlaZ2qcJ90s88LbLqZoUWbKnEPzvmsWd4pUH58Yjp+mFn311n8Jz0Y0JsD+jWa+Kh67IG3A==", "dependencies": { - "BenchmarkDotNet.Annotations": "0.13.2", + "BenchmarkDotNet.Annotations": "0.13.5", "CommandLineParser": "2.4.3", + "Gee.External.Capstone": "2.3.0", "Iced": "1.17.0", "Microsoft.CodeAnalysis.CSharp": "3.0.0", "Microsoft.Diagnostics.Runtime": "2.2.332302", "Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2", "Microsoft.DotNet.PlatformAbstractions": "3.1.6", "Perfolizer": "0.2.1", - "System.Management": "6.0.0", - "System.Reflection.Emit": "4.7.0", - "System.Reflection.Emit.Lightweight": "4.7.0", - "System.Threading.Tasks.Extensions": "4.5.4" + "System.Management": "6.0.0" } }, "BenchmarkDotNet.Diagnostics.Windows": { "type": "Direct", - "requested": "[0.13.2, )", - "resolved": "0.13.2", - "contentHash": "COcdJcVt036U8cYHyHhq5ymI24AoV5h5BKHBzl5fbY0PUWF32immWWnSd66taOJRoe0Fr5ikimHNBVNXgV3KqA==", + "requested": "[0.13.5, )", + "resolved": "0.13.5", + "contentHash": "bNKJlIgUvEMBotiiHrEzw2xyCFlNiEfE14/EcBOEDSgYg+spzByVVv+totq9baxKUk5MhfAFhyzguBMiuoho3Q==", "dependencies": { - "BenchmarkDotNet": "0.13.2", + "BenchmarkDotNet": "0.13.5", "Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2" } }, "Endjin.RecommendedPractices.GitHub": { "type": "Direct", - "requested": "[2.1.2, )", - "resolved": "2.1.2", - "contentHash": "mBUCmeSdWWrIQKuuYd9zflcwupRDmpF39dsbb07e6azlNIQqaE1J5TQa17c3SFVRXn9IZrClsmKoMporRTAWwQ==", + "requested": "[2.1.5, )", + "resolved": "2.1.5", + "contentHash": "PoZqxrp7iYbSF0Vi2Wtj2sepxwZA3i4Yq9CGueralFhLYcHE60E3bQOwHLwWsv4oNf60FYJrr3RjFPa7pv1HyA==", "dependencies": { - "Endjin.RecommendedPractices": "2.1.2", + "Endjin.RecommendedPractices": "2.1.5", "Microsoft.SourceLink.GitHub": "1.1.1" } }, "Roslynator.Analyzers": { "type": "Direct", - "requested": "[4.1.1, )", - "resolved": "4.1.1", - "contentHash": "3cPVlrB1PytlO1ztZZBOExDKQWpMZgI15ZDa0BqLu0l6xv+xIRfEpqjNRcpvUy3aLxWTkPgSKZbbaO+VoFEJ1g==" + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "NZNaV9DAYGHKZ753WfhtBj8eoP40LLJsA6JQXdzhF87iTZAdbKCgp32mI3cnQF4TMXz7bk+CgzF/kDG+m+9bCg==" }, "StyleCop.Analyzers": { "type": "Direct", @@ -68,8 +66,8 @@ }, "BenchmarkDotNet.Annotations": { "type": "Transitive", - "resolved": "0.13.2", - "contentHash": "+SGOYyXT6fiagbtrni38B8BqBgjruYKU3PfROI0lDIYo8jQ+APUmLKMEswK7zwR5fEOCrDmoAHSH6oykBkqPgA==" + "resolved": "0.13.5", + "contentHash": "ORcRi9/fnjRfINKiAnAgIsRlQ15Gj2Lki7AluHnAVMk/lTyQ2nwaa+F+ezW8f3tElBDoZql02+J2lIwHbu1eoA==" }, "CommandLineParser": { "type": "Transitive", @@ -78,17 +76,22 @@ }, "CommunityToolkit.HighPerformance": { "type": "Transitive", - "resolved": "8.0.0", - "contentHash": "S5Iv1d5UJZNJLJbe/xzJmLqYJ2mhefbLAvhXCZEh3G4sFadUBuQZhQioE4oJG4enY69QMuJX3AX9+6P9rH1bMw==" + "resolved": "8.2.0", + "contentHash": "iKzsPiSnXoQUN5AoApYmdfnLn9osNb+YCLWRr5PFmrDEQVIu7OeOyf4DPvNBvbqbYLZCfvHozPkulyv6zBQsFw==" }, "Endjin.RecommendedPractices": { "type": "Transitive", - "resolved": "2.1.2", - "contentHash": "Nbj0WS3zVDD2wjfU2/nbkWIWS9Ljg8VN+SSpaCuf5lHBOIEb0Ra201lGcyJHtRHybAciz+hQA9lHj7TnG52qqw==", + "resolved": "2.1.5", + "contentHash": "iEFt7iG7gaBi24xSkEPFywEkZkC4yoE61PEkh2Nspqe8zbwKifSn/05jRlvRnYnanXdON+AzTKxLZf28vgCOsA==", "dependencies": { "Microsoft.Build.Tasks.Git": "1.1.1" } }, + "Gee.External.Capstone": { + "type": "Transitive", + "resolved": "2.3.0", + "contentHash": "2ap/rYmjtzCOT8hxrnEW/QeiOt+paD8iRrIcdKX0cxVwWLFa1e+JDBNeECakmccXrSFeBQuu5AV8SNkipFMMMw==" + }, "Iced": { "type": "Transitive", "resolved": "1.17.0", @@ -210,8 +213,8 @@ }, "Microsoft.Extensions.ObjectPool": { "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "udvKco0sAVgYGTBnHUb0tY9JQzJ/nPDiv/8PIyz69wl1AibeCDZOLVVI+6156dPfHmJH7ws5oUJRiW4ZmAvuuA==" + "resolved": "7.0.5", + "contentHash": "uylNo8wuzAeqAJDyLDUM2JWSpTdCHTp11BXCsCO68LXnDjxwDM4PL6mJmho/+fJesWKdcJV5XB/Oa80wAJXnvQ==" }, "Microsoft.Extensions.Options": { "type": "Transitive", @@ -707,8 +710,15 @@ }, "System.Reflection.Emit": { "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ==" + "resolved": "4.0.1", + "contentHash": "P2wqAj72fFjpP6wb9nSfDqNBMab+2ovzSDzUZK7MVIm54tBJEPr9jWfSjjoTpPwj1LeKcmX3vr0ttyjSSFM47g==", + "dependencies": { + "System.IO": "4.1.0", + "System.Reflection": "4.1.0", + "System.Reflection.Emit.ILGeneration": "4.0.1", + "System.Reflection.Primitives": "4.0.1", + "System.Runtime": "4.1.0" + } }, "System.Reflection.Emit.ILGeneration": { "type": "Transitive", @@ -722,8 +732,14 @@ }, "System.Reflection.Emit.Lightweight": { "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "a4OLB4IITxAXJeV74MDx49Oq2+PsF6Sml54XAFv+2RyWwtDBcabzoxiiJRhdhx+gaohLh4hEGCLQyBozXoQPqA==" + "resolved": "4.0.1", + "contentHash": "sSzHHXueZ5Uh0OLpUQprhr+ZYJrLPA2Cmr4gn0wj9+FftNKXx8RIMKvO9qnjk2ebPYUjZ+F2ulGdPOsvj+MEjA==", + "dependencies": { + "System.Reflection": "4.1.0", + "System.Reflection.Emit.ILGeneration": "4.0.1", + "System.Reflection.Primitives": "4.0.1", + "System.Runtime": "4.1.0" + } }, "System.Reflection.Extensions": { "type": "Transitive", @@ -1024,8 +1040,8 @@ }, "System.Text.Json": { "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "DaGSsVqKsn/ia6RG8frjwmJonfos0srquhw09TlT8KRw5I43E+4gs+/bZj4K0vShJ5H9imCuXupb4RmS+dBy3w==", + "resolved": "7.0.2", + "contentHash": "/LZf/JrGyilojqwpaywb+sSz8Tew7ij4K/Sk+UW8AKfAK7KRhR6mKpKtTm06cYA7bCpGTWfYksIW+mVsdxPegQ==", "dependencies": { "System.Text.Encodings.Web": "7.0.0" } @@ -1064,8 +1080,8 @@ }, "System.Threading.Tasks.Extensions": { "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" + "resolved": "4.5.0", + "contentHash": "csAJe24tWCOTO/rXoJAuBGuOq7ZdHY60XtC6b/hNMHT9tuX+2J9HK7nciLEtNvnrRLMxBACLXO3R4y5+kCduMA==" }, "System.Threading.Timer": { "type": "Transitive", @@ -1121,8 +1137,8 @@ "corvus.uritemplates": { "type": "Project", "dependencies": { - "CommunityToolkit.HighPerformance": "[8.0.0, )", - "Microsoft.Extensions.ObjectPool": "[7.0.0, )", + "CommunityToolkit.HighPerformance": "[8.2.0, )", + "Microsoft.Extensions.ObjectPool": "[7.0.5, )", "System.Buffers": "[4.5.1, )", "System.Collections.Immutable": "[7.0.0, )" } @@ -1130,32 +1146,22 @@ "corvus.uritemplates.resolvers.dictionaryofobject": { "type": "Project", "dependencies": { - "CommunityToolkit.HighPerformance": "[8.0.0, )", + "CommunityToolkit.HighPerformance": "[8.2.0, )", "Corvus.UriTemplates": "[1.0.0, )", - "Microsoft.Extensions.ObjectPool": "[7.0.0, )", + "Microsoft.Extensions.ObjectPool": "[7.0.5, )", "System.Buffers": "[4.5.1, )", "System.Collections.Immutable": "[7.0.0, )" } }, - "corvus.uritemplates.resolvers.dictionaryofobject": { - "type": "Project", - "dependencies": { - "CommunityToolkit.HighPerformance": "[8.0.0, )", - "Corvus.UriTemplates": "[1.0.0, )", - "Microsoft.Extensions.ObjectPool": "[7.0.0-rc.1.22427.2, )", - "System.Buffers": "[4.5.1, )", - "System.Collections.Immutable": "[7.0.0-rc.1.22426.10, )" - } - }, "corvus.uritemplates.resolvers.json": { "type": "Project", "dependencies": { - "CommunityToolkit.HighPerformance": "[8.0.0, )", + "CommunityToolkit.HighPerformance": "[8.2.0, )", "Corvus.UriTemplates": "[1.0.0, )", - "Microsoft.Extensions.ObjectPool": "[7.0.0, )", + "Microsoft.Extensions.ObjectPool": "[7.0.5, )", "System.Buffers": "[4.5.1, )", "System.Collections.Immutable": "[7.0.0, )", - "System.Text.Json": "[7.0.0, )" + "System.Text.Json": "[7.0.2, )" } } } diff --git a/Solutions/Corvus.UriTemplate.TavisApi.Tests/.editorconfig b/Solutions/Corvus.UriTemplate.TavisApi.Tests/.editorconfig new file mode 100644 index 0000000..ce38d47 --- /dev/null +++ b/Solutions/Corvus.UriTemplate.TavisApi.Tests/.editorconfig @@ -0,0 +1,11 @@ +# C# files +[*.{cs,csx}] +# Style - implicit and explicit types + +csharp_style_var_for_built_in_types = disable +csharp_style_var_when_type_is_apparent = disable +csharp_style_var_elsewhere = disable + + +# Style - using directives and namespace declarations +csharp_style_namespace_declarations = block_scoped:suggestion diff --git a/Solutions/Corvus.UriTemplate.TavisApi.Tests/UriTemplateTests.csproj b/Solutions/Corvus.UriTemplate.TavisApi.Tests/UriTemplateTests.csproj index 4cf6cf0..d797d46 100644 --- a/Solutions/Corvus.UriTemplate.TavisApi.Tests/UriTemplateTests.csproj +++ b/Solutions/Corvus.UriTemplate.TavisApi.Tests/UriTemplateTests.csproj @@ -3,6 +3,15 @@ net6.0;net7.0 false + + + $(NoWarn);RCS1163;CA1825;IDE0017;IDE0059;IDE0062;IDE0090;IDE0220;IDE1006;xUnit1004 @@ -13,7 +22,7 @@ - + all diff --git a/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates.Resolvers.DictionaryOfObject.csproj b/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates.Resolvers.DictionaryOfObject.csproj index 184a6ca..e160eb7 100644 --- a/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates.Resolvers.DictionaryOfObject.csproj +++ b/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates.Resolvers.DictionaryOfObject.csproj @@ -1,4 +1,4 @@ - + @@ -13,26 +13,18 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - - - - - - diff --git a/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates/DictionaryUriTemplateResolver.cs b/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates/DictionaryUriTemplateResolver.cs index a90d52b..98f3d49 100644 --- a/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates/DictionaryUriTemplateResolver.cs +++ b/Solutions/Corvus.UriTemplates.Resolvers.DictionaryOfObject/Corvus.UriTemplates/DictionaryUriTemplateResolver.cs @@ -95,8 +95,10 @@ public static bool TryGetParameterNames(ReadOnlySpan template, Par return UriTemplateResolver>.TryResolveResult(template, true, EmptyDictionary, Nop, callback, ref state); #endif +#pragma warning disable RCS1163 // Unused parameter. static void Nop(ReadOnlySpan value, ref TState state) { +#pragma warning restore RCS1163 // Unused parameter. } } } \ No newline at end of file diff --git a/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates.Resolvers.Json.csproj b/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates.Resolvers.Json.csproj index 77ccd05..f494ce2 100644 --- a/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates.Resolvers.Json.csproj +++ b/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates.Resolvers.Json.csproj @@ -13,27 +13,19 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - - - - - - - diff --git a/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates/JsonUriTemplateResolver.cs b/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates/JsonUriTemplateResolver.cs index f8ddbfe..0050052 100644 --- a/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates/JsonUriTemplateResolver.cs +++ b/Solutions/Corvus.UriTemplates.Resolvers.Json/Corvus.UriTemplates/JsonUriTemplateResolver.cs @@ -95,8 +95,10 @@ public static bool TryGetParameterNames(ReadOnlySpan template, Par return UriTemplateResolver.TryResolveResult(template, true, default, Nop, callback, ref state); #endif +#pragma warning disable RCS1163 // Unused parameter. static void Nop(ReadOnlySpan value, ref TState state) { +#pragma warning restore RCS1163 // Unused parameter. } } } \ No newline at end of file diff --git a/Solutions/Corvus.UriTemplates.sln b/Solutions/Corvus.UriTemplates.sln index 7eca243..ab6d554 100644 --- a/Solutions/Corvus.UriTemplates.sln +++ b/Solutions/Corvus.UriTemplates.sln @@ -13,7 +13,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corvus.UriTemplates.Resolve EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corvus.UriTemplates.Resolvers.DictionaryOfObject", "Corvus.UriTemplates.Resolvers.DictionaryOfObject\Corvus.UriTemplates.Resolvers.DictionaryOfObject.csproj", "{C77AE102-65C4-4C64-8B53-B2476EC80280}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox", "Sandbox\Sandbox.csproj", "{302F8634-2171-43DB-B5DD-5B01BE6026C2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sandbox", "Sandbox\Sandbox.csproj", "{302F8634-2171-43DB-B5DD-5B01BE6026C2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DevOps", "DevOps", "{A903B615-2FB5-40CB-958E-CC3C2294A931}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + ..\.gitignore = ..\.gitignore + ..\azure-pipelines.yml = ..\azure-pipelines.yml + ..\GitVersion.yml = ..\GitVersion.yml + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates.csproj b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates.csproj index df2a0fb..083314a 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates.csproj +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates.csproj @@ -1,4 +1,4 @@ - + @@ -13,22 +13,14 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - + diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/DictionaryUriTemplateResolver.cs b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/DictionaryUriTemplateResolver.cs index af919d4..f007153 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/DictionaryUriTemplateResolver.cs +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/DictionaryUriTemplateResolver.cs @@ -95,8 +95,10 @@ public static bool TryGetParameterNames(ReadOnlySpan template, Par return UriTemplateResolver>.TryResolveResult(template, true, EmptyDictionary, Nop, callback, ref state); #endif +#pragma warning disable RCS1163 // Unused parameter. static void Nop(ReadOnlySpan value, ref TState state) { +#pragma warning restore RCS1163 // Unused parameter. } } } \ No newline at end of file diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/TemplateMatch.cs b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/TemplateMatch.cs index aa25857..b638574 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/TemplateMatch.cs +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/TemplateMatch.cs @@ -22,5 +22,5 @@ public class TemplateMatch /// /// Gets or sets the matched parameters. /// - public IDictionary? Parameters { get; set; } + public IDictionary? Parameters { get; set; } } \ No newline at end of file diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriExtensions.cs b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriExtensions.cs index c30b281..5616fd9 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriExtensions.cs +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriExtensions.cs @@ -38,8 +38,8 @@ private enum State /// The URI template, with templatized query string, and parameters populated from the values in the query string. public static UriTemplate MakeTemplate(this Uri uri) { - Dictionary parameters = uri.GetQueryStringParameters(); - return uri.MakeTemplate(parameters); + Dictionary parameters = uri.GetQueryStringParameters(); + return uri.MakeTemplate((IDictionary)parameters); } /// @@ -63,19 +63,19 @@ public static UriTemplate MakeTemplate(this Uri uri, IDictionary - /// Get the query sstring parameters from the given URI. + /// Get the query string parameters from the given URI. /// /// The target URI for which to recover the query string parameters. /// A map of the query string parameters. - public static Dictionary GetQueryStringParameters(this Uri target) + public static Dictionary GetQueryStringParameters(this Uri target) { - Dictionary parameters = new(); + Dictionary parameters = new(); GetQueryStringParameters(target, AccumulateResults, ref parameters); return parameters; - static void AccumulateResults(ReadOnlySpan name, ReadOnlySpan value, ref Dictionary state) + static void AccumulateResults(ReadOnlySpan name, ReadOnlySpan value, ref Dictionary state) { state.Add(name.ToString(), value.ToString()); } diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplate.cs b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplate.cs index 79e8f83..1a53c3f 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplate.cs +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplate.cs @@ -14,7 +14,7 @@ namespace Corvus.UriTemplates.TavisApi; /// public class UriTemplate { - private static readonly Uri ComponentBaseUri = new Uri("https://localhost.com", UriKind.Absolute); + private static readonly Uri ComponentBaseUri = new("https://localhost.com", UriKind.Absolute); private readonly object lockObject = new(); private readonly string template; private readonly Dictionary parameters; @@ -154,7 +154,7 @@ static void ResolveToString(ReadOnlySpan name, ref string state) /// The URI from which to get the parameters. /// Whether to apply strict or relaxed query parameter ordering. /// The parameters decomposed from the Uri. - public IDictionary? GetParameters(Uri uri, QueryStringParameterOrder order = QueryStringParameterOrder.Strict) + public IDictionary? GetParameters(Uri uri, QueryStringParameterOrder order = QueryStringParameterOrder.Strict) { switch (order) { @@ -171,7 +171,7 @@ static void ResolveToString(ReadOnlySpan name, ref string state) } } - var parameters = new Dictionary(); + var parameters = new Dictionary(); if (parser.ParseUri(uri.OriginalString.AsSpan(), AddResults, ref parameters)) { @@ -182,7 +182,7 @@ static void ResolveToString(ReadOnlySpan name, ref string state) return null; } - static void AddResults(bool reset, ReadOnlySpan name, ReadOnlySpan value, ref Dictionary results) + static void AddResults(bool reset, ReadOnlySpan name, ReadOnlySpan value, ref Dictionary results) { if (reset) { @@ -206,11 +206,11 @@ static void AddResults(bool reset, ReadOnlySpan name, ReadOnlySpan v string uriString = uri.GetComponents(UriComponents.SchemeAndServer | UriComponents.Path | UriComponents.Fragment, UriFormat.UriEscaped); var uriWithoutQuery = new Uri(uriString, UriKind.Absolute); - IDictionary pathParameters = this.GetParameters(uriWithoutQuery) ?? new Dictionary(this.parameters.Comparer); + IDictionary pathParameters = this.GetParameters(uriWithoutQuery) ?? new Dictionary(this.parameters.Comparer); HashSet parameterNames = this.GetParameterNamesHashSet(); - (HashSet ParameterNames, IDictionary PathParameters) parameterState = (parameterNames, pathParameters); + (HashSet ParameterNames, IDictionary PathParameters) parameterState = (parameterNames, pathParameters); uri.GetQueryStringParameters(MatchParameterNames, ref parameterState); @@ -221,7 +221,7 @@ static void AddResults(bool reset, ReadOnlySpan name, ReadOnlySpan v throw new ArgumentOutOfRangeException(nameof(order), order, null); } - static void MatchParameterNames(ReadOnlySpan name, ReadOnlySpan value, ref (HashSet ParameterNames, IDictionary PathParameters) state) + static void MatchParameterNames(ReadOnlySpan name, ReadOnlySpan value, ref (HashSet ParameterNames, IDictionary PathParameters) state) { string name1 = name.ToString(); if (state.ParameterNames.Contains(name1)) diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateExtensions.cs b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateExtensions.cs index e922f85..9b6d326 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateExtensions.cs +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateExtensions.cs @@ -58,8 +58,7 @@ public static UriTemplate AddParameters(this UriTemplate template, object parame { if (parametersObject != null) { - IEnumerable properties; - properties = parametersObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); + IEnumerable properties = parametersObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo propinfo in properties) { template.SetParameter(propinfo.Name, propinfo.GetValue(parametersObject, null)); diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateTable.cs b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateTable.cs index 8a3eb7d..0b7f802 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateTable.cs +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/TavisApi/UriTemplateTable.cs @@ -9,7 +9,7 @@ namespace Corvus.UriTemplates.TavisApi; /// public class UriTemplateTable { - private readonly Dictionary templates = new Dictionary(); + private readonly Dictionary templates = new(); /// /// Get the URI template with the specified key. @@ -20,8 +20,7 @@ public UriTemplate? this[string key] { get { - UriTemplate? value; - if (this.templates.TryGetValue(key, out value)) + if (this.templates.TryGetValue(key, out UriTemplate? value)) { return value; } @@ -52,7 +51,7 @@ public void Add(string key, UriTemplate template) { foreach (KeyValuePair template in this.templates) { - IDictionary? parameters = template.Value.GetParameters(url, order); + IDictionary? parameters = template.Value.GetParameters(url, order); if (parameters != null) { return new TemplateMatch() { Key = template.Key, Parameters = parameters, Template = template.Value }; diff --git a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/UriTemplateParserFactory.cs b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/UriTemplateParserFactory.cs index 608cb90..45b155e 100644 --- a/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/UriTemplateParserFactory.cs +++ b/Solutions/Corvus.UriTemplates/Corvus.UriTemplates/UriTemplateParserFactory.cs @@ -162,7 +162,7 @@ static void AddLiteral(ReadOnlySpan templateSpan, List elements; diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cb81ad5..54bd20c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,6 +22,6 @@ jobs: service_connection_github: $(Endjin_Service_Connection_GitHub) solution_to_build: $(Endjin_Solution_To_Build) additionalNetSdkVersions: - - '7.x' + - '7.0.103' # Until https://github.com/endjin/Endjin.RecommendedPractices.Build/issues/69 is fixed, we have to use an old SDK includeNetSdkPreviewVersions: 'true' compileTasksServiceConnection: endjin-acr-reader diff --git a/build.ps1 b/build.ps1 index 4a99510..33fde48 100644 --- a/build.ps1 +++ b/build.ps1 @@ -71,7 +71,7 @@ param ( [string] $BuildModulePath, [Parameter()] - [version] $BuildModuleVersion = "1.2.2", + [version] $BuildModuleVersion = "1.3.5", [Parameter()] [version] $InvokeBuildModuleVersion = "5.7.1"