diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index d51c9f0..f8a4785 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -17,7 +17,7 @@
"rollForward": false
},
"purview.build": {
- "version": "0.5.4",
+ "version": "0.7.1",
"commands": [
"purview-build"
],
diff --git a/.config/purview-build.json b/.config/purview-build.json
index 7eb26b4..558bc2c 100644
--- a/.config/purview-build.json
+++ b/.config/purview-build.json
@@ -3,8 +3,8 @@
"Solution": "src/Results.slnx",
"TestRoot": "src/tests",
"TestPatterns": "*Tests.csproj",
- "TestProjects": "*UnitTests*",
- "TestFilter": "/*/*/*/*[Category=Unit]"
+ "TestProjects": "*Tests*",
+ "TestFilter": "/*/*/*/*"
},
"PackValidation": {
// Explicit because Purview.Build 0.5.3 defaults RequiredCompilerFlags to empty. Earlier
diff --git a/.editorconfig b/.editorconfig
index 120d509..b511789 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,3 +1,23 @@
+# Purview.BuildSdk 1.1.0 - managed file, do not edit
+#
+# This file is written by Purview.BuildSdk and is replaced whenever the SDK version changes. The version
+# on the first line is how the SDK recognises a file it owns: a .editorconfig without that marker is
+# yours, and is never touched.
+#
+# To add your own rules, create a second .editorconfig in a subdirectory - `src/.editorconfig` is the
+# usual choice - without `root = true`. EditorConfig applies the nearest file last, so your settings win
+# over these, and nothing you write is lost when this file is updated.
+#
+# To stop the SDK updating this file, set one of:
+# false keep this file as it is
+# Never opt out of all bootstrapping
+# false
+#
+# Deleting the first line also works: without the marker the SDK treats the file as yours. You then own
+# every rule in it, including the ones a future SDK version would have fixed.
+#
+# See https://github.com/purview-dev/build-sdk#editorconfig for the full description.
+
root = true
# Base Configuration - General Settings, File Formatting, and Naming Conventions
@@ -360,12 +380,8 @@ dotnet_style_require_accessibility_modifiers = omit_if_default:warning
# Code-block preferences
csharp_prefer_braces = when_multiline:suggestion
csharp_prefer_simple_using_statement = false:silent
-csharp_prefer_system_threading_lock = true
dotnet_style_prefer_collection_expression = true:suggestion
-# Enable foreach explicit cast preference
-dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:warning
-
# Prefer System.Threading.Lock
csharp_prefer_system_threading_lock = true:warning
@@ -497,7 +513,7 @@ dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
-dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
+dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:warning
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_simplified_boolean_expressions = false:silent
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7f7d216..59b20ce 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,6 +4,13 @@ on:
push:
branches: [main]
+permissions:
+ contents: write
+ # The shared release workflow pushes the same packages to nuget.org and, when
+ # PURVIEW_PUBLISH_GITHUB_PACKAGES=true, to GitHub Packages. A reusable workflow cannot grant
+ # more than its caller, so the permission is declared here.
+ packages: write
+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
diff --git a/Directory.Packages.props b/Directory.Packages.props
index b6fada4..1bb9676 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,7 +1,4 @@
-
- true
-
- 1.75.0
- 1.0.6
+ 1.76.0
+ 1.1.0
diff --git a/global.json b/global.json
index f35b555..235b914 100644
--- a/global.json
+++ b/global.json
@@ -5,7 +5,7 @@
"allowPrerelease": true
},
"msbuild-sdks": {
- "Purview.BuildSdk": "1.0.6"
+ "Purview.BuildSdk": "1.1.0"
},
"test": {
"runner": "Microsoft.Testing.Platform"
diff --git a/package.json b/package.json
index 3b13717..9aa4aba 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "results",
- "version": "1.0.2",
+ "version": "1.0.3",
"license": "MIT",
"private": true,
"keywords": [],
diff --git a/src/tests/Repository.UnitTests/SkillTests.cs b/src/tests/Repository.UnitTests/SkillTests.cs
index 8c7f585..26305ec 100644
--- a/src/tests/Repository.UnitTests/SkillTests.cs
+++ b/src/tests/Repository.UnitTests/SkillTests.cs
@@ -1,6 +1,6 @@
using Purview.Skills.Testing;
-namespace Purview.Results;
+namespace Purview.Results.Repository;
///
/// Runs the Agent Skills conformance rule set against this repository's authored skills in
diff --git a/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorArrayCaseTests.cs b/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorArrayCaseTests.cs
index aa78ba7..cbbb620 100644
--- a/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorArrayCaseTests.cs
+++ b/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorArrayCaseTests.cs
@@ -34,7 +34,7 @@ CancellationToken cancellationToken
{
// Act — the generator must report or skip, never crash. A crash takes every other union in the
// compilation down with it.
- var result = await GenerateAsync(ArrayCaseSource, cancellationToken);
+ using var result = await GenerateAsync(ArrayCaseSource, cancellationToken);
// Assert
await Assert.That(result).IsNotNull();
@@ -46,7 +46,7 @@ CancellationToken cancellationToken
)
{
// Act
- var result = await GenerateAsync(ArrayCaseSource, cancellationToken);
+ using var result = await GenerateAsync(ArrayCaseSource, cancellationToken);
// Assert — the named case is unaffected by the unusable one.
var generated = result.AssertSingleGeneratedSource();
diff --git a/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorDiagnosticsTests.cs b/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorDiagnosticsTests.cs
index 5e5d998..a90ce05 100644
--- a/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorDiagnosticsTests.cs
+++ b/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorDiagnosticsTests.cs
@@ -32,7 +32,7 @@ CancellationToken cancellationToken
foreach (var target in targets)
{
// Act
- var result = await GenerateAsync($"namespace Test {{ {target} }}", cancellationToken);
+ using var result = await GenerateAsync($"namespace Test {{ {target} }}", cancellationToken);
// Assert
// The analyzer reports RSG1000; the generator blocks generation and reports nothing itself.
@@ -56,7 +56,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
await Assert.That(result).HasNoDiagnostics();
@@ -78,7 +78,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
source,
new ResultsSourceGeneratorTestOptions { ThrowOnGenerationException = false },
cancellationToken
@@ -108,7 +108,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
// RSG1003 is a case-scope finding reported by the analyzer, and generation continues for the
@@ -144,7 +144,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
[first, second],
new ResultsSourceGeneratorTestOptions { ThrowOnGenerationException = false },
cancellationToken
@@ -178,7 +178,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
// RSG1006 needs every opted-in union, so the generator reports it; it is non-blocking and only the
@@ -233,7 +233,7 @@ public static class Outer
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
await Assert.That(result).HasDiagnostic("RSG1005");
@@ -258,7 +258,7 @@ public sealed class NotAUnion;
""";
// Act
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
source,
new ResultsSourceGeneratorTestOptions
{
diff --git a/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorTests.cs b/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorTests.cs
index eaf85b5..62e53c3 100644
--- a/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorTests.cs
+++ b/src/tests/SourceGenerator.UnitTests/ResultsSourceGeneratorTests.cs
@@ -29,7 +29,7 @@ public async Task GenerateAsync_GivenOptedInUnion_EmitsFailureHelpers(Cancellati
{
// Arrange
// Act
- var result = await GenerateAsync(TenantUnionSource, cancellationToken);
+ using var result = await GenerateAsync(TenantUnionSource, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -43,7 +43,7 @@ public async Task GenerateAsync_GivenOptedInUnion_EmitsOneHelperPerCase(Cancella
{
// Arrange
// Act
- var result = await GenerateAsync(TenantUnionSource, cancellationToken);
+ using var result = await GenerateAsync(TenantUnionSource, cancellationToken);
// Assert
var generated = result.AssertSingleGeneratedSource();
@@ -61,7 +61,7 @@ CancellationToken cancellationToken
{
// Arrange
// Act
- var result = await GenerateAsync(TenantUnionSource, cancellationToken);
+ using var result = await GenerateAsync(TenantUnionSource, cancellationToken);
// Assert
var generated = result.AssertSingleGeneratedSource();
@@ -85,7 +85,7 @@ CancellationToken cancellationToken
{
// Arrange
// Act
- var result = await GenerateAsync(TenantUnionSource, cancellationToken);
+ using var result = await GenerateAsync(TenantUnionSource, cancellationToken);
// Assert
// The union-receiver factory is a C# 14 static extension block on the union type, so a case can be
@@ -137,7 +137,7 @@ public static class Usage
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -164,7 +164,7 @@ CancellationToken cancellationToken
{
// Arrange
// Act
- var result = await GenerateAsync(TenantUnionSource, cancellationToken);
+ using var result = await GenerateAsync(TenantUnionSource, cancellationToken);
// Assert
var generated = result.AssertSingleGeneratedSource();
@@ -209,7 +209,7 @@ public static class Usage
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -259,7 +259,7 @@ public static class Usage
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -306,7 +306,7 @@ public static class Usage
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -350,7 +350,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
source,
new ResultsSourceGeneratorTestOptions { AnalyzerTypes = [typeof(Analyzers.ResultsDiagnosticAnalyzer)] },
cancellationToken
@@ -403,7 +403,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -442,7 +442,7 @@ CancellationToken cancellationToken
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -474,7 +474,7 @@ namespace Test.Tenancy.Errors
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -510,7 +510,7 @@ namespace Bar.Errors
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -541,7 +541,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -567,7 +567,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
source,
new ResultsSourceGeneratorTestOptions { ThrowOnGenerationException = false },
cancellationToken
@@ -611,7 +611,7 @@ public class ClassCase
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -641,7 +641,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -672,7 +672,7 @@ public static class Container
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -702,7 +702,7 @@ public static class Container
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -725,7 +725,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
// Assert
result.AssertNoCompilationErrors();
@@ -767,8 +767,8 @@ namespace Test
""";
// Act
- var forward = await GenerateAsync([first, second], cancellationToken);
- var reversed = await GenerateAsync([second, first], cancellationToken);
+ using var forward = await GenerateAsync([first, second], cancellationToken);
+ using var reversed = await GenerateAsync([second, first], cancellationToken);
// Assert
var forwardSource = string.Join(
@@ -802,7 +802,7 @@ namespace Test
""";
// Act
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
source,
new ResultsSourceGeneratorTestOptions { DisableSourceGeneratorValue = true },
cancellationToken
diff --git a/src/tests/SourceGenerator.UnitTests/UnionCompilerBehaviourTests.cs b/src/tests/SourceGenerator.UnitTests/UnionCompilerBehaviourTests.cs
index ae4031c..63ec7af 100644
--- a/src/tests/SourceGenerator.UnitTests/UnionCompilerBehaviourTests.cs
+++ b/src/tests/SourceGenerator.UnitTests/UnionCompilerBehaviourTests.cs
@@ -49,7 +49,7 @@ namespace Test
[Test]
public async Task Union_GivenDeclaredUnion_ExposesExpectedSemanticShape(CancellationToken cancellationToken)
{
- var result = await GenerateAsync(UnionSource, cancellationToken);
+ using var result = await GenerateAsync(UnionSource, cancellationToken);
result.AssertNoCompilationErrors();
@@ -93,7 +93,7 @@ public static Result GetTenant(TenantId tenantId)
}
""";
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
[UnionSource, usage],
new ResultsSourceGeneratorTestOptions { ThrowOnGenerationException = false },
cancellationToken
@@ -136,7 +136,7 @@ public static Result FromLocal(TenantId tenantId)
}
""";
- var result = await GenerateAsync([UnionSource, usage], cancellationToken);
+ using var result = await GenerateAsync([UnionSource, usage], cancellationToken);
result.AssertNoCompilationErrors();
}
@@ -169,7 +169,7 @@ public static Result FromCase(TenantId tenantId) =>
}
""";
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
[UnionSource, usage],
new ResultsSourceGeneratorTestOptions { ThrowOnGenerationException = false },
cancellationToken
@@ -308,7 +308,7 @@ public static implicit operator Result(TenantNotFound GetTenant(TenantId tenantId) =>
}
""";
- var result = await GenerateAsync([UnionSource, usage], cancellationToken);
+ using var result = await GenerateAsync([UnionSource, usage], cancellationToken);
result.AssertNoCompilationErrors();
}
async Task AllErrorCodesAsync(string source, CancellationToken cancellationToken)
{
- var result = await GenerateAsync(
+ using var result = await GenerateAsync(
[UnionSource, source],
new ResultsSourceGeneratorTestOptions { ThrowOnGenerationException = false },
cancellationToken
diff --git a/src/tests/SourceGenerator.UnitTests/UnionEqualityDiagnosticSuppressorTests.cs b/src/tests/SourceGenerator.UnitTests/UnionEqualityDiagnosticSuppressorTests.cs
index 38ea6d9..72a62c6 100644
--- a/src/tests/SourceGenerator.UnitTests/UnionEqualityDiagnosticSuppressorTests.cs
+++ b/src/tests/SourceGenerator.UnitTests/UnionEqualityDiagnosticSuppressorTests.cs
@@ -126,7 +126,7 @@ CancellationToken cancellationToken
///
async Task GenerateCompilationAsync(string source, CancellationToken cancellationToken)
{
- var result = await GenerateAsync(source, cancellationToken);
+ using var result = await GenerateAsync(source, cancellationToken);
result.AssertNoCompilationErrors();