Merge #595/#606: OTOPCUA0001 error under src/, scoped NoWarn in driver test projects, global.json

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
Joseph Doherty
2026-10-08 06:48:15 -04:00
15 changed files with 102 additions and 6 deletions
+18 -6
View File
@@ -2,12 +2,10 @@
<!--
Defaults inherited by every csproj. Individual projects may override.
Deviation from the original v2 plan: TreatWarningsAsErrors is NOT set globally because the
pre-v2 test projects (e.g. Admin.Tests) carry 240+ xUnit1051 analyzer warnings that would
fail the build. New v2 projects (Commons, Cluster, ControlPlane, Runtime, OpcUaServer, AdminUI,
Host, Security) MUST opt in to <TreatWarningsAsErrors>true</TreatWarningsAsErrors> in their
own csproj. Once the legacy Admin/Server projects are deleted (Phase 10, Task 56), this can
be promoted back to a global default.
TreatWarningsAsErrors is NOT set globally because test projects carry analyzer warnings
(e.g. xUnit1051) that would fail the build. src/ projects opt in to
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> in their own csproj (a few still pending;
see #606). Once every project is clean this can be promoted back to a global default.
-->
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
@@ -16,6 +14,20 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<!--
OTOPCUA0001 is an ERROR under src/ (#595): production code must route capability calls through
CapabilityInvoker. src/ is currently clean; test projects keep it a Warning and suppress it
per-csproj where they call drivers at the wire level. The path test is relative to this file
so it does not depend on where the repo is checked out; backslashes normalised for Windows.
-->
<PropertyGroup>
<_OtRepoRoot>$([System.String]::Copy('$(MSBuildThisFileDirectory)').Replace('\','/'))</_OtRepoRoot>
<_OtProjPath>$([System.String]::Copy('$(MSBuildProjectFullPath)').Replace('\','/'))</_OtProjPath>
</PropertyGroup>
<PropertyGroup Condition="$(_OtProjPath.StartsWith('$(_OtRepoRoot)src/'))">
<WarningsAsErrors>$(WarningsAsErrors);OTOPCUA0001</WarningsAsErrors>
</PropertyGroup>
<!--
Wire the custom OTOPCUA0001 analyzer (UnwrappedCapabilityCallAnalyzer) into every project so
the CapabilityInvoker-wrapping rule is enforced tree-wide, not just against the analyzer's own
+6
View File
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestFeature"
}
}
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.Calculation.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.FOCAS.IntegrationTests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.Modbus.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.Mqtt.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.IntegrationTests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>
@@ -9,6 +9,12 @@
<RootNamespace>ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Tests</RootNamespace>
</PropertyGroup>
<!-- OTOPCUA0001 (#595): these suites call driver capabilities directly at the wire level on purpose;
the CapabilityInvoker-wrapping rule applies to production code only (src/ fails the build on it). -->
<PropertyGroup>
<NoWarn>$(NoWarn);OTOPCUA0001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Shouldly"/>