diff --git a/src/NetEvolve.Analyzer/Documentation/UseLangwordSuppressor.cs b/src/NetEvolve.Analyzer/Documentation/UseLangwordSuppressor.cs index 492bab3..2cdc71f 100644 --- a/src/NetEvolve.Analyzer/Documentation/UseLangwordSuppressor.cs +++ b/src/NetEvolve.Analyzer/Documentation/UseLangwordSuppressor.cs @@ -19,6 +19,7 @@ [DiagnosticAnalyzer(LanguageNames.CSharp)] internal sealed class UseLangwordSuppressor : NetEvolveSuppressorBase { + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) internal static readonly SuppressionDescriptor Suppression = new( id: DiagnosticIds.NES0001, suppressedDiagnosticId: "MA0154", @@ -26,6 +27,8 @@ internal sealed class UseLangwordSuppressor : NetEvolveSuppressorBase + "diagnostic from Meziantou.Analyzer." ); + // Stryker restore all + /// public override ImmutableArray SupportedSuppressions { get; } = ImmutableArray.Create(Suppression); diff --git a/src/NetEvolve.Analyzer/Helpers/CSharpKeywords.cs b/src/NetEvolve.Analyzer/Helpers/CSharpKeywords.cs index 494d440..a90491d 100644 --- a/src/NetEvolve.Analyzer/Helpers/CSharpKeywords.cs +++ b/src/NetEvolve.Analyzer/Helpers/CSharpKeywords.cs @@ -19,6 +19,7 @@ internal static class CSharpKeywords /// denotes the absence of a return type rather than an actual type, and is commonly referenced the /// same way as //. /// + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) public static readonly ImmutableHashSet ReservedKeywords = ImmutableHashSet.Create( StringComparer.Ordinal, "abstract", @@ -85,12 +86,15 @@ internal static class CSharpKeywords "while" ); + // Stryker restore all + /// /// Keywords that carry special meaning only in specific syntactic contexts (query clauses, patterns, /// declarations); the same spelling is a valid identifier everywhere else. Native type names /// (, ) are intentionally excluded for the same reason as in /// . /// + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) public static readonly ImmutableHashSet ContextualKeywords = ImmutableHashSet.Create( StringComparer.Ordinal, "add", @@ -136,12 +140,15 @@ internal static class CSharpKeywords "yield" ); + // Stryker restore all + /// /// Native/predefined C# type names, deliberately excluded from and /// . is intentionally excluded here too — it denotes the /// absence of a return type rather than an actual type, and stays classified under /// . /// + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) public static readonly ImmutableHashSet NativeTypeKeywords = ImmutableHashSet.Create( StringComparer.Ordinal, "bool", @@ -164,6 +171,8 @@ internal static class CSharpKeywords "nuint" ); + // Stryker restore all + /// /// Common BCL value types that, like , are frequently misdocumented as /// <c>type</c> instead of <see cref="type"/>. These are ordinary types, not @@ -172,6 +181,7 @@ internal static class CSharpKeywords /// see — since they only exist on the target frameworks /// that ship them. /// + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) public static readonly ImmutableHashSet WellKnownBclTypeNames = ImmutableHashSet.Create( StringComparer.Ordinal, "Guid", @@ -180,6 +190,8 @@ internal static class CSharpKeywords "TimeSpan" ); + // Stryker restore all + /// /// BCL value types that, unlike , are not available on every target /// framework the analyzer itself must run on (netstandard2.0) — each key maps to the lowest unified @@ -190,8 +202,10 @@ internal static class CSharpKeywords /// unconditionally. Different entries are free to name different minimum versions — nothing here assumes /// they all shipped together. /// + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) public static readonly ImmutableDictionary ConditionalBclTypeMinimumVersions = ImmutableDictionary .Create(StringComparer.Ordinal) .Add("DateOnly", 6) .Add("TimeOnly", 6); + // Stryker restore all } diff --git a/src/NetEvolve.Analyzer/Helpers/CancellationTokenCallSites.cs b/src/NetEvolve.Analyzer/Helpers/CancellationTokenCallSites.cs index 5fbd1ca..5d03ad5 100644 --- a/src/NetEvolve.Analyzer/Helpers/CancellationTokenCallSites.cs +++ b/src/NetEvolve.Analyzer/Helpers/CancellationTokenCallSites.cs @@ -174,6 +174,7 @@ LocalFunctionStatementSyntax localFunction return HasUsableCancellationToken(semanticModel, localFunction.Body, localFunction.ExpressionBody?.Expression); } + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) private static readonly string[] SupportedAsyncReturnTypeMetadataNames = { "System.Threading.Tasks.Task", @@ -183,6 +184,8 @@ LocalFunctionStatementSyntax localFunction "System.Collections.Generic.IAsyncEnumerable`1", }; + // Stryker restore all + private static bool IsSupportedAsyncReturnType(ITypeSymbol returnType) { if (returnType is not INamedTypeSymbol namedType) diff --git a/src/NetEvolve.Analyzer/Helpers/TargetFrameworkMonikers.cs b/src/NetEvolve.Analyzer/Helpers/TargetFrameworkMonikers.cs index ba3bf80..d9a8e13 100644 --- a/src/NetEvolve.Analyzer/Helpers/TargetFrameworkMonikers.cs +++ b/src/NetEvolve.Analyzer/Helpers/TargetFrameworkMonikers.cs @@ -17,12 +17,15 @@ internal static class TargetFrameworkMonikers // — ".NETFramework" ("net472", "net48"), ".NETStandard" ("netstandard2.0", "netstandard2.1"), and // ".NETCoreApp" ("netcoreapp3.1") — never match: each has a non-digit character glued right after "net", // where this pattern requires a digit. + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) private static readonly Regex UnifiedTfmPattern = new( @"^net(?\d+)\.\d+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant, TimeSpan.FromSeconds(1) ); + // Stryker restore all + /// /// Splits a comma-separated target framework list — BuildProperty.TargetFrameworks's re-joined /// form of MSBuild's semicolon-separated $(TargetFrameworks) (see there for why) — into its diff --git a/src/NetEvolve.Analyzer/Maintainability/AvoidRedundantCollectionClearAnalyzer.cs b/src/NetEvolve.Analyzer/Maintainability/AvoidRedundantCollectionClearAnalyzer.cs index 8c8d8f3..dbc354f 100644 --- a/src/NetEvolve.Analyzer/Maintainability/AvoidRedundantCollectionClearAnalyzer.cs +++ b/src/NetEvolve.Analyzer/Maintainability/AvoidRedundantCollectionClearAnalyzer.cs @@ -225,6 +225,7 @@ private static bool IsDeferredScope(SyntaxNode node) => // Exact-type match, not interface implementation: a subclass overriding 'ClearItems()' also implements // 'ICollection' but its 'Clear()' can carry side effects this rule must not delete. + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) private static readonly string[] AllowedCollectionMetadataNames = new[] { "System.Collections.ArrayList", @@ -240,6 +241,8 @@ private static bool IsDeferredScope(SyntaxNode node) => "System.Collections.ObjectModel.ObservableCollection`1", }; + // Stryker restore all + private static bool IsAllowedCollectionType(ITypeSymbol type, Compilation compilation) => AllowedCollectionMetadataNames .Select(compilation.GetTypeByMetadataName) diff --git a/src/NetEvolve.Analyzer/Style/RequireNumericLiteralSuffixSuppressor.cs b/src/NetEvolve.Analyzer/Style/RequireNumericLiteralSuffixSuppressor.cs index 966198b..e2c349e 100644 --- a/src/NetEvolve.Analyzer/Style/RequireNumericLiteralSuffixSuppressor.cs +++ b/src/NetEvolve.Analyzer/Style/RequireNumericLiteralSuffixSuppressor.cs @@ -22,6 +22,7 @@ namespace NetEvolve.Analyzer.Style; [DiagnosticAnalyzer(LanguageNames.CSharp)] internal sealed class RequireNumericLiteralSuffixSuppressor : NetEvolveSuppressorBase { + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) internal static readonly SuppressionDescriptor Suppression = new( id: DiagnosticIds.NES0002, suppressedDiagnosticId: "S818", @@ -29,6 +30,8 @@ internal sealed class RequireNumericLiteralSuffixSuppressor : NetEvolveSuppresso + "conflicting diagnostic from SonarAnalyzer.CSharp." ); + // Stryker restore all + /// public override ImmutableArray SupportedSuppressions { get; } = ImmutableArray.Create(Suppression); diff --git a/src/NetEvolve.Analyzer/Usage/RequireCancellationCheckCodeFixProvider.cs b/src/NetEvolve.Analyzer/Usage/RequireCancellationCheckCodeFixProvider.cs index 473ad19..eef233e 100644 --- a/src/NetEvolve.Analyzer/Usage/RequireCancellationCheckCodeFixProvider.cs +++ b/src/NetEvolve.Analyzer/Usage/RequireCancellationCheckCodeFixProvider.cs @@ -311,6 +311,7 @@ CancellationToken cancellationToken // Span/ReadOnlySpan. Array types are handled separately (any element type, any rank). This is a // pragmatic subset, not the full collection-expression conversion spec (custom [CollectionBuilder] types are // not recognized), but covers what a guard-clause return is realistically going to need. + // Stryker disable all : static initializer, not killable under the MTP runner (Stryker 5.0.0) private static readonly ImmutableHashSet<(string Namespace, string Name)> CollectionExpressionTargetTypes = ImmutableHashSet.Create( ("System.Collections.Generic", "List"), @@ -338,6 +339,8 @@ CancellationToken cancellationToken ("System", "ReadOnlySpan") ); + // Stryker restore all + // 'yield break;' is required (and the only legal early-exit) in an iterator method — 'return value;' does // not compile there at all, regardless of return type. 'return;' is legal for a void-returning method, and // also for an async method returning (non-generic) Task or ValueTask. For a real T, an async method