From 3c5156c0c8151af2f084a45522c8180f903d444d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:45:57 +0100 Subject: [PATCH 01/19] Move to dotnet 8.0 --- .../LivingDocumentation.Sample.eShopOnContainers.csproj | 2 +- .../LivingDocumentation.Abstractions.csproj | 2 +- .../LivingDocumentation.Analyzer.csproj | 2 +- .../LivingDocumentation.Descriptions.csproj | 2 +- .../LivingDocumentation.Extensions.csproj | 2 +- src/LivingDocumentation.Json/LivingDocumentation.Json.csproj | 2 +- .../LivingDocumentation.RenderExtensions.csproj | 2 +- .../LivingDocumentation.Statements.csproj | 2 +- src/LivingDocumentation.UML/LivingDocumentation.UML.csproj | 2 +- .../LivingDocumentation.Analyzer.Tests.csproj | 2 +- .../LivingDocumentation.Descriptions.Tests.csproj | 2 +- .../LivingDocumentation.Extensions.Tests.csproj | 2 +- .../LivingDocumentation.RenderExtensions.Tests.csproj | 2 +- .../LivingDocumentation.Serializations.Tests.csproj | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj b/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj index 7f0ed24..39a9eab 100644 --- a/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj +++ b/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 latest false diff --git a/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj b/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj index 26e6423..5839299 100644 --- a/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj +++ b/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 LivingDocumentation diff --git a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj index 6f8d799..f6a29f9 100644 --- a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj +++ b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj @@ -2,7 +2,7 @@ Exe - net6.0;net7.0 + net8.0 LivingDocumentation.Analyzer LivingDocumentation.Analyzer diff --git a/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj b/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj index 3a3bc78..f433ae2 100644 --- a/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj +++ b/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 LivingDocumentation diff --git a/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj b/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj index d47505f..4a9933f 100644 --- a/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj +++ b/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 latest true diff --git a/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj b/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj index 6cc5a9f..4b00377 100644 --- a/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj +++ b/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 LivingDocumentation diff --git a/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj b/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj index 7cef455..7e8db57 100644 --- a/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj +++ b/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 LivingDocumentation diff --git a/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj b/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj index dfc31fa..99d1edc 100644 --- a/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj +++ b/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 LivingDocumentation diff --git a/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj b/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj index 2e31fcc..5ff7ca8 100644 --- a/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj +++ b/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 LivingDocumentation.Uml diff --git a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj index 9842d20..0a3ef1c 100644 --- a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj +++ b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true latest diff --git a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj index bec45b0..b8160a0 100644 --- a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj +++ b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true latest diff --git a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj index 7d5df48..6472bf9 100644 --- a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj +++ b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true latest diff --git a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj index 6d9e238..244f17d 100644 --- a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj +++ b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true latest diff --git a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj index 33291d4..4381fc0 100644 --- a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj +++ b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true latest From 5f54c67516e9a667d6b2f1d5fb5b3e79901d4b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:47:24 +0100 Subject: [PATCH 02/19] Buildalyzer.Workspaces 5.0.0 -> 5.0.1 --- .../LivingDocumentation.Analyzer.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj index f6a29f9..312a4b2 100644 --- a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj +++ b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj @@ -44,7 +44,7 @@ - + From 774835df5b18f105e1c0878001b29cb079bd04df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:47:59 +0100 Subject: [PATCH 03/19] FluentAssertions 6.8.0 -> 6.12.0 --- .../LivingDocumentation.Analyzer.Tests.csproj | 2 +- .../LivingDocumentation.Descriptions.Tests.csproj | 2 +- .../LivingDocumentation.Extensions.Tests.csproj | 2 +- .../LivingDocumentation.RenderExtensions.Tests.csproj | 2 +- .../LivingDocumentation.Serializations.Tests.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj index 0a3ef1c..fae4fb9 100644 --- a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj +++ b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj @@ -16,7 +16,7 @@ - + diff --git a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj index b8160a0..33eb99f 100644 --- a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj +++ b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj @@ -16,7 +16,7 @@ - + diff --git a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj index 6472bf9..4ed70f0 100644 --- a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj +++ b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj @@ -18,7 +18,7 @@ - + diff --git a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj index 244f17d..6ec3483 100644 --- a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj +++ b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj @@ -18,7 +18,7 @@ - + diff --git a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj index 4381fc0..35d5acb 100644 --- a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj +++ b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj @@ -17,7 +17,7 @@ - + From 47e04d95024bf3932389ba8e0ca2ce125a7d94ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:48:31 +0100 Subject: [PATCH 04/19] Newtonsoft.Json 13.0.2 -> 13.0.3 --- .../LivingDocumentation.Sample.eShopOnContainers.csproj | 2 +- .../LivingDocumentation.Abstractions.csproj | 2 +- .../LivingDocumentation.Analyzer.csproj | 2 +- src/LivingDocumentation.Json/LivingDocumentation.Json.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj b/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj index 39a9eab..dcfd681 100644 --- a/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj +++ b/samples/LivingDocumentation.eShopOnContainers/LivingDocumentation.Sample.eShopOnContainers.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj b/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj index 5839299..729e04f 100644 --- a/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj +++ b/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj index 312a4b2..178eb2b 100644 --- a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj +++ b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj @@ -46,7 +46,7 @@ - + diff --git a/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj b/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj index 4b00377..85016ea 100644 --- a/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj +++ b/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj @@ -34,7 +34,7 @@ - + From 0d4c3726cfe4236cde014555f4aff17ead552a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:49:10 +0100 Subject: [PATCH 05/19] PlantUml.Builder 0.1.49 -> 0.1.63 --- src/LivingDocumentation.UML/LivingDocumentation.UML.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj b/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj index 5ff7ca8..2ad1154 100644 --- a/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj +++ b/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj @@ -27,7 +27,7 @@ - + From dd7bfa5703928b87997454cc8ed565ee000256c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:50:07 +0100 Subject: [PATCH 06/19] Microsoft.SourceLink.GitHub 1.1.1 -> 8.0.0 --- .../LivingDocumentation.Abstractions.csproj | 2 +- .../LivingDocumentation.Analyzer.csproj | 2 +- .../LivingDocumentation.Descriptions.csproj | 2 +- .../LivingDocumentation.Extensions.csproj | 2 +- src/LivingDocumentation.Json/LivingDocumentation.Json.csproj | 2 +- .../LivingDocumentation.RenderExtensions.csproj | 2 +- .../LivingDocumentation.Statements.csproj | 2 +- src/LivingDocumentation.UML/LivingDocumentation.UML.csproj | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj b/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj index 729e04f..33d6a6f 100644 --- a/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj +++ b/src/LivingDocumentation.Abstractions/LivingDocumentation.Abstractions.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj index 178eb2b..a1b3d0f 100644 --- a/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj +++ b/src/LivingDocumentation.Analyzer/LivingDocumentation.Analyzer.csproj @@ -47,7 +47,7 @@ - + diff --git a/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj b/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj index f433ae2..16f1ead 100644 --- a/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj +++ b/src/LivingDocumentation.Descriptions/LivingDocumentation.Descriptions.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj b/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj index 4a9933f..a2eb790 100644 --- a/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj +++ b/src/LivingDocumentation.Extensions/LivingDocumentation.Extensions.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj b/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj index 85016ea..558bc05 100644 --- a/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj +++ b/src/LivingDocumentation.Json/LivingDocumentation.Json.csproj @@ -35,7 +35,7 @@ - + diff --git a/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj b/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj index 7e8db57..f4ac828 100644 --- a/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj +++ b/src/LivingDocumentation.Render/LivingDocumentation.RenderExtensions.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj b/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj index 99d1edc..47489e3 100644 --- a/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj +++ b/src/LivingDocumentation.Statements/LivingDocumentation.Statements.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj b/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj index 2ad1154..2dc5831 100644 --- a/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj +++ b/src/LivingDocumentation.UML/LivingDocumentation.UML.csproj @@ -28,7 +28,7 @@ - + From ccdbcce89cecde3565338d5fd97885212fd00efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:51:04 +0100 Subject: [PATCH 07/19] MSTest.TestAdapter 3.0.2 -> 3.1.1 --- .../LivingDocumentation.Analyzer.Tests.csproj | 2 +- .../LivingDocumentation.Descriptions.Tests.csproj | 2 +- .../LivingDocumentation.Extensions.Tests.csproj | 2 +- .../LivingDocumentation.RenderExtensions.Tests.csproj | 2 +- .../LivingDocumentation.Serializations.Tests.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj index fae4fb9..80c89e6 100644 --- a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj +++ b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj @@ -18,7 +18,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj index 33eb99f..2e5c2e4 100644 --- a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj +++ b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj @@ -18,7 +18,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj index 4ed70f0..d73d5ca 100644 --- a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj +++ b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj index 6ec3483..ac314ed 100644 --- a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj +++ b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj index 35d5acb..392a557 100644 --- a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj +++ b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj @@ -19,7 +19,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From ffe1eb223a2515095c6d5ffccefb53db2c9bf795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 21:51:42 +0100 Subject: [PATCH 08/19] MSTest.TestFramework 3.0.2 -> 3.1.1 --- .../LivingDocumentation.Analyzer.Tests.csproj | 2 +- .../LivingDocumentation.Descriptions.Tests.csproj | 2 +- .../LivingDocumentation.Extensions.Tests.csproj | 2 +- .../LivingDocumentation.RenderExtensions.Tests.csproj | 2 +- .../LivingDocumentation.Serializations.Tests.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj index 80c89e6..b5f41f2 100644 --- a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj +++ b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj @@ -19,7 +19,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj index 2e5c2e4..0d4786c 100644 --- a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj +++ b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj @@ -19,7 +19,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj index d73d5ca..1752f53 100644 --- a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj +++ b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj @@ -21,7 +21,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj index ac314ed..519b2c5 100644 --- a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj +++ b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj @@ -21,7 +21,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj index 392a557..0522f51 100644 --- a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj +++ b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 5c528270fb4f47f5c75c29744f2d09e1b881c34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 22:23:52 +0100 Subject: [PATCH 09/19] Microsoft.NET.Test.Sdk 17.4.1 -> 17.8.0 --- .../LivingDocumentation.Analyzer.Tests.csproj | 2 +- .../LivingDocumentation.Descriptions.Tests.csproj | 2 +- .../LivingDocumentation.Extensions.Tests.csproj | 2 +- .../LivingDocumentation.RenderExtensions.Tests.csproj | 2 +- .../LivingDocumentation.Serializations.Tests.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj index b5f41f2..db7abcc 100644 --- a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj +++ b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj @@ -17,7 +17,7 @@ - + diff --git a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj index 0d4786c..87305f6 100644 --- a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj +++ b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj @@ -17,7 +17,7 @@ - + diff --git a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj index 1752f53..78519f4 100644 --- a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj +++ b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj @@ -19,7 +19,7 @@ - + diff --git a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj index 519b2c5..063107c 100644 --- a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj +++ b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj @@ -19,7 +19,7 @@ - + diff --git a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj index 0522f51..3ce0367 100644 --- a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj +++ b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj @@ -18,7 +18,7 @@ - + From 9e6e0b45f40e9f1c410b79181cba39e43a2a3dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 22:24:43 +0100 Subject: [PATCH 10/19] coverlet.collector 3.2.0 -> 6.0.0 --- .../LivingDocumentation.Analyzer.Tests.csproj | 2 +- .../LivingDocumentation.Descriptions.Tests.csproj | 2 +- .../LivingDocumentation.Extensions.Tests.csproj | 2 +- .../LivingDocumentation.RenderExtensions.Tests.csproj | 2 +- .../LivingDocumentation.Serializations.Tests.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj index db7abcc..cf3b4a8 100644 --- a/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj +++ b/tests/LivingDocumentation.Analyzer.Tests/LivingDocumentation.Analyzer.Tests.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj index 87305f6..2cb1a3a 100644 --- a/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj +++ b/tests/LivingDocumentation.Descriptions.Tests/LivingDocumentation.Descriptions.Tests.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj index 78519f4..934e4ac 100644 --- a/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj +++ b/tests/LivingDocumentation.Extensions.Tests/LivingDocumentation.Extensions.Tests.csproj @@ -22,7 +22,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj index 063107c..e1c624d 100644 --- a/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj +++ b/tests/LivingDocumentation.RenderExtensions.Tests/LivingDocumentation.RenderExtensions.Tests.csproj @@ -22,7 +22,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj index 3ce0367..2a49bbb 100644 --- a/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj +++ b/tests/LivingDocumentation.Serializations.Tests/LivingDocumentation.Serializations.Tests.csproj @@ -21,7 +21,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From d4314f469c76fb0f62e1e6a11244748778d4d16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 22:25:07 +0100 Subject: [PATCH 11/19] Add runsettings to editorconfig --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index dba4fcb..d8860dc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,7 +7,7 @@ [*] indent_style = space -[*.{csproj,xml}] +[*.{csproj,xml,runsettings}] indent_size = 2 # Code files From 5b09829896448b4d9e7627f00ad3923fed7b490e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 22:25:25 +0100 Subject: [PATCH 12/19] Update code coverage filters for Visual Studio --- LivingDocumentation.runsettings | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/LivingDocumentation.runsettings b/LivingDocumentation.runsettings index e5160b3..c738b52 100644 --- a/LivingDocumentation.runsettings +++ b/LivingDocumentation.runsettings @@ -7,6 +7,20 @@ lcov,cobertura + + + + + + .*\.dll$ + + + .*\.Tests\.dll$ + + + + + From 089f9846491f325db4e9fd08258a8748ce7d3c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 22:26:51 +0100 Subject: [PATCH 13/19] Simplify collection initialization --- .../Statement.cs | 2 +- .../AttributeDescription.cs | 2 +- .../ConstructorDescription.cs | 4 ++-- .../DocumentationCommentsDescription.cs | 10 +++++----- .../InvocationDescription.cs | 2 +- .../MemberDescription.cs | 2 +- .../MethodDescription.cs | 4 ++-- .../ParameterDescription.cs | 2 +- .../TypeDescription.cs | 16 ++++++++-------- src/LivingDocumentation.Statements/If.cs | 2 +- src/LivingDocumentation.Statements/Switch.cs | 2 +- .../SwitchSection.cs | 2 +- src/LivingDocumentation.UML/Fragments/Alt.cs | 2 +- .../Fragments/InteractionFragment.cs | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/LivingDocumentation.Abstractions/Statement.cs b/src/LivingDocumentation.Abstractions/Statement.cs index 94ba604..428acdd 100644 --- a/src/LivingDocumentation.Abstractions/Statement.cs +++ b/src/LivingDocumentation.Abstractions/Statement.cs @@ -3,7 +3,7 @@ namespace LivingDocumentation; public abstract class Statement { [JsonProperty(ItemTypeNameHandling = TypeNameHandling.Objects)] - public virtual List Statements { get; } = new(); + public virtual List Statements { get; } = []; [JsonIgnore] public object? Parent diff --git a/src/LivingDocumentation.Descriptions/AttributeDescription.cs b/src/LivingDocumentation.Descriptions/AttributeDescription.cs index 41787f3..b52775d 100644 --- a/src/LivingDocumentation.Descriptions/AttributeDescription.cs +++ b/src/LivingDocumentation.Descriptions/AttributeDescription.cs @@ -9,7 +9,7 @@ public class AttributeDescription : IAttributeDescription [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] - public List Arguments { get; } = new(); + public List Arguments { get; } = []; public AttributeDescription(string? type, string? name) { diff --git a/src/LivingDocumentation.Descriptions/ConstructorDescription.cs b/src/LivingDocumentation.Descriptions/ConstructorDescription.cs index e87d3c2..d826bfb 100644 --- a/src/LivingDocumentation.Descriptions/ConstructorDescription.cs +++ b/src/LivingDocumentation.Descriptions/ConstructorDescription.cs @@ -5,9 +5,9 @@ public class ConstructorDescription : MemberDescription, IHaveAMethodBody { [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] - public List Parameters { get; } = new(); + public List Parameters { get; } = []; - public List Statements { get; } = new(); + public List Statements { get; } = []; public override MemberType MemberType => MemberType.Constructor; diff --git a/src/LivingDocumentation.Descriptions/DocumentationComments/DocumentationCommentsDescription.cs b/src/LivingDocumentation.Descriptions/DocumentationComments/DocumentationCommentsDescription.cs index 065ff9f..9f2ee9a 100644 --- a/src/LivingDocumentation.Descriptions/DocumentationComments/DocumentationCommentsDescription.cs +++ b/src/LivingDocumentation.Descriptions/DocumentationComments/DocumentationCommentsDescription.cs @@ -26,15 +26,15 @@ public partial class DocumentationCommentsDescription : IHaveDocumentationCommen [DefaultValue("")] public string Value { get; set; } = string.Empty; - public Dictionary Exceptions { get; set; } = new Dictionary(); + public Dictionary Exceptions { get; set; } = []; - public Dictionary Permissions { get; set; } = new Dictionary(); + public Dictionary Permissions { get; set; } = []; - public Dictionary Params { get; set; } = new Dictionary(); + public Dictionary Params { get; set; } = []; - public Dictionary SeeAlsos { get; set; } = new Dictionary(); + public Dictionary SeeAlsos { get; set; } = []; - public Dictionary TypeParams { get; set; } = new Dictionary(); + public Dictionary TypeParams { get; set; } = []; public static DocumentationCommentsDescription? Parse(string? documentationCommentXml) { diff --git a/src/LivingDocumentation.Descriptions/InvocationDescription.cs b/src/LivingDocumentation.Descriptions/InvocationDescription.cs index 24370b6..d5ba0c7 100644 --- a/src/LivingDocumentation.Descriptions/InvocationDescription.cs +++ b/src/LivingDocumentation.Descriptions/InvocationDescription.cs @@ -7,7 +7,7 @@ public class InvocationDescription : Statement public string Name { get; } - public List Arguments { get; } = new(); + public List Arguments { get; } = []; public InvocationDescription(string containingType, string name) { diff --git a/src/LivingDocumentation.Descriptions/MemberDescription.cs b/src/LivingDocumentation.Descriptions/MemberDescription.cs index a352987..dfad8ff 100644 --- a/src/LivingDocumentation.Descriptions/MemberDescription.cs +++ b/src/LivingDocumentation.Descriptions/MemberDescription.cs @@ -18,7 +18,7 @@ public abstract class MemberDescription : IMemberable [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] - public List Attributes { get; } = new(); + public List Attributes { get; } = []; public MemberDescription(string name) { diff --git a/src/LivingDocumentation.Descriptions/MethodDescription.cs b/src/LivingDocumentation.Descriptions/MethodDescription.cs index 6934b69..328edc9 100644 --- a/src/LivingDocumentation.Descriptions/MethodDescription.cs +++ b/src/LivingDocumentation.Descriptions/MethodDescription.cs @@ -8,9 +8,9 @@ public class MethodDescription : MemberDescription, IHaveAMethodBody [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] - public List Parameters { get; } = new(); + public List Parameters { get; } = []; - public List Statements { get; } = new(); + public List Statements { get; } = []; public override MemberType MemberType => MemberType.Method; diff --git a/src/LivingDocumentation.Descriptions/ParameterDescription.cs b/src/LivingDocumentation.Descriptions/ParameterDescription.cs index 40eb39a..4d30026 100644 --- a/src/LivingDocumentation.Descriptions/ParameterDescription.cs +++ b/src/LivingDocumentation.Descriptions/ParameterDescription.cs @@ -11,7 +11,7 @@ public class ParameterDescription : IParameterDescription [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] - public List Attributes { get; } = new(); + public List Attributes { get; } = []; public ParameterDescription(string type, string name) { diff --git a/src/LivingDocumentation.Descriptions/TypeDescription.cs b/src/LivingDocumentation.Descriptions/TypeDescription.cs index 71ce147..370c794 100644 --- a/src/LivingDocumentation.Descriptions/TypeDescription.cs +++ b/src/LivingDocumentation.Descriptions/TypeDescription.cs @@ -4,22 +4,22 @@ namespace LivingDocumentation; public class TypeDescription : IHaveModifiers { [JsonProperty(Order = 1, PropertyName = nameof(Fields))] - private readonly List fields = new(); + private readonly List fields = []; [JsonProperty(Order = 2, PropertyName = nameof(Constructors))] - private readonly List constructors = new(); + private readonly List constructors = []; [JsonProperty(Order = 3, PropertyName = nameof(Properties))] - private readonly List properties = new(); + private readonly List properties = []; [JsonProperty(Order = 4, PropertyName = nameof(Methods))] - private readonly List methods = new(); + private readonly List methods = []; [JsonProperty(Order = 5, PropertyName = nameof(EnumMembers))] - private readonly List enumMembers = new(); + private readonly List enumMembers = []; [JsonProperty(Order = 6, PropertyName = nameof(Events))] - private readonly List events = new(); + private readonly List events = []; public TypeDescription(TypeType type, string? fullName) { @@ -33,7 +33,7 @@ public TypeDescription(TypeType type, string? fullName) public DocumentationCommentsDescription? DocumentationComments { get; set; } - public List BaseTypes { get; } = new(); + public List BaseTypes { get; } = []; [DefaultValue(Modifier.Internal)] [JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] @@ -41,7 +41,7 @@ public TypeDescription(TypeType type, string? fullName) [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] - public List Attributes { get; } = new(); + public List Attributes { get; } = []; [JsonIgnore] public string Name => this.FullName.ClassName(); diff --git a/src/LivingDocumentation.Statements/If.cs b/src/LivingDocumentation.Statements/If.cs index d357f61..f41d8a0 100644 --- a/src/LivingDocumentation.Statements/If.cs +++ b/src/LivingDocumentation.Statements/If.cs @@ -3,7 +3,7 @@ namespace LivingDocumentation; [DebuggerDisplay("If")] public class If : Statement { - public List Sections { get; } = new(); + public List Sections { get; } = []; [JsonIgnore] public override List Statements => this.Sections.SelectMany(s => s.Statements).ToList(); diff --git a/src/LivingDocumentation.Statements/Switch.cs b/src/LivingDocumentation.Statements/Switch.cs index 26e5c56..da34b79 100644 --- a/src/LivingDocumentation.Statements/Switch.cs +++ b/src/LivingDocumentation.Statements/Switch.cs @@ -3,7 +3,7 @@ namespace LivingDocumentation; [DebuggerDisplay("Switch {Expression}")] public class Switch : Statement { - public List Sections { get; } = new(); + public List Sections { get; } = []; public string? Expression { get; set; } diff --git a/src/LivingDocumentation.Statements/SwitchSection.cs b/src/LivingDocumentation.Statements/SwitchSection.cs index d64bf70..e0cdd8e 100644 --- a/src/LivingDocumentation.Statements/SwitchSection.cs +++ b/src/LivingDocumentation.Statements/SwitchSection.cs @@ -3,5 +3,5 @@ namespace LivingDocumentation; [DebuggerDisplay("Switch Section {Labels}")] public class SwitchSection : Statement { - public List Labels { get; } = new(); + public List Labels { get; } = []; } diff --git a/src/LivingDocumentation.UML/Fragments/Alt.cs b/src/LivingDocumentation.UML/Fragments/Alt.cs index 4dd13e7..0dff07f 100644 --- a/src/LivingDocumentation.UML/Fragments/Alt.cs +++ b/src/LivingDocumentation.UML/Fragments/Alt.cs @@ -6,7 +6,7 @@ namespace LivingDocumentation.Uml; [DebuggerDisplay("Alt")] public class Alt : InteractionFragment { - private readonly List sections = new(); + private readonly List sections = []; /// /// Gets all sections. diff --git a/src/LivingDocumentation.UML/Fragments/InteractionFragment.cs b/src/LivingDocumentation.UML/Fragments/InteractionFragment.cs index 758c619..46961ab 100644 --- a/src/LivingDocumentation.UML/Fragments/InteractionFragment.cs +++ b/src/LivingDocumentation.UML/Fragments/InteractionFragment.cs @@ -5,7 +5,7 @@ namespace LivingDocumentation.Uml; /// public abstract class InteractionFragment { - private readonly List interactionFragments = new(); + private readonly List interactionFragments = []; /// /// The parent of this fragment. From db2a9729993987a6f4a349db211774245d921285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 22:29:46 +0100 Subject: [PATCH 14/19] Use primary constructors --- .../AsciiDocRenderer.cs | 26 +++------ .../Analyzers/BranchingAnalyzer.cs | 21 +++----- .../Analyzers/InvocationsAnalyzer.cs | 53 ++++++++----------- .../Analyzers/LoopingAnalyzer.cs | 15 ++---- .../Analyzers/SourceAnalyzer.cs | 51 ++++++++---------- .../ArgumentDescription.cs | 12 ++--- .../AssignmentDescription.cs | 15 ++---- .../AttributeArgumentDescription.cs | 15 ++---- .../AttributeDescription.cs | 12 ++--- .../ConstructorDescription.cs | 7 +-- .../EnumMemberDescription.cs | 10 +--- .../EventDescription.cs | 10 +--- .../FieldDescription.cs | 10 +--- .../InvocationDescription.cs | 12 ++--- .../MemberDescription.cs | 9 +--- .../MethodDescription.cs | 10 +--- .../ParameterDescription.cs | 12 ++--- .../PropertyDescription.cs | 10 +--- .../ReturnDescription.cs | 9 +--- .../TypeDescription.cs | 12 ++--- .../TypeDescriptionTests.cs | 6 +-- 21 files changed, 98 insertions(+), 239 deletions(-) diff --git a/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs b/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs index 25f4e8b..7ea9842 100644 --- a/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs +++ b/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs @@ -8,22 +8,10 @@ namespace LivingDocumentation.eShopOnContainers { - public class AsciiDocRenderer + public class AsciiDocRenderer(IReadOnlyList types, IReadOnlyDictionary aggregateFiles, IReadOnlyDictionary commandHandlerFiles, IReadOnlyDictionary eventHandlerFiles) { - private readonly IReadOnlyList types; - private readonly IReadOnlyDictionary aggregateFiles; - private readonly IReadOnlyDictionary commandHandlerFiles; - private readonly IReadOnlyDictionary eventHandlerFiles; private static readonly Regex replaceTypeSuffix = new Regex("(?:(?:Command|(?:Domain|Integration)Event))(?:Handler)?$", RegexOptions.CultureInvariant); - public AsciiDocRenderer(IReadOnlyList types, IReadOnlyDictionary aggregateFiles, IReadOnlyDictionary commandHandlerFiles, IReadOnlyDictionary eventHandlerFiles) - { - this.types = types; - this.aggregateFiles = aggregateFiles; - this.commandHandlerFiles = commandHandlerFiles; - this.eventHandlerFiles = eventHandlerFiles; - } - public void Render() { var stringBuilder = new StringBuilder(); @@ -47,7 +35,7 @@ private void RenderAggregates(StringBuilder stringBuilder) stringBuilder.AppendLine("== Aggregates"); stringBuilder.AppendLine("Aggregates in the eShop application."); - foreach (var (type, path) in this.aggregateFiles.Select(kv => (Type: this.types.FirstOrDefault(kv.Key), Path: kv.Value)).OrderBy(t => t.Type.Name)) + foreach (var (type, path) in aggregateFiles.Select(kv => (Type: types.FirstOrDefault(kv.Key), Path: kv.Value)).OrderBy(t => t.Type.Name)) { stringBuilder.AppendLine(); stringBuilder.AppendLine($"// tag::aggregate-{StripTypeSuffix(type.Name).ToLowerInvariant()}[]"); @@ -72,7 +60,7 @@ private void RenderCommands(StringBuilder stringBuilder) stringBuilder.AppendLine("== Commands"); stringBuilder.AppendLine("Commands in the eShop application."); - foreach (var type in this.types.Where(t => t.IsCommand() && !t.FullName.IsGeneric()).OrderBy(t => t.Name)) + foreach (var type in types.Where(t => t.IsCommand() && !t.FullName.IsGeneric()).OrderBy(t => t.Name)) { stringBuilder.AppendLine(); stringBuilder.AppendLine($"=== {FormatTechnicalName(type.Name)}"); @@ -108,7 +96,7 @@ private void RenderCommandHandlers(StringBuilder stringBuilder) stringBuilder.AppendLine("== Command Handlers"); stringBuilder.AppendLine("Command handlers in the eShop application."); - foreach (var (type, path) in this.commandHandlerFiles.Select(kv => (Type: this.types.FirstOrDefault(kv.Key), Path: kv.Value)).OrderBy(t => t.Type.Name)) + foreach (var (type, path) in commandHandlerFiles.Select(kv => (Type: types.FirstOrDefault(kv.Key), Path: kv.Value)).OrderBy(t => t.Type.Name)) { stringBuilder.AppendLine(); stringBuilder.AppendLine($"// tag::commandhandler-{StripTypeSuffix(type.Name).ToLowerInvariant()}[]"); @@ -140,7 +128,7 @@ private void RenderDomainEvents(StringBuilder stringBuilder) stringBuilder.AppendLine("== Domain Events"); stringBuilder.AppendLine("Domain events in the eShop application."); - foreach (var type in this.types.Where(t => t.IsDomainEvent()).OrderBy(t => t.Name)) + foreach (var type in types.Where(t => t.IsDomainEvent()).OrderBy(t => t.Name)) { stringBuilder.AppendLine(); stringBuilder.AppendLine($"=== {FormatTechnicalName(type.Name)}"); @@ -176,7 +164,7 @@ private void RenderDomainEventHandlers(StringBuilder stringBuilder) stringBuilder.AppendLine("== Domain Event Handlers"); stringBuilder.AppendLine("Domain event handlers in the eShop application."); - foreach (var (type, path) in this.eventHandlerFiles.Select(kv => (Type: this.types.FirstOrDefault(kv.Key), Path: kv.Value)).OrderBy(t => t.Type.Name)) + foreach (var (type, path) in eventHandlerFiles.Select(kv => (Type: types.FirstOrDefault(kv.Key), Path: kv.Value)).OrderBy(t => t.Type.Name)) { stringBuilder.AppendLine(); stringBuilder.AppendLine($"// tag::domaineventhandler-{StripTypeSuffix(type.Name).ToLowerInvariant()}[]"); @@ -207,7 +195,7 @@ private void RenderIntegrationEvents(StringBuilder stringBuilder) stringBuilder.AppendLine("== Integration Events"); stringBuilder.AppendLine("Integration events in the eShop application."); - foreach (var type in this.types.Where(t => t.IsIntegrationEvent() && t.FullName.StartsWith("Ordering.API", StringComparison.Ordinal)).OrderBy(t => t.Name)) + foreach (var type in types.Where(t => t.IsIntegrationEvent() && t.FullName.StartsWith("Ordering.API", StringComparison.Ordinal)).OrderBy(t => t.Name)) { stringBuilder.AppendLine(); stringBuilder.AppendLine($"=== {FormatTechnicalName(type.Name)}"); diff --git a/src/LivingDocumentation.Analyzer/Analyzers/BranchingAnalyzer.cs b/src/LivingDocumentation.Analyzer/Analyzers/BranchingAnalyzer.cs index 40be996..168e475 100644 --- a/src/LivingDocumentation.Analyzer/Analyzers/BranchingAnalyzer.cs +++ b/src/LivingDocumentation.Analyzer/Analyzers/BranchingAnalyzer.cs @@ -1,27 +1,18 @@ namespace LivingDocumentation; -internal class BranchingAnalyzer : CSharpSyntaxWalker +internal class BranchingAnalyzer(SemanticModel semanticModel, List statements) : CSharpSyntaxWalker { - private readonly SemanticModel semanticModel; - private readonly List statements; - - public BranchingAnalyzer(in SemanticModel semanticModel, List statements) - { - this.semanticModel = semanticModel; - this.statements = statements; - } - public override void VisitIfStatement(IfStatementSyntax node) { var ifStatement = new If(); - this.statements.Add(ifStatement); + statements.Add(ifStatement); var ifSection = new IfElseSection(); ifStatement.Sections.Add(ifSection); ifSection.Condition = node.Condition.ToString(); - var ifInvocationAnalyzer = new InvocationsAnalyzer(this.semanticModel, ifSection.Statements); + var ifInvocationAnalyzer = new InvocationsAnalyzer(semanticModel, ifSection.Statements); ifInvocationAnalyzer.Visit(node.Statement); var elseNode = node.Else; @@ -30,7 +21,7 @@ public override void VisitIfStatement(IfStatementSyntax node) var section = new IfElseSection(); ifStatement.Sections.Add(section); - var elseInvocationAnalyzer = new InvocationsAnalyzer(this.semanticModel, section.Statements); + var elseInvocationAnalyzer = new InvocationsAnalyzer(semanticModel, section.Statements); elseInvocationAnalyzer.Visit(elseNode.Statement); if (elseNode.Statement.IsKind(SyntaxKind.IfStatement)) @@ -50,7 +41,7 @@ public override void VisitIfStatement(IfStatementSyntax node) public override void VisitSwitchStatement(SwitchStatementSyntax node) { var switchStatement = new Switch(); - this.statements.Add(switchStatement); + statements.Add(switchStatement); switchStatement.Expression = node.Expression.ToString(); @@ -61,7 +52,7 @@ public override void VisitSwitchStatement(SwitchStatementSyntax node) switchSection.Labels.AddRange(section.Labels.Select(l => Label(l))); - var invocationAnalyzer = new InvocationsAnalyzer(this.semanticModel, switchSection.Statements); + var invocationAnalyzer = new InvocationsAnalyzer(semanticModel, switchSection.Statements); invocationAnalyzer.Visit(section); } } diff --git a/src/LivingDocumentation.Analyzer/Analyzers/InvocationsAnalyzer.cs b/src/LivingDocumentation.Analyzer/Analyzers/InvocationsAnalyzer.cs index 44a7c6f..82c2798 100644 --- a/src/LivingDocumentation.Analyzer/Analyzers/InvocationsAnalyzer.cs +++ b/src/LivingDocumentation.Analyzer/Analyzers/InvocationsAnalyzer.cs @@ -1,28 +1,19 @@ namespace LivingDocumentation; -internal class InvocationsAnalyzer : CSharpSyntaxWalker +internal class InvocationsAnalyzer(SemanticModel semanticModel, List statements) : CSharpSyntaxWalker { - private readonly SemanticModel semanticModel; - private readonly List statements; - - public InvocationsAnalyzer(in SemanticModel semanticModel, List statements) - { - this.semanticModel = semanticModel; - this.statements = statements; - } - public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) { - string containingType = this.semanticModel.GetTypeDisplayString(node); + string containingType = semanticModel.GetTypeDisplayString(node); var invocation = new InvocationDescription(containingType, node.Type.ToString()); - this.statements.Add(invocation); + statements.Add(invocation); if (node.ArgumentList != null) { foreach (var argument in node.ArgumentList.Arguments) { - var argumentDescription = new ArgumentDescription(this.semanticModel.GetTypeDisplayString(argument.Expression), argument.Expression.ToString()); + var argumentDescription = new ArgumentDescription(semanticModel.GetTypeDisplayString(argument.Expression), argument.Expression.ToString()); invocation.Arguments.Add(argumentDescription); } } @@ -31,7 +22,7 @@ public override void VisitObjectCreationExpression(ObjectCreationExpressionSynta { foreach (var expression in node.Initializer.Expressions) { - var argumentDescription = new ArgumentDescription(this.semanticModel.GetTypeDisplayString(expression), expression.ToString()); + var argumentDescription = new ArgumentDescription(semanticModel.GetTypeDisplayString(expression), expression.ToString()); invocation.Arguments.Add(argumentDescription); } } @@ -41,19 +32,19 @@ public override void VisitObjectCreationExpression(ObjectCreationExpressionSynta public override void VisitSwitchStatement(SwitchStatementSyntax node) { - var branchingAnalyzer = new BranchingAnalyzer(this.semanticModel, this.statements); + var branchingAnalyzer = new BranchingAnalyzer(semanticModel, statements); branchingAnalyzer.Visit(node); } public override void VisitIfStatement(IfStatementSyntax node) { - var branchingAnalyzer = new BranchingAnalyzer(this.semanticModel, this.statements); + var branchingAnalyzer = new BranchingAnalyzer(semanticModel, statements); branchingAnalyzer.Visit(node); } public override void VisitForEachStatement(ForEachStatementSyntax node) { - var loopingAnalyzer = new LoopingAnalyzer(this.semanticModel, this.statements); + var loopingAnalyzer = new LoopingAnalyzer(semanticModel, statements); loopingAnalyzer.Visit(node); } @@ -61,23 +52,23 @@ public override void VisitInvocationExpression(InvocationExpressionSyntax node) { var expression = this.GetExpressionWithSymbol(node); - if (Program.RuntimeOptions.VerboseOutput && this.semanticModel.GetSymbolInfo(expression).Symbol == null) + if (Program.RuntimeOptions.VerboseOutput && semanticModel.GetSymbolInfo(expression).Symbol == null) { Console.WriteLine("WARN: Could not resolve type of invocation of the following block:"); Console.WriteLine(node.ToFullString()); return; } - if (this.semanticModel.GetConstantValue(node).HasValue && string.Equals((node.Expression as IdentifierNameSyntax)?.Identifier.ValueText, "nameof", StringComparison.Ordinal)) + if (semanticModel.GetConstantValue(node).HasValue && string.Equals((node.Expression as IdentifierNameSyntax)?.Identifier.ValueText, "nameof", StringComparison.Ordinal)) { // nameof is compiler sugar, and is actually a method we are not interrested in return; } - var containingType = this.semanticModel.GetSymbolInfo(expression).Symbol?.ContainingSymbol.ToDisplayString(); + var containingType = semanticModel.GetSymbolInfo(expression).Symbol?.ContainingSymbol.ToDisplayString(); if (containingType == null) { - containingType = this.semanticModel.GetSymbolInfo(expression).CandidateSymbols.FirstOrDefault()?.ContainingSymbol.ToDisplayString(); + containingType = semanticModel.GetSymbolInfo(expression).CandidateSymbols.FirstOrDefault()?.ContainingSymbol.ToDisplayString(); } var methodName = string.Empty; @@ -93,13 +84,13 @@ public override void VisitInvocationExpression(InvocationExpressionSyntax node) } var invocation = new InvocationDescription(containingType, methodName); - this.statements.Add(invocation); + statements.Add(invocation); foreach (var argument in node.ArgumentList.Arguments) { - var value = argument.Expression.ResolveValue(this.semanticModel); + var value = argument.Expression.ResolveValue(semanticModel); - var argumentDescription = new ArgumentDescription(this.semanticModel.GetTypeDisplayString(argument.Expression), value); + var argumentDescription = new ArgumentDescription(semanticModel.GetTypeDisplayString(argument.Expression), value); invocation.Arguments.Add(argumentDescription); } @@ -110,12 +101,12 @@ private ExpressionSyntax GetExpressionWithSymbol(InvocationExpressionSyntax node { var expression = node.Expression; - if (this.semanticModel.GetSymbolInfo(expression).Symbol == null) + if (semanticModel.GetSymbolInfo(expression).Symbol == null) { // This might be part of a chain of extention methods (f.e. Fluent API's), the symbols are only available at the beginning of the chain. var pNode = (SyntaxNode)node; - while (pNode != null && (pNode is not InvocationExpressionSyntax || (pNode is InvocationExpressionSyntax && (this.semanticModel.GetTypeInfo(pNode).Type?.Kind == SymbolKind.ErrorType || this.semanticModel.GetSymbolInfo(expression).Symbol == null)))) + while (pNode != null && (pNode is not InvocationExpressionSyntax || (pNode is InvocationExpressionSyntax && (semanticModel.GetTypeInfo(pNode).Type?.Kind == SymbolKind.ErrorType || semanticModel.GetSymbolInfo(expression).Symbol == null)))) { pNode = pNode.Parent; @@ -131,16 +122,16 @@ private ExpressionSyntax GetExpressionWithSymbol(InvocationExpressionSyntax node public override void VisitReturnStatement(ReturnStatementSyntax node) { - var returnDescription = new ReturnDescription(node.Expression?.ResolveValue(this.semanticModel) ?? string.Empty); - this.statements.Add(returnDescription); + var returnDescription = new ReturnDescription(node.Expression?.ResolveValue(semanticModel) ?? string.Empty); + statements.Add(returnDescription); base.VisitReturnStatement(node); } public override void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) { - var returnDescription = new ReturnDescription(node.Expression.ResolveValue(this.semanticModel)); - this.statements.Add(returnDescription); + var returnDescription = new ReturnDescription(node.Expression.ResolveValue(semanticModel)); + statements.Add(returnDescription); base.VisitArrowExpressionClause(node); } @@ -148,7 +139,7 @@ public override void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node public override void VisitAssignmentExpression(AssignmentExpressionSyntax node) { var assignmentDescription = new AssignmentDescription(node.Left.ToString(), node.OperatorToken.Text, node.Right.ToString()); - this.statements.Add(assignmentDescription); + statements.Add(assignmentDescription); base.VisitAssignmentExpression(node); } diff --git a/src/LivingDocumentation.Analyzer/Analyzers/LoopingAnalyzer.cs b/src/LivingDocumentation.Analyzer/Analyzers/LoopingAnalyzer.cs index c09c0c3..8a430ee 100644 --- a/src/LivingDocumentation.Analyzer/Analyzers/LoopingAnalyzer.cs +++ b/src/LivingDocumentation.Analyzer/Analyzers/LoopingAnalyzer.cs @@ -1,24 +1,15 @@ namespace LivingDocumentation; -internal class LoopingAnalyzer : CSharpSyntaxWalker +internal class LoopingAnalyzer(SemanticModel semanticModel, List statements) : CSharpSyntaxWalker { - private readonly SemanticModel semanticModel; - private readonly List statements; - - public LoopingAnalyzer(in SemanticModel semanticModel, List statements) - { - this.semanticModel = semanticModel; - this.statements = statements; - } - public override void VisitForEachStatement(ForEachStatementSyntax node) { var forEachStatement = new ForEach(); - this.statements.Add(forEachStatement); + statements.Add(forEachStatement); forEachStatement.Expression = $"{node.Identifier} in {node.Expression}"; - var invocationAnalyzer = new InvocationsAnalyzer(this.semanticModel, forEachStatement.Statements); + var invocationAnalyzer = new InvocationsAnalyzer(semanticModel, forEachStatement.Statements); invocationAnalyzer.Visit(node.Statement); } } diff --git a/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs b/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs index 80097dc..c5071b8 100644 --- a/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs +++ b/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs @@ -1,18 +1,9 @@ namespace LivingDocumentation; -public class SourceAnalyzer : CSharpSyntaxWalker +public class SourceAnalyzer(SemanticModel semanticModel, List types) : CSharpSyntaxWalker { - private readonly SemanticModel semanticModel; - private readonly List types; - private TypeDescription? currentType = null; - public SourceAnalyzer(in SemanticModel semanticModel, List types) - { - this.types = types; - this.semanticModel = semanticModel; - } - public override void VisitClassDeclaration(ClassDeclarationSyntax node) { if (this.ProcessedEmbeddedType(node)) return; @@ -38,7 +29,7 @@ public override void VisitRecordDeclaration(RecordDeclarationSyntax node) base.VisitRecordDeclaration(node); // Check for parts that are generated and not declared by the author - var symbol = this.semanticModel.GetDeclaredSymbol(node); + var symbol = semanticModel.GetDeclaredSymbol(node); if (symbol != null) { foreach (var constructor in symbol.Constructors) @@ -117,14 +108,14 @@ public override void VisitFieldDeclaration(FieldDeclarationSyntax node) foreach (var variable in node.Declaration.Variables) { - var fieldDescription = new FieldDescription(this.semanticModel.GetTypeDisplayString(node.Declaration.Type), variable.Identifier.ValueText); + var fieldDescription = new FieldDescription(semanticModel.GetTypeDisplayString(node.Declaration.Type), variable.Identifier.ValueText); this.currentType.AddMember(fieldDescription); fieldDescription.Modifiers |= ParseModifiers(node.Modifiers); this.EnsureMemberDefaultAccessModifier(fieldDescription); this.ExtractAttributes(node.AttributeLists, fieldDescription.Attributes); - fieldDescription.Initializer = variable.Initializer?.Value.ResolveValue(this.semanticModel); + fieldDescription.Initializer = variable.Initializer?.Value.ResolveValue(semanticModel); fieldDescription.DocumentationComments = this.ExtractDocumentation(variable); } @@ -137,14 +128,14 @@ public override void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node foreach (var variable in node.Declaration.Variables) { - var eventDescription = new EventDescription(this.semanticModel.GetTypeDisplayString(node.Declaration.Type), variable.Identifier.ValueText); + var eventDescription = new EventDescription(semanticModel.GetTypeDisplayString(node.Declaration.Type), variable.Identifier.ValueText); this.currentType.AddMember(eventDescription); eventDescription.Modifiers |= ParseModifiers(node.Modifiers); this.EnsureMemberDefaultAccessModifier(eventDescription); this.ExtractAttributes(node.AttributeLists, eventDescription.Attributes); - eventDescription.Initializer = variable.Initializer?.Value.ResolveValue(this.semanticModel); + eventDescription.Initializer = variable.Initializer?.Value.ResolveValue(semanticModel); eventDescription.DocumentationComments = this.ExtractDocumentation(variable); } @@ -155,14 +146,14 @@ public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node) { if (this.currentType is null) return; - var propertyDescription = new PropertyDescription(this.semanticModel.GetTypeDisplayString(node.Type), node.Identifier.ToString()); + var propertyDescription = new PropertyDescription(semanticModel.GetTypeDisplayString(node.Type), node.Identifier.ToString()); this.currentType.AddMember(propertyDescription); propertyDescription.Modifiers |= ParseModifiers(node.Modifiers); this.EnsureMemberDefaultAccessModifier(propertyDescription); this.ExtractAttributes(node.AttributeLists, propertyDescription.Attributes); - propertyDescription.Initializer = node.Initializer?.Value.ResolveValue(this.semanticModel); + propertyDescription.Initializer = node.Initializer?.Value.ResolveValue(semanticModel); propertyDescription.DocumentationComments = this.ExtractDocumentation(node); base.VisitPropertyDeclaration(node); @@ -197,7 +188,7 @@ public override void VisitMethodDeclaration(MethodDeclarationSyntax node) { if (this.currentType is null) return; - var methodDescription = new MethodDescription(this.semanticModel.GetTypeInfo(node.ReturnType).Type?.ToDisplayString(), node.Identifier.ToString()); + var methodDescription = new MethodDescription(semanticModel.GetTypeInfo(node.ReturnType).Type?.ToDisplayString(), node.Identifier.ToString()); this.currentType.AddMember(methodDescription); this.ExtractBaseMethodDeclaration(node, methodDescription); @@ -207,20 +198,20 @@ public override void VisitMethodDeclaration(MethodDeclarationSyntax node) private void ExtractBaseTypeDeclaration(TypeType type, BaseTypeDeclarationSyntax node) { - var currentType = new TypeDescription(type, this.semanticModel.GetDeclaredSymbol(node)?.ToDisplayString()); - if (!this.types.Contains(currentType)) + var currentType = new TypeDescription(type, semanticModel.GetDeclaredSymbol(node)?.ToDisplayString()); + if (!types.Contains(currentType)) { - this.types.Add(currentType); + types.Add(currentType); this.currentType = currentType; } else { - this.currentType = this.types.First(t => string.Equals(t.FullName, currentType.FullName, StringComparison.Ordinal)); + this.currentType = types.First(t => string.Equals(t.FullName, currentType.FullName, StringComparison.Ordinal)); } if (node.BaseList != null) { - this.currentType.BaseTypes.AddRange(node.BaseList.Types.Select(t => this.semanticModel.GetTypeDisplayString(t.Type))); + this.currentType.BaseTypes.AddRange(node.BaseList.Types.Select(t => semanticModel.GetTypeDisplayString(t.Type))); } this.currentType.Modifiers |= ParseModifiers(node.Modifiers); @@ -269,7 +260,7 @@ private bool ProcessedEmbeddedType(SyntaxNode node) return false; } - var embeddedAnalyzer = new SourceAnalyzer(this.semanticModel, this.types); + var embeddedAnalyzer = new SourceAnalyzer(semanticModel, types); embeddedAnalyzer.Visit(node); return true; @@ -284,16 +275,16 @@ private void ExtractAttributes(SyntaxList attributes, List< foreach (var attribute in attributes.SelectMany(a => a.Attributes)) { - var attributeDescription = new AttributeDescription(this.semanticModel.GetTypeDisplayString(attribute), attribute.Name.ToString()); + var attributeDescription = new AttributeDescription(semanticModel.GetTypeDisplayString(attribute), attribute.Name.ToString()); attributeDescriptions.Add(attributeDescription); if (attribute.ArgumentList != null) { foreach (var argument in attribute.ArgumentList.Arguments) { - var value = argument.Expression!.ResolveValue(this.semanticModel); + var value = argument.Expression!.ResolveValue(semanticModel); - var argumentDescription = new AttributeArgumentDescription(argument.NameEquals?.Name.ToString() ?? argument.Expression.ResolveValue(this.semanticModel), this.semanticModel.GetTypeDisplayString(argument.Expression!), value); + var argumentDescription = new AttributeArgumentDescription(argument.NameEquals?.Name.ToString() ?? argument.Expression.ResolveValue(semanticModel), semanticModel.GetTypeDisplayString(argument.Expression!), value); attributeDescription.Arguments.Add(argumentDescription); } } @@ -302,7 +293,7 @@ private void ExtractAttributes(SyntaxList attributes, List< private DocumentationCommentsDescription? ExtractDocumentation(SyntaxNode node) { - return DocumentationCommentsDescription.Parse(this.semanticModel.GetDeclaredSymbol(node)?.GetDocumentationCommentXml()); + return DocumentationCommentsDescription.Parse(semanticModel.GetDeclaredSymbol(node)?.GetDocumentationCommentXml()); } private void ExtractBaseMethodDeclaration(BaseMethodDeclarationSyntax node, IHaveAMethodBody method) @@ -315,14 +306,14 @@ private void ExtractBaseMethodDeclaration(BaseMethodDeclarationSyntax node, IHav foreach (var parameter in node.ParameterList.Parameters) { - var parameterDescription = new ParameterDescription(this.semanticModel.GetTypeDisplayString(parameter.Type!), parameter.Identifier.ToString()); + var parameterDescription = new ParameterDescription(semanticModel.GetTypeDisplayString(parameter.Type!), parameter.Identifier.ToString()); method.Parameters.Add(parameterDescription); parameterDescription.HasDefaultValue = parameter.Default != null; this.ExtractAttributes(parameter.AttributeLists, parameterDescription.Attributes); } - var invocationAnalyzer = new InvocationsAnalyzer(this.semanticModel, method.Statements); + var invocationAnalyzer = new InvocationsAnalyzer(semanticModel, method.Statements); invocationAnalyzer.Visit((SyntaxNode?)node.Body ?? node.ExpressionBody); } diff --git a/src/LivingDocumentation.Descriptions/ArgumentDescription.cs b/src/LivingDocumentation.Descriptions/ArgumentDescription.cs index 2e21b0c..7ce1a77 100644 --- a/src/LivingDocumentation.Descriptions/ArgumentDescription.cs +++ b/src/LivingDocumentation.Descriptions/ArgumentDescription.cs @@ -1,15 +1,9 @@ namespace LivingDocumentation; [DebuggerDisplay("Argument {Text} ({Type,nq})")] -public class ArgumentDescription +public class ArgumentDescription(string type, string text) { - public string Type { get; } + public string Type { get; } = type ?? throw new ArgumentNullException(nameof(type)); - public string Text { get; } - - public ArgumentDescription(string type, string text) - { - this.Type = type ?? throw new ArgumentNullException(nameof(type)); - this.Text = text ?? throw new ArgumentNullException(nameof(text)); - } + public string Text { get; } = text ?? throw new ArgumentNullException(nameof(text)); } diff --git a/src/LivingDocumentation.Descriptions/AssignmentDescription.cs b/src/LivingDocumentation.Descriptions/AssignmentDescription.cs index 492fe0e..90ef015 100644 --- a/src/LivingDocumentation.Descriptions/AssignmentDescription.cs +++ b/src/LivingDocumentation.Descriptions/AssignmentDescription.cs @@ -1,18 +1,11 @@ namespace LivingDocumentation; [DebuggerDisplay("Assignment \"{Left,nq} {Operator,nq} {Right,nq}\"")] -public class AssignmentDescription : Statement +public class AssignmentDescription(string left, string @operator, string right) : Statement { - public string Left { get; } + public string Left { get; } = left ?? throw new ArgumentNullException(nameof(left)); - public string Operator { get; } + public string Operator { get; } = @operator ?? throw new ArgumentNullException(nameof(@operator)); - public string Right { get; } - - public AssignmentDescription(string left, string @operator, string right) - { - this.Left = left ?? throw new ArgumentNullException(nameof(left)); - this.Operator = @operator ?? throw new ArgumentNullException(nameof(@operator)); - this.Right = right ?? throw new ArgumentNullException(nameof(right)); - } + public string Right { get; } = right ?? throw new ArgumentNullException(nameof(right)); } diff --git a/src/LivingDocumentation.Descriptions/AttributeArgumentDescription.cs b/src/LivingDocumentation.Descriptions/AttributeArgumentDescription.cs index 79caf6d..2a34d1b 100644 --- a/src/LivingDocumentation.Descriptions/AttributeArgumentDescription.cs +++ b/src/LivingDocumentation.Descriptions/AttributeArgumentDescription.cs @@ -1,18 +1,11 @@ namespace LivingDocumentation; [DebuggerDisplay("AttributeArgument {Name} {Type} {Value}")] -public class AttributeArgumentDescription : IAttributeArgumentDescription +public class AttributeArgumentDescription(string? name, string? type, string? value) : IAttributeArgumentDescription { - public string Name { get; } + public string Name { get; } = name ?? throw new ArgumentNullException("name"); - public string Type { get; } + public string Type { get; } = type ?? throw new ArgumentNullException("type"); - public string Value { get; } - - public AttributeArgumentDescription(string? name, string? type, string? value) - { - this.Name = name ?? throw new ArgumentNullException("name"); - this.Type = type ?? throw new ArgumentNullException("type"); - this.Value = value ?? throw new ArgumentNullException("value"); - } + public string Value { get; } = value ?? throw new ArgumentNullException("value"); } diff --git a/src/LivingDocumentation.Descriptions/AttributeDescription.cs b/src/LivingDocumentation.Descriptions/AttributeDescription.cs index b52775d..000da71 100644 --- a/src/LivingDocumentation.Descriptions/AttributeDescription.cs +++ b/src/LivingDocumentation.Descriptions/AttributeDescription.cs @@ -1,19 +1,13 @@ namespace LivingDocumentation; [DebuggerDisplay("Attribute {Type} {Name}")] -public class AttributeDescription : IAttributeDescription +public class AttributeDescription(string? type, string? name) : IAttributeDescription { - public string Type { get; } + public string Type { get; } = type ?? throw new ArgumentNullException(nameof(type)); - public string Name { get; } + public string Name { get; } = name ?? throw new ArgumentNullException(nameof(name)); [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] public List Arguments { get; } = []; - - public AttributeDescription(string? type, string? name) - { - this.Type = type ?? throw new ArgumentNullException(nameof(type)); - this.Name = name ?? throw new ArgumentNullException(nameof(name)); - } } diff --git a/src/LivingDocumentation.Descriptions/ConstructorDescription.cs b/src/LivingDocumentation.Descriptions/ConstructorDescription.cs index d826bfb..aec8f42 100644 --- a/src/LivingDocumentation.Descriptions/ConstructorDescription.cs +++ b/src/LivingDocumentation.Descriptions/ConstructorDescription.cs @@ -1,7 +1,7 @@ namespace LivingDocumentation; [DebuggerDisplay("Constructor {Name}")] -public class ConstructorDescription : MemberDescription, IHaveAMethodBody +public class ConstructorDescription(string name) : MemberDescription(name), IHaveAMethodBody { [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] @@ -11,11 +11,6 @@ public class ConstructorDescription : MemberDescription, IHaveAMethodBody public override MemberType MemberType => MemberType.Constructor; - public ConstructorDescription(string name) - : base(name) - { - } - [OnDeserialized] internal void OnDeserializedMethod(StreamingContext context) { diff --git a/src/LivingDocumentation.Descriptions/EnumMemberDescription.cs b/src/LivingDocumentation.Descriptions/EnumMemberDescription.cs index 2ca40d1..e3e8bd2 100644 --- a/src/LivingDocumentation.Descriptions/EnumMemberDescription.cs +++ b/src/LivingDocumentation.Descriptions/EnumMemberDescription.cs @@ -1,15 +1,9 @@ namespace LivingDocumentation; [DebuggerDisplay("EnumMember {Name,nq}")] -public class EnumMemberDescription : MemberDescription +public class EnumMemberDescription(string name, string? value) : MemberDescription(name) { - public string? Value { get; } + public string? Value { get; } = value; public override MemberType MemberType => MemberType.EnumMember; - - public EnumMemberDescription(string name, string? value) - : base(name) - { - this.Value = value; - } } diff --git a/src/LivingDocumentation.Descriptions/EventDescription.cs b/src/LivingDocumentation.Descriptions/EventDescription.cs index d02a286..2ae3259 100644 --- a/src/LivingDocumentation.Descriptions/EventDescription.cs +++ b/src/LivingDocumentation.Descriptions/EventDescription.cs @@ -1,9 +1,9 @@ namespace LivingDocumentation; [DebuggerDisplay("Event {Type,nq} {Name,nq}")] -public class EventDescription : MemberDescription +public class EventDescription(string type, string name) : MemberDescription(name) { - public string Type { get; } + public string Type { get; } = type ?? throw new ArgumentNullException(nameof(type)); public string? Initializer { get; set; } @@ -11,10 +11,4 @@ public class EventDescription : MemberDescription public bool HasInitializer => this.Initializer is not null; public override MemberType MemberType => MemberType.Event; - - public EventDescription(string type, string name) - : base(name) - { - this.Type = type ?? throw new ArgumentNullException(nameof(type)); - } } diff --git a/src/LivingDocumentation.Descriptions/FieldDescription.cs b/src/LivingDocumentation.Descriptions/FieldDescription.cs index 134aef0..6bb00bb 100644 --- a/src/LivingDocumentation.Descriptions/FieldDescription.cs +++ b/src/LivingDocumentation.Descriptions/FieldDescription.cs @@ -1,9 +1,9 @@ namespace LivingDocumentation; [DebuggerDisplay("Field {Type,nq} {Name,nq}")] -public class FieldDescription : MemberDescription +public class FieldDescription(string type, string name) : MemberDescription(name) { - public string Type { get; } + public string Type { get; } = type ?? throw new ArgumentNullException(nameof(type)); public string? Initializer { get; set; } @@ -11,10 +11,4 @@ public class FieldDescription : MemberDescription public bool HasInitializer => this.Initializer is not null; public override MemberType MemberType => MemberType.Field; - - public FieldDescription(string type, string name) - : base(name) - { - this.Type = type ?? throw new ArgumentNullException(nameof(type)); - } } diff --git a/src/LivingDocumentation.Descriptions/InvocationDescription.cs b/src/LivingDocumentation.Descriptions/InvocationDescription.cs index d5ba0c7..e2e7841 100644 --- a/src/LivingDocumentation.Descriptions/InvocationDescription.cs +++ b/src/LivingDocumentation.Descriptions/InvocationDescription.cs @@ -1,17 +1,11 @@ namespace LivingDocumentation; [DebuggerDisplay("Invocation \"{ContainingType,nq}.{Name,nq}\"")] -public class InvocationDescription : Statement +public class InvocationDescription(string containingType, string name) : Statement { - public string ContainingType { get; } + public string ContainingType { get; } = containingType ?? throw new ArgumentNullException(nameof(containingType)); - public string Name { get; } + public string Name { get; } = name ?? throw new ArgumentNullException(nameof(name)); public List Arguments { get; } = []; - - public InvocationDescription(string containingType, string name) - { - this.ContainingType = containingType ?? throw new ArgumentNullException(nameof(containingType)); - this.Name = name ?? throw new ArgumentNullException(nameof(name)); - } } diff --git a/src/LivingDocumentation.Descriptions/MemberDescription.cs b/src/LivingDocumentation.Descriptions/MemberDescription.cs index dfad8ff..cd10bb3 100644 --- a/src/LivingDocumentation.Descriptions/MemberDescription.cs +++ b/src/LivingDocumentation.Descriptions/MemberDescription.cs @@ -1,10 +1,10 @@ namespace LivingDocumentation; -public abstract class MemberDescription : IMemberable +public abstract class MemberDescription(string name) : IMemberable { public abstract MemberType MemberType { get; } - public string Name { get; } + public string Name { get; } = name ?? throw new ArgumentNullException("name"); [DefaultValue(Modifier.Private)] [JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] @@ -20,11 +20,6 @@ public abstract class MemberDescription : IMemberable [JsonConverter(typeof(ConcreteTypeConverter>))] public List Attributes { get; } = []; - public MemberDescription(string name) - { - this.Name = name ?? throw new ArgumentNullException("name"); - } - public override bool Equals(object obj) { if (obj is not MemberDescription other) diff --git a/src/LivingDocumentation.Descriptions/MethodDescription.cs b/src/LivingDocumentation.Descriptions/MethodDescription.cs index 328edc9..5e14d39 100644 --- a/src/LivingDocumentation.Descriptions/MethodDescription.cs +++ b/src/LivingDocumentation.Descriptions/MethodDescription.cs @@ -1,10 +1,10 @@ namespace LivingDocumentation; [DebuggerDisplay("Method {ReturnType,nq} {Name,nq}")] -public class MethodDescription : MemberDescription, IHaveAMethodBody +public class MethodDescription(string? returnType, string name) : MemberDescription(name), IHaveAMethodBody { [DefaultValue("void")] - public string ReturnType { get; } + public string ReturnType { get; } = returnType ?? "void"; [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] @@ -13,12 +13,6 @@ public class MethodDescription : MemberDescription, IHaveAMethodBody public List Statements { get; } = []; public override MemberType MemberType => MemberType.Method; - - public MethodDescription(string? returnType, string name) - : base(name) - { - this.ReturnType = returnType ?? "void"; - } [OnDeserialized] internal void OnDeserializedMethod(StreamingContext context) diff --git a/src/LivingDocumentation.Descriptions/ParameterDescription.cs b/src/LivingDocumentation.Descriptions/ParameterDescription.cs index 4d30026..c2de16a 100644 --- a/src/LivingDocumentation.Descriptions/ParameterDescription.cs +++ b/src/LivingDocumentation.Descriptions/ParameterDescription.cs @@ -1,21 +1,15 @@ namespace LivingDocumentation; [DebuggerDisplay("Parameter {Type} {Name}")] -public class ParameterDescription : IParameterDescription +public class ParameterDescription(string type, string name) : IParameterDescription { - public string Type { get; } + public string Type { get; } = type ?? throw new ArgumentNullException(nameof(type)); - public string Name { get; } + public string Name { get; } = name ?? throw new ArgumentNullException(nameof(name)); public bool HasDefaultValue { get; set; } [JsonProperty(ItemTypeNameHandling = TypeNameHandling.None)] [JsonConverter(typeof(ConcreteTypeConverter>))] public List Attributes { get; } = []; - - public ParameterDescription(string type, string name) - { - this.Type = type ?? throw new ArgumentNullException(nameof(type)); - this.Name = name ?? throw new ArgumentNullException(nameof(name)); - } } diff --git a/src/LivingDocumentation.Descriptions/PropertyDescription.cs b/src/LivingDocumentation.Descriptions/PropertyDescription.cs index 7533e40..8756c94 100644 --- a/src/LivingDocumentation.Descriptions/PropertyDescription.cs +++ b/src/LivingDocumentation.Descriptions/PropertyDescription.cs @@ -1,9 +1,9 @@ namespace LivingDocumentation; [DebuggerDisplay("Property {Type,nq} {Name,nq}")] -public class PropertyDescription : MemberDescription +public class PropertyDescription(string type, string name) : MemberDescription(name) { - public string Type { get; } + public string Type { get; } = type ?? throw new ArgumentNullException(nameof(type)); public string? Initializer { get; set; } @@ -11,10 +11,4 @@ public class PropertyDescription : MemberDescription public bool HasInitializer => !string.IsNullOrWhiteSpace(this.Initializer); public override MemberType MemberType => MemberType.Property; - - public PropertyDescription(string type, string name) - : base(name) - { - this.Type = type ?? throw new ArgumentNullException(nameof(type)); - } } diff --git a/src/LivingDocumentation.Descriptions/ReturnDescription.cs b/src/LivingDocumentation.Descriptions/ReturnDescription.cs index 2f4d248..ae1ddda 100644 --- a/src/LivingDocumentation.Descriptions/ReturnDescription.cs +++ b/src/LivingDocumentation.Descriptions/ReturnDescription.cs @@ -1,12 +1,7 @@ namespace LivingDocumentation; [DebuggerDisplay("Return {Expression}")] -public class ReturnDescription : Statement +public class ReturnDescription(string expression) : Statement { - public string Expression { get; } - - public ReturnDescription(string expression) - { - this.Expression = expression; - } + public string Expression { get; } = expression; } diff --git a/src/LivingDocumentation.Descriptions/TypeDescription.cs b/src/LivingDocumentation.Descriptions/TypeDescription.cs index 370c794..9e0bd68 100644 --- a/src/LivingDocumentation.Descriptions/TypeDescription.cs +++ b/src/LivingDocumentation.Descriptions/TypeDescription.cs @@ -1,7 +1,7 @@ namespace LivingDocumentation; [DebuggerDisplay("{Type} {Name,nq} ({Namespace,nq})")] -public class TypeDescription : IHaveModifiers +public class TypeDescription(TypeType type, string? fullName) : IHaveModifiers { [JsonProperty(Order = 1, PropertyName = nameof(Fields))] private readonly List fields = []; @@ -21,15 +21,9 @@ public class TypeDescription : IHaveModifiers [JsonProperty(Order = 6, PropertyName = nameof(Events))] private readonly List events = []; - public TypeDescription(TypeType type, string? fullName) - { - this.Type = type; - this.FullName = fullName ?? string.Empty; - } - - public TypeType Type { get; } + public TypeType Type { get; } = type; - public string FullName { get; } + public string FullName { get; } = fullName ?? string.Empty; public DocumentationCommentsDescription? DocumentationComments { get; set; } diff --git a/tests/LivingDocumentation.Descriptions.Tests/TypeDescriptionTests.cs b/tests/LivingDocumentation.Descriptions.Tests/TypeDescriptionTests.cs index 64cd431..3d88e31 100644 --- a/tests/LivingDocumentation.Descriptions.Tests/TypeDescriptionTests.cs +++ b/tests/LivingDocumentation.Descriptions.Tests/TypeDescriptionTests.cs @@ -295,12 +295,8 @@ public void TypeDescription_ImplementsTypeStartsWith_DoesNotHaveBaseType_Should_ implementsType.Should().BeFalse(); } - private class UnsupportedMemberDescription : MemberDescription + private class UnsupportedMemberDescription(string name) : MemberDescription(name) { - public UnsupportedMemberDescription(string name) : base(name) - { - } - public override MemberType MemberType => throw new NotImplementedException(); } } From 17bb45549aa06541ed21af795907c4cd014e9807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Thu, 23 Nov 2023 22:32:57 +0100 Subject: [PATCH 15/19] Match nullability of overridden members --- .../Json/ConcreteTypeConverter.cs | 4 ++-- src/LivingDocumentation.Descriptions/MemberDescription.cs | 2 +- src/LivingDocumentation.Descriptions/TypeDescription.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/LivingDocumentation.Descriptions/Json/ConcreteTypeConverter.cs b/src/LivingDocumentation.Descriptions/Json/ConcreteTypeConverter.cs index f9f2916..e53798c 100644 --- a/src/LivingDocumentation.Descriptions/Json/ConcreteTypeConverter.cs +++ b/src/LivingDocumentation.Descriptions/Json/ConcreteTypeConverter.cs @@ -7,12 +7,12 @@ public override bool CanConvert(Type objectType) return true; } - public override object? ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { return serializer.Deserialize(reader); } - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { serializer.TypeNameHandling = TypeNameHandling.None; diff --git a/src/LivingDocumentation.Descriptions/MemberDescription.cs b/src/LivingDocumentation.Descriptions/MemberDescription.cs index cd10bb3..1ef43b5 100644 --- a/src/LivingDocumentation.Descriptions/MemberDescription.cs +++ b/src/LivingDocumentation.Descriptions/MemberDescription.cs @@ -20,7 +20,7 @@ public abstract class MemberDescription(string name) : IMemberable [JsonConverter(typeof(ConcreteTypeConverter>))] public List Attributes { get; } = []; - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is not MemberDescription other) { diff --git a/src/LivingDocumentation.Descriptions/TypeDescription.cs b/src/LivingDocumentation.Descriptions/TypeDescription.cs index 9e0bd68..0ce3903 100644 --- a/src/LivingDocumentation.Descriptions/TypeDescription.cs +++ b/src/LivingDocumentation.Descriptions/TypeDescription.cs @@ -94,7 +94,7 @@ public void AddMember(MemberDescription member) } } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is not TypeDescription other) { From e422c71b5e86c6805b81310da3166e30a0884cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Fri, 24 Nov 2023 21:48:00 +0100 Subject: [PATCH 16/19] Remove preprocessor directives --- src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs b/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs index c5071b8..58fb3ac 100644 --- a/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs +++ b/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs @@ -13,7 +13,6 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node) base.VisitClassDeclaration(node); } -#if NET6_0_OR_GREATER public override void VisitRecordDeclaration(RecordDeclarationSyntax node) { if (this.ProcessedEmbeddedType(node)) return; @@ -73,7 +72,6 @@ public override void VisitRecordDeclaration(RecordDeclarationSyntax node) } } } -#endif public override void VisitEnumDeclaration(EnumDeclarationSyntax node) { From 692a280cb6d885a62fa2094f437ac24a1ef3fe0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Fri, 22 Dec 2023 23:21:34 +0100 Subject: [PATCH 17/19] Fix type of SeparatedSyntaxList --- .../Extensions/ExpressionSyntaxExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LivingDocumentation.Analyzer/Extensions/ExpressionSyntaxExtensions.cs b/src/LivingDocumentation.Analyzer/Extensions/ExpressionSyntaxExtensions.cs index 539dd5d..329f41f 100644 --- a/src/LivingDocumentation.Analyzer/Extensions/ExpressionSyntaxExtensions.cs +++ b/src/LivingDocumentation.Analyzer/Extensions/ExpressionSyntaxExtensions.cs @@ -25,7 +25,7 @@ private static string FormatObjectCreation(ObjectCreationExpressionSyntax object var initializer = objectCreation.Initializer; if (initializer is not null) { - var expressions = new SeparatedSyntaxList(); + var expressions = new SeparatedSyntaxList(); foreach (var expression in initializer.Expressions) { @@ -46,7 +46,7 @@ private static string FormatArrayCreation(ArrayCreationExpressionSyntax arrayCre var initializer = arrayCreation.Initializer; if (initializer is not null) { - var expressions = new SeparatedSyntaxList(); + var expressions = new SeparatedSyntaxList(); foreach (var expression in initializer.Expressions) { From 784e26a70259f45c12bb568e211a754262a8f620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Fri, 24 Nov 2023 21:48:17 +0100 Subject: [PATCH 18/19] Update sample --- .../AsciiDocRenderer.cs | 9 +++++---- .../eShopOnContainerExtensions.cs | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs b/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs index 7ea9842..efc944a 100644 --- a/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs +++ b/samples/LivingDocumentation.eShopOnContainers/AsciiDocRenderer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -8,9 +8,10 @@ namespace LivingDocumentation.eShopOnContainers { - public class AsciiDocRenderer(IReadOnlyList types, IReadOnlyDictionary aggregateFiles, IReadOnlyDictionary commandHandlerFiles, IReadOnlyDictionary eventHandlerFiles) + public partial class AsciiDocRenderer(IReadOnlyList types, IReadOnlyDictionary aggregateFiles, IReadOnlyDictionary commandHandlerFiles, IReadOnlyDictionary eventHandlerFiles) { - private static readonly Regex replaceTypeSuffix = new Regex("(?:(?:Command|(?:Domain|Integration)Event))(?:Handler)?$", RegexOptions.CultureInvariant); + [GeneratedRegex("(?:(?:Command|(?:Domain|Integration)Event))(?:Handler)?$", RegexOptions.CultureInvariant)] + private static partial Regex TypeSuffix(); public void Render() { @@ -242,7 +243,7 @@ private static void RenderFileHeader(StringBuilder stringBuilder) private static string StripTypeSuffix(string name) { - return replaceTypeSuffix.Replace(name, string.Empty); + return TypeSuffix().Replace(name, string.Empty); } private static string FormatTechnicalName(string name) diff --git a/samples/LivingDocumentation.eShopOnContainers/eShopOnContainerExtensions.cs b/samples/LivingDocumentation.eShopOnContainers/eShopOnContainerExtensions.cs index 07639e1..6711bd7 100644 --- a/samples/LivingDocumentation.eShopOnContainers/eShopOnContainerExtensions.cs +++ b/samples/LivingDocumentation.eShopOnContainers/eShopOnContainerExtensions.cs @@ -1,4 +1,4 @@ -using PlantUml.Builder; +using PlantUml.Builder; using System; using System.Linq; @@ -36,27 +36,27 @@ public static string FormatForDiagram(this string name) { if (name.EndsWith(IntegrationEvent)) { - return name.Substring(0, name.Length - IntegrationEvent.Length); + return name[..^IntegrationEvent.Length]; } if (name.EndsWith(DomainEvent)) { - return name.Substring(0, name.Length - DomainEvent.Length); + return name[..^DomainEvent.Length]; } if (name.EndsWith(Command)) { - return name.Substring(0, name.Length - Command.Length); + return name[..^Command.Length]; } if (name.EndsWith(DomainEventHandler)) { - return name.Substring(0, name.Length - DomainEventHandler.Length) + "\\n//<>//"; + return name[..^DomainEventHandler.Length] + "\\n//<>//"; } if (name.EndsWith(CommandHandler)) { - return name.Substring(0, name.Length - CommandHandler.Length) + "\\n//<>//"; + return name[..^CommandHandler.Length] + "\\n//<>//"; } return name; From 51145494df28eac0d6b13a8ef49a9448810a2cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hompus?= Date: Fri, 22 Dec 2023 23:03:18 +0100 Subject: [PATCH 19/19] Add total type count to output --- src/LivingDocumentation.Analyzer/Program.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/LivingDocumentation.Analyzer/Program.cs b/src/LivingDocumentation.Analyzer/Program.cs index ec8b3cb..2022f3c 100644 --- a/src/LivingDocumentation.Analyzer/Program.cs +++ b/src/LivingDocumentation.Analyzer/Program.cs @@ -47,6 +47,7 @@ private static async Task RunApplicationAsync(Options options) if (!options.Quiet) { Console.WriteLine($"Living Documentation Analysis output generated in {stopwatch.ElapsedMilliseconds}ms at {options.OutputPath}"); + Console.WriteLine($"{types.Count} types found"); } }