Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"demaconsulting.pandoctool": {
"version": "3.10.0",
"version": "3.10.1",
"commands": [
"pandoc"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774">
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.30.0.144632">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) DemaConsulting. All rights reserved.
// </copyright>

using System.Diagnostics.CodeAnalysis;
using DemaConsulting.Rendering;
using DemaConsulting.Rendering.Abstractions;
using DemaConsulting.Rendering.Layout;
Expand Down Expand Up @@ -1076,7 +1077,7 @@ private static bool TryResolveQualified(
string reference,
HashSet<string> byQualified,
Dictionary<string, string> bySimple,
out string qualified)
[MaybeNullWhen(false)] out string qualified)
{
if (byQualified.Contains(reference))
{
Expand All @@ -1086,7 +1087,7 @@ private static bool TryResolveQualified(

var sep = reference.LastIndexOf("::", StringComparison.Ordinal);
var simple = sep >= 0 ? reference[(sep + 2)..] : reference;
return bySimple.TryGetValue(simple, out qualified!);
return bySimple.TryGetValue(simple, out qualified);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774">
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.30.0.144632">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774">
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.30.0.144632">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774">
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.30.0.144632">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774">
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.30.0.144632">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static async Task<SysmlWorkspace> LoadAsync(string source)
var (stdlibTable, _) = StdlibProvider.GetSymbolTable();
var result = await WorkspaceLoader.LoadAsync([tempFile], stdlibTable);
Assert.NotNull(result.Workspace);
return result.Workspace!;
return result.Workspace;
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ public void Parse_RoundTrip_PrettyPrintedTextReparsesToEquivalentTree(string exp
var first = FilterExpressionParser.Parse(expressionText);
Assert.NotNull(first.Expression);

var printed = first.Expression!.ToString();
var second = FilterExpressionParser.Parse(printed!);
var printed = first.Expression.ToString();
var second = FilterExpressionParser.Parse(printed);

Assert.NotNull(second.Expression);
Assert.Equal(first.Expression, second.Expression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void GeneralViewLayoutStrategy_BuildLayout_PackagedDefinitions_ProducesFo
// Assert: a folder-shaped box exists carrying the package keyword
var folder = CollectBoxes(layout.Nodes).FirstOrDefault(b => b.Shape == BoxShape.Folder);
Assert.NotNull(folder);
Assert.Equal("package", folder!.Keyword);
Assert.Equal("package", folder.Keyword);
Assert.Equal("Sys", folder.Label);
}

Expand Down Expand Up @@ -431,7 +431,7 @@ public void GeneralViewLayoutStrategy_BuildLayout_Subclassification_ProducesEdge
// Assert: at least one orthogonal line with an open arrowhead at the supertype end
var line = CollectLines(layout.Nodes).FirstOrDefault();
Assert.NotNull(line);
Assert.Equal(EndMarkerStyle.HollowTriangle, line!.TargetEnd);
Assert.Equal(EndMarkerStyle.HollowTriangle, line.TargetEnd);
Assert.True(line.Waypoints.Count >= 2);
}

Expand Down Expand Up @@ -705,7 +705,7 @@ public void GeneralViewLayoutStrategy_BuildLayout_AttributeTyping_ProducesDashed
var typingEdge = CollectLines(layout.Nodes)
.FirstOrDefault(l => l.LineStyle == LineStyle.Dashed && l.TargetEnd == EndMarkerStyle.OpenChevron);
Assert.NotNull(typingEdge);
Assert.True(typingEdge!.Waypoints.Count >= 2);
Assert.True(typingEdge.Waypoints.Count >= 2);

// Assert: attribute typing is a dependency, not composition — no membership diamond is drawn.
var diamondEdge = CollectLines(layout.Nodes)
Expand Down Expand Up @@ -762,7 +762,7 @@ public void GeneralViewLayoutStrategy_BuildLayout_BareNameRedefinition_ProducesH
var redefinitionEdge = CollectLines(layout.Nodes)
.FirstOrDefault(l => l.TargetEnd == EndMarkerStyle.HollowTriangleCrossbar);
Assert.NotNull(redefinitionEdge);
Assert.Equal(LineStyle.Solid, redefinitionEdge!.LineStyle);
Assert.Equal(LineStyle.Solid, redefinitionEdge.LineStyle);
}

/// <summary>
Expand Down Expand Up @@ -1700,7 +1700,7 @@ public async Task GeneralViewLayoutStrategy_BuildLayout_DroneGalleryModel_Render
var (stdlibTable, _) = StdlibProvider.GetSymbolTable();
var result = await WorkspaceLoader.LoadAsync([modelPath], stdlibTable);
Assert.NotNull(result.Workspace);
var workspace = result.Workspace!;
var workspace = result.Workspace;

const string viewQualifiedName = "QuadcopterDrone::DroneGeneralView";
var viewNode = Assert.IsType<SysmlViewNode>(workspace.Declarations[viewQualifiedName]);
Expand Down Expand Up @@ -1801,7 +1801,7 @@ public async Task GeneralViewLayoutStrategy_BuildLayout_OmgSafetyFeatureViewsFix
var (stdlibTable, _) = StdlibProvider.GetSymbolTable();
var result = await WorkspaceLoader.LoadAsync([fixturePath], stdlibTable);
Assert.NotNull(result.Workspace);
var workspace = result.Workspace!;
var workspace = result.Workspace;

const string viewQualifiedName =
"'11b-Safety and Security Feaure Views'::Views::vehicleMandatorySafetyFeatureViewStandalone";
Expand Down Expand Up @@ -2039,7 +2039,7 @@ part def Drone {
var (stdlibTable, _) = StdlibProvider.GetSymbolTable();
var result = await WorkspaceLoader.LoadAsync([tempFile], stdlibTable);
Assert.NotNull(result.Workspace);
var workspace = result.Workspace!;
var workspace = result.Workspace;

var strategy = new GeneralViewLayoutStrategy();
var options = new RenderOptions(Themes.Light);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void InterconnectionView_BuildLayout_PartWithPorts_PortsNeverOverlapBoxTi

Assert.NotNull(owningBox);
Assert.True(
port.CentreY >= owningBox!.Y + titleArea,
port.CentreY >= owningBox.Y + titleArea,
$"port at ({port.CentreX}, {port.CentreY}) overlaps the title area of its box (Y={owningBox.Y}, titleArea={titleArea})");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void StateTransitionView_BuildLayout_TransitionEdge_HasOpenArrowhead()
var transitionLine = layout.Nodes.OfType<LayoutLine>()
.FirstOrDefault(l => l.MidpointLabel == "[g]");
Assert.NotNull(transitionLine);
Assert.Equal(EndMarkerStyle.OpenChevron, transitionLine!.TargetEnd);
Assert.Equal(EndMarkerStyle.OpenChevron, transitionLine.TargetEnd);
}

/// <summary>
Expand Down
14 changes: 7 additions & 7 deletions test/DemaConsulting.SysML2Tools.Tests/Parser/OmgModelsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public async Task ControlNode_OmgCorpusFixture_ResolvesForkJoinDecisionMerge()

// DecisionExample.sysml: an anonymous decide with two guarded successions, plus a named
// merge that the decide's default-path action succession eventually rejoins.
var chargeBattery = (SysmlDefinitionNode)result.Workspace!.Declarations["'Decision Example'::ChargeBattery"];
var chargeBattery = (SysmlDefinitionNode)result.Workspace.Declarations["'Decision Example'::ChargeBattery"];
var decide = Assert.Single(
chargeBattery.Children.OfType<SysmlFeatureNode>(), f => f.FeatureKeyword == "decide");
Assert.NotNull(decide.Name);
Expand All @@ -324,7 +324,7 @@ public async Task ControlNode_OmgCorpusFixture_ResolvesForkJoinDecisionMerge()
Assert.Contains(chargeBatteryTransitions, t => t.Source == "monitor" && t.Target == decide.Name);

// ControlNodeTest.sysml: fully named fork/join/merge — the richest, most reliable fixture.
var controlNodeTest = (SysmlDefinitionNode)result.Workspace!.Declarations["ControlNodeTest"];
var controlNodeTest = (SysmlDefinitionNode)result.Workspace.Declarations["ControlNodeTest"];
var controlFeatures = controlNodeTest.Children.OfType<SysmlFeatureNode>().ToList();
Assert.Contains(controlFeatures, f => f.FeatureKeyword == "join" && f.Name == "J");
Assert.Contains(controlFeatures, f => f.FeatureKeyword == "fork" && f.Name == "F");
Expand Down Expand Up @@ -382,7 +382,7 @@ public async Task Enumeration_OmgCorpusFixtures_CaptureAllLiteralForms()

// Redefinition-body form (each literal redefines "code"/"color" attributes via `:>>`).
var classificationKind =
(SysmlDefinitionNode)result.Workspace!.Declarations["'Enumeration Definitions-2'::ClassificationKind"];
(SysmlDefinitionNode)result.Workspace.Declarations["'Enumeration Definitions-2'::ClassificationKind"];
var classificationValues = classificationKind.Children
.OfType<SysmlFeatureNode>()
.Where(f => f.FeatureKeyword == "enum value")
Expand All @@ -393,7 +393,7 @@ public async Task Enumeration_OmgCorpusFixtures_CaptureAllLiteralForms()
// Value-assignment form (`A = 4.0;`) — the assigned value expression is not parsed, only
// the literal's own name, an accepted minimal-capture gap.
var gradePoints =
(SysmlDefinitionNode)result.Workspace!.Declarations["'Enumeration Definitions-2'::GradePoints"];
(SysmlDefinitionNode)result.Workspace.Declarations["'Enumeration Definitions-2'::GradePoints"];
var gradeValues = gradePoints.Children
.OfType<SysmlFeatureNode>()
.Where(f => f.FeatureKeyword == "enum value")
Expand Down Expand Up @@ -440,7 +440,7 @@ public async Task Requirement_OmgCorpusFixtures_CaptureSubjectAndConstraints()
// VehicleMassLimitationRequirement (a requirement def specializing another) has subject +
// assume constraint.
var vehicleMassLimitation =
(SysmlDefinitionNode)result.Workspace!.Declarations[
(SysmlDefinitionNode)result.Workspace.Declarations[
"'Requirement Definitions'::VehicleMassLimitationRequirement"];
var subject = Assert.Single(
vehicleMassLimitation.Children.OfType<SysmlFeatureNode>(), f => f.FeatureKeyword == "subject");
Expand All @@ -453,7 +453,7 @@ public async Task Requirement_OmgCorpusFixtures_CaptureSubjectAndConstraints()
// RequirementUsages.sysml: fullVehicleMassLimit is a requirement *usage* specializing
// VehicleMassLimitationRequirement, with its own subject + assume constraint body.
var fullVehicleMassLimit =
(SysmlFeatureNode)result.Workspace!.Declarations["'Requirement Usages'::fullVehicleMassLimit"];
(SysmlFeatureNode)result.Workspace.Declarations["'Requirement Usages'::fullVehicleMassLimit"];
var usageSubject = Assert.Single(
fullVehicleMassLimit.Children.OfType<SysmlFeatureNode>(), f => f.FeatureKeyword == "subject");
Assert.Equal("vehicle", usageSubject.Name);
Expand Down Expand Up @@ -498,7 +498,7 @@ public async Task CommentAndDocumentation_OmgCorpusFixtures_CaptureAnnotations()
Assert.Contains(partDefC.Annotations, a => a.Kind == SysmlAnnotationKind.Comment);

var automobileWithDoc =
(SysmlDefinitionNode)result.Workspace!.Declarations["'Documentation Example'::Automobile"];
(SysmlDefinitionNode)result.Workspace.Declarations["'Documentation Example'::Automobile"];
Assert.Contains(automobileWithDoc.Annotations, a => a.Kind == SysmlAnnotationKind.Documentation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public void RenderJson_RoundTrips_PreservesShape()
var deserialized = JsonSerializer.Deserialize(json, QueryResultSerializerContext.Default.QueryResult);

Assert.NotNull(deserialized);
Assert.Equal("uses", deserialized!.Verb);
Assert.Equal("uses", deserialized.Verb);
Assert.Equal("Model::Foo", deserialized.Element);
Assert.Single(deserialized.Entries);
Assert.Equal("Model::Bar", deserialized.Entries[0].QualifiedName);
Expand All @@ -341,7 +341,7 @@ public void RenderJson_UnorderedEntries_SortsByQualifiedNameOrdinal()
var deserialized = JsonSerializer.Deserialize(json, QueryResultSerializerContext.Default.QueryResult);

Assert.NotNull(deserialized);
Assert.Equal("Model::Apple", deserialized!.Entries[0].QualifiedName);
Assert.Equal("Model::Apple", deserialized.Entries[0].QualifiedName);
Assert.Equal("Model::Zebra", deserialized.Entries[1].QualifiedName);
}

Expand All @@ -368,7 +368,7 @@ public void RenderJson_DependenciesVerb_IncludesDirectionField()

Assert.NotNull(deserialized);
Assert.Contains("\"Direction\"", json);
Assert.Equal(QueryEntryDirection.Incoming, deserialized!.Entries[0].Direction);
Assert.Equal(QueryEntryDirection.Incoming, deserialized.Entries[0].Direction);
Assert.Equal(QueryEntryDirection.Outgoing, deserialized.Entries[1].Direction);
}

Expand Down Expand Up @@ -402,7 +402,7 @@ public void RenderJson_DependenciesVerb_NamesRemainFullyQualified()
var deserialized = JsonSerializer.Deserialize(json, QueryResultSerializerContext.Default.QueryResult);

Assert.NotNull(deserialized);
Assert.Equal("Model::Car", deserialized!.Element);
Assert.Equal("Model::Car", deserialized.Element);
Assert.Contains(deserialized.Entries, e => e.QualifiedName == "Model::Vehicle");
Assert.Contains(deserialized.Entries, e => e.QualifiedName == "Model::Truck");
Assert.Contains("Model::Vehicle", json);
Expand Down
Loading
Loading