docs(tests): fix CommentChecker findings across tests/ — 13,392 → 0 (repo-wide scan clean)

Comment/XML-doc changes only:
- add summaries to ~10k test methods, fixtures, fakes and helpers
  (+ <param> on theories, <returns> on async Task methods,
  <inheritdoc/> on interface implementations the checker can resolve)
- strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N,
  #NN, Component-0NN) from comments, keeping the explanatory text;
  reword false positives in comments only
- real docs on fakes implementing BCL/library interfaces
  (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime)
- reword the last 5 src/ false positives (CWE-1236, failures-1,
  year-0001, M365)

Only non-comment edits: four one-line nested classes split across lines
so members can carry docs. Build 0 errors / 0 warnings.
This commit is contained in:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -7,6 +7,7 @@ public class SemanticValidatorTests
{
private readonly SemanticValidator _sut = new();
/// <summary>Verifies that a native alarm source referencing an unknown connection returns an error.</summary>
[Fact]
public void Validate_NativeAlarmSource_UnknownConnection_ReturnsError()
{
@@ -19,6 +20,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.NativeAlarmSourceInvalid);
}
/// <summary>Verifies that a native alarm source with an empty source reference returns an error.</summary>
[Fact]
public void Validate_NativeAlarmSource_EmptySourceRef_ReturnsError()
{
@@ -31,6 +33,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.NativeAlarmSourceInvalid);
}
/// <summary>Verifies that a native alarm source with a valid binding produces no error.</summary>
[Fact]
public void Validate_NativeAlarmSource_ValidBinding_NoError()
{
@@ -43,6 +46,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.NativeAlarmSourceInvalid);
}
/// <summary>Verifies that a CallScript target that cannot be found returns an error.</summary>
[Fact]
public void Validate_CallScriptTargetNotFound_ReturnsError()
{
@@ -65,6 +69,7 @@ public class SemanticValidatorTests
e.Message.Contains("NonExistent"));
}
/// <summary>Verifies that a CallScript target that exists produces no error.</summary>
[Fact]
public void Validate_CallScriptTargetExists_NoError()
{
@@ -82,6 +87,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.CallTargetNotFound);
}
/// <summary>Verifies that a CallScript to a composition script referenced by its leaf name produces no error.</summary>
[Fact]
public void Validate_CallScriptCompositionDelegatedByLeafName_NoError()
{
@@ -105,10 +111,11 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.CallTargetNotFound);
}
/// <summary>Verifies that a CallScript to a composition script referenced by its leaf name emits an advisory warning.</summary>
[Fact]
public void Validate_CallScriptCompositionDelegatedByLeafName_EmitsAdvisoryWarning()
{
// #05-T24: a call target accepted ONLY by the composed leaf-name fallback
// A call target accepted ONLY by the composed leaf-name fallback
// (dynamic child path, not statically verifiable) must surface an advisory
// warning rather than being silently accepted.
var config = new FlattenedConfiguration
@@ -128,6 +135,7 @@ public class SemanticValidatorTests
&& w.Message.Contains("leaf name only", StringComparison.Ordinal));
}
/// <summary>Verifies that a CallScript to a sibling in the same scope emits no leaf-name warning.</summary>
[Fact]
public void Validate_CallScriptSameScopeSibling_EmitsNoLeafWarning()
{
@@ -149,6 +157,7 @@ public class SemanticValidatorTests
w.Message.Contains("leaf name only", StringComparison.Ordinal));
}
/// <summary>Verifies that a CallScript to an unknown leaf name still returns an error.</summary>
[Fact]
public void Validate_CallScriptUnknownLeafName_StillReturnsError()
{
@@ -169,6 +178,7 @@ public class SemanticValidatorTests
e.Category == ValidationCategory.CallTargetNotFound && e.Message.Contains("Typo"));
}
/// <summary>Verifies that a CallShared target that cannot be found returns an error.</summary>
[Fact]
public void Validate_CallSharedTargetNotFound_ReturnsError()
{
@@ -191,6 +201,7 @@ public class SemanticValidatorTests
e.Message.Contains("MissingShared"));
}
/// <summary>Verifies that a CallShared target that exists produces no error.</summary>
[Fact]
public void Validate_CallSharedTargetExists_NoError()
{
@@ -212,6 +223,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.CallTargetNotFound);
}
/// <summary>Verifies that a parameter count mismatch returns an error.</summary>
[Fact]
public void Validate_ParameterCountMismatch_ReturnsError()
{
@@ -238,8 +250,9 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
// ── #21 Argument-type validation ────────────────────────────────────────
// ── Argument-type validation ────────────────────────────────────────
/// <summary>Verifies that passing a string for an integer parameter returns an error.</summary>
[Fact]
public void Validate_ArgumentTypeMismatch_StringForInteger_ReturnsError()
{
@@ -269,6 +282,7 @@ public class SemanticValidatorTests
e.Message.Contains("type", StringComparison.OrdinalIgnoreCase));
}
/// <summary>Verifies that passing a number for a string parameter returns an error.</summary>
[Fact]
public void Validate_ArgumentTypeMismatch_NumberForString_ReturnsError()
{
@@ -298,6 +312,7 @@ public class SemanticValidatorTests
e.Message.Contains("type", StringComparison.OrdinalIgnoreCase));
}
/// <summary>Verifies that passing a boolean for an integer parameter returns an error.</summary>
[Fact]
public void Validate_ArgumentTypeMismatch_BooleanForInteger_ReturnsError()
{
@@ -326,6 +341,7 @@ public class SemanticValidatorTests
e.Message.Contains("type", StringComparison.OrdinalIgnoreCase));
}
/// <summary>Verifies that literals of the correct types produce no error.</summary>
[Fact]
public void Validate_ArgumentTypeMatch_CorrectLiterals_NoError()
{
@@ -354,6 +370,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
/// <summary>Verifies that passing an integer literal for a float parameter produces no error.</summary>
[Fact]
public void Validate_ArgumentType_IntegerLiteralForFloat_NoError()
{
@@ -381,6 +398,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
/// <summary>Verifies that an expression of unknown type does not produce a false positive.</summary>
[Fact]
public void Validate_ArgumentType_UnknownExpression_NoFalsePositive()
{
@@ -409,6 +427,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
/// <summary>Verifies that an object initializer argument does not produce a false positive.</summary>
[Fact]
public void Validate_ArgumentType_ObjectInitializerArgument_NoFalsePositive()
{
@@ -437,6 +456,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
/// <summary>Verifies that an untyped parameter does not produce a false positive.</summary>
[Fact]
public void Validate_ArgumentType_UntypedParameter_NoFalsePositive()
{
@@ -464,6 +484,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
/// <summary>Verifies that a compound expression starting with a literal does not produce a false positive.</summary>
[Fact]
public void Validate_ArgumentType_CompoundExpressionStartingWithLiteral_NoFalsePositive()
{
@@ -492,6 +513,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
/// <summary>Verifies that a concatenated string expression does not produce a false positive.</summary>
[Fact]
public void Validate_ArgumentType_ConcatenatedStringExpression_NoFalsePositive()
{
@@ -520,8 +542,9 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
// ── #20 Return-type validation ──────────────────────────────────────────
// ── Return-type validation ──────────────────────────────────────────
/// <summary>Verifies that assigning a boolean result to an integer returns an error.</summary>
[Fact]
public void Validate_ReturnTypeMismatch_BooleanResultIntoInt_ReturnsError()
{
@@ -549,6 +572,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that assigning a string result to a boolean returns an error.</summary>
[Fact]
public void Validate_ReturnTypeMismatch_StringResultIntoBool_ReturnsError()
{
@@ -575,6 +599,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that a compatible assignment of a return value produces no error.</summary>
[Fact]
public void Validate_ReturnTypeMatch_CompatibleAssignment_NoError()
{
@@ -602,6 +627,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that assigning a return value to a var local does not produce a false positive.</summary>
[Fact]
public void Validate_ReturnType_VarAssignment_NoFalsePositive()
{
@@ -629,6 +655,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that an unused return value does not produce a false positive.</summary>
[Fact]
public void Validate_ReturnType_UnusedResult_NoFalsePositive()
{
@@ -656,6 +683,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that a call to a script with no declared return type does not produce a false positive.</summary>
[Fact]
public void Validate_ReturnType_UndeclaredReturn_NoFalsePositive()
{
@@ -678,11 +706,12 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that a return type mismatch on a qualified instance call returns an error.</summary>
[Fact]
public void Validate_ReturnTypeMismatch_QualifiedInstanceCall_ReturnsError()
{
// Real-code form: `Instance.CallScript(...)`. The receiver prefix must
// be skipped so #20 still sees the typed-local assignment.
// be skipped so return-type validation still sees the typed-local assignment.
var config = new FlattenedConfiguration
{
InstanceUniqueName = "Instance1",
@@ -706,6 +735,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that a return type mismatch on a qualified shared call returns an error.</summary>
[Fact]
public void Validate_ReturnTypeMismatch_QualifiedSharedCall_ReturnsError()
{
@@ -737,6 +767,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that a cast expression on a return value does not produce a false positive.</summary>
[Fact]
public void Validate_ReturnType_CastExpression_NoFalsePositive()
{
@@ -765,6 +796,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ReturnTypeMismatch);
}
/// <summary>Verifies that a range violation on a non-numeric attribute returns an error.</summary>
[Fact]
public void Validate_RangeViolationOnNonNumeric_ReturnsError()
{
@@ -790,6 +822,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.TriggerOperandType);
}
/// <summary>Verifies that a range violation on a numeric attribute produces no error.</summary>
[Fact]
public void Validate_RangeViolationOnNumeric_NoError()
{
@@ -815,6 +848,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.TriggerOperandType);
}
/// <summary>Verifies that an on-trigger script that cannot be found returns an error.</summary>
[Fact]
public void Validate_OnTriggerScriptNotFound_ReturnsError()
{
@@ -837,6 +871,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.OnTriggerScriptNotFound);
}
/// <summary>Verifies that an instance script that calls an alarm on-trigger script returns an error.</summary>
[Fact]
public void Validate_InstanceScriptCallsAlarmOnTrigger_ReturnsError()
{
@@ -867,6 +902,7 @@ public class SemanticValidatorTests
Assert.Contains(result.Errors, e => e.Category == ValidationCategory.CrossCallViolation);
}
/// <summary>Verifies that call target extraction handles multiple call types.</summary>
[Fact]
public void ExtractCallTargets_MultipleCallTypes()
{
@@ -902,6 +938,7 @@ public class SemanticValidatorTests
]
};
/// <summary>Verifies that a hi/lo alarm on a non-numeric attribute returns an error.</summary>
[Fact]
public void Validate_HiLoOnNonNumericAttribute_ReturnsError()
{
@@ -916,6 +953,7 @@ public class SemanticValidatorTests
&& e.Message.Contains("non-numeric"));
}
/// <summary>Verifies that a hi/lo alarm on a numeric attribute produces no operand type error.</summary>
[Fact]
public void Validate_HiLoOnNumericAttribute_NoOperandTypeError()
{
@@ -927,6 +965,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.TriggerOperandType);
}
/// <summary>Verifies that a hi/lo alarm with no setpoints returns a warning.</summary>
[Fact]
public void Validate_HiLoNoSetpoints_ReturnsWarning()
{
@@ -941,6 +980,7 @@ public class SemanticValidatorTests
&& w.Message.Contains("no setpoints"));
}
/// <summary>Verifies that a hi/lo alarm whose LoLo setpoint exceeds its Lo setpoint returns an error.</summary>
[Fact]
public void Validate_HiLoLoLoGreaterThanLo_ReturnsError()
{
@@ -955,6 +995,7 @@ public class SemanticValidatorTests
&& e.Message.Contains("Lo"));
}
/// <summary>Verifies that a hi/lo alarm whose Hi setpoint exceeds its HiHi setpoint returns an error.</summary>
[Fact]
public void Validate_HiLoHiGreaterThanHiHi_ReturnsError()
{
@@ -969,6 +1010,7 @@ public class SemanticValidatorTests
&& e.Message.Contains("HiHi"));
}
/// <summary>Verifies that a hi/lo alarm whose low side overlaps its high side returns an error.</summary>
[Fact]
public void Validate_HiLoLowSideOverlapsHighSide_ReturnsError()
{
@@ -983,6 +1025,7 @@ public class SemanticValidatorTests
&& e.Message.Contains("overlap"));
}
/// <summary>Verifies that a hi/lo alarm with only the high side configured produces no ordering error.</summary>
[Fact]
public void Validate_HiLoOnlyHighSideConfigured_NoOrderingError()
{
@@ -996,6 +1039,7 @@ public class SemanticValidatorTests
e => e.Category == ValidationCategory.TriggerOperandType);
}
/// <summary>Verifies that a hi/lo alarm with a negative deadband returns an error.</summary>
[Fact]
public void Validate_HiLoNegativeDeadband_ReturnsError()
{
@@ -1010,6 +1054,7 @@ public class SemanticValidatorTests
&& e.Message.Contains("non-negative"));
}
/// <summary>Verifies that a hi/lo alarm with a zero deadband produces no error.</summary>
[Fact]
public void Validate_HiLoZeroDeadband_NoError()
{
@@ -1023,6 +1068,7 @@ public class SemanticValidatorTests
e => e.Category == ValidationCategory.TriggerOperandType);
}
/// <summary>Verifies that a hi/lo alarm with valid setpoint ordering produces no errors.</summary>
[Fact]
public void Validate_HiLoValidOrdering_NoErrors()
{
@@ -1038,8 +1084,9 @@ public class SemanticValidatorTests
w => w.Category == ValidationCategory.TriggerOperandType);
}
// ── M2.7 review nits — comment-aware arg tokenizer ─────────────────────
// ── Review nits — comment-aware arg tokenizer ─────────────────────
/// <summary>Verifies that a line comment containing a comma inside the arguments does not produce a false positive.</summary>
[Fact]
public void Validate_ArgSplit_LineCommentWithCommaInsideArgs_NoFalsePositive()
{
@@ -1068,6 +1115,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
/// <summary>Verifies that a block comment containing a comma inside the arguments does not produce a false positive.</summary>
[Fact]
public void Validate_ArgSplit_BlockCommentWithCommaInsideArgs_NoFalsePositive()
{
@@ -1096,8 +1144,9 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
// ── M2.7 review nits — stricter numeric-literal inference ───────────────
// ── Review nits — stricter numeric-literal inference ───────────────
/// <summary>Verifies that an identifier with a leading underscore does not produce a false positive.</summary>
[Fact]
public void Validate_ArgumentType_UnderscoreLeadingIdentifier_NoFalsePositive()
{
@@ -1126,8 +1175,9 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.ParameterMismatch);
}
// ── MV-5 List attribute semantics ────────────────────────────────────────
// ── List attribute semantics ────────────────────────────────────────
/// <summary>Verifies that a list attribute with a valid element type and default produces no error.</summary>
[Fact]
public void Validate_ListAttribute_ValidElementTypeAndDefault_NoError()
{
@@ -1151,6 +1201,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.MissingMetadata);
}
/// <summary>Verifies that a list attribute with a null element type returns an error.</summary>
[Fact]
public void Validate_ListAttribute_NullElementType_ReturnsError()
{
@@ -1171,6 +1222,7 @@ public class SemanticValidatorTests
e.Message.Contains("element type", StringComparison.OrdinalIgnoreCase));
}
/// <summary>Verifies that a scalar attribute that has an element type returns an error.</summary>
[Fact]
public void Validate_ScalarAttribute_WithElementType_ReturnsError()
{
@@ -1191,6 +1243,7 @@ public class SemanticValidatorTests
e.Message.Contains("element type", StringComparison.OrdinalIgnoreCase));
}
/// <summary>Verifies that a list attribute with a non-scalar element type returns an error.</summary>
[Fact]
public void Validate_ListAttribute_NonScalarElementType_ReturnsError()
{
@@ -1213,6 +1266,7 @@ public class SemanticValidatorTests
}
}
/// <summary>Verifies that a list attribute with a malformed JSON default returns an error.</summary>
[Fact]
public void Validate_ListAttribute_MalformedJsonDefault_ReturnsError()
{
@@ -1239,6 +1293,7 @@ public class SemanticValidatorTests
e.Message.Contains("default", StringComparison.OrdinalIgnoreCase));
}
/// <summary>Verifies that a list attribute whose default contains an unparseable element returns an error.</summary>
[Fact]
public void Validate_ListAttribute_DefaultElementNotParseable_ReturnsError()
{
@@ -1265,6 +1320,7 @@ public class SemanticValidatorTests
e.Message.Contains("Int32"));
}
/// <summary>Verifies that a list attribute with an empty default produces no default error.</summary>
[Fact]
public void Validate_ListAttribute_EmptyDefault_NoDefaultError()
{
@@ -1282,6 +1338,7 @@ public class SemanticValidatorTests
Assert.DoesNotContain(result.Errors, e => e.Category == ValidationCategory.MissingMetadata);
}
/// <summary>Verifies that a list attribute used as a range violation operand returns an error.</summary>
[Fact]
public void Validate_ListAttribute_AsRangeViolationOperand_ReturnsError()
{
@@ -1311,6 +1368,7 @@ public class SemanticValidatorTests
e.Message.Contains("non-numeric"));
}
/// <summary>Verifies that a list attribute used as a hi/lo operand returns an error.</summary>
[Fact]
public void Validate_ListAttribute_AsHiLoOperand_ReturnsError()
{