diff --git a/.editorconfig b/.editorconfig index 136ed38b7..60ef73e51 100644 --- a/.editorconfig +++ b/.editorconfig @@ -39,11 +39,15 @@ indent_size = 2 insert_final_newline = true [*.cs] +dotnet_diagnostic.IDE0058.severity = none +dotnet_diagnostic.IDE0303.severity = none +dotnet_diagnostic.CA1508.severity = none +dotnet_diagnostic.CA2000.severity = none dotnet_diagnostic.RS1041.severity = none dotnet_diagnostic.RS2008.severity = none -dotnet_diagnostic.CA1508.severity = none -dotnet_diagnostic.IDE0303.severity = none [src/ListDotNetTypes/*.cs] dotnet_diagnostic.CA2007.severity = none -dotnet_diagnostic.MA0004.severity = none \ No newline at end of file +dotnet_diagnostic.MA0004.severity = none + + diff --git a/Directory.Build.props b/Directory.Build.props index 334ab4183..b848d7d20 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,7 +34,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/ListDotNetTypes/ListDotNetTypes.csproj b/src/ListDotNetTypes/ListDotNetTypes.csproj index 4ad744c94..41d11cc37 100644 --- a/src/ListDotNetTypes/ListDotNetTypes.csproj +++ b/src/ListDotNetTypes/ListDotNetTypes.csproj @@ -9,8 +9,7 @@ - - + diff --git a/src/ListDotNetTypes/Program.cs b/src/ListDotNetTypes/Program.cs index 64543942b..e8fa82537 100644 --- a/src/ListDotNetTypes/Program.cs +++ b/src/ListDotNetTypes/Program.cs @@ -27,7 +27,9 @@ Console.WriteLine(packageName + "@" + latestVersion); using var packageStream = new MemoryStream(); - await resource.CopyNupkgToStreamAsync(packageName, latestVersion, packageStream, cache, NullLogger.Instance, CancellationToken.None); + if (!await resource.CopyNupkgToStreamAsync(packageName, latestVersion, packageStream, cache, NullLogger.Instance, CancellationToken.None)) + throw new InvalidOperationException("Cannot copy NuGet package"); + packageStream.Seek(0, SeekOrigin.Begin); using var zipArchive = new ZipArchive(packageStream, ZipArchiveMode.Read); diff --git a/src/Meziantou.Analyzer.Annotations/RequireNamedArgumentAttribute.cs b/src/Meziantou.Analyzer.Annotations/RequireNamedArgumentAttribute.cs index 08b1f09dc..4d308f073 100644 --- a/src/Meziantou.Analyzer.Annotations/RequireNamedArgumentAttribute.cs +++ b/src/Meziantou.Analyzer.Annotations/RequireNamedArgumentAttribute.cs @@ -1,7 +1,6 @@ #pragma warning disable CS1591 #pragma warning disable IDE0060 #pragma warning disable CA1019 -#nullable disable namespace Meziantou.Analyzer.Annotations; diff --git a/src/Meziantou.Analyzer.Annotations/StructuredLogFieldAttribute.cs b/src/Meziantou.Analyzer.Annotations/StructuredLogFieldAttribute.cs index f4ad4feb4..cc103432c 100644 --- a/src/Meziantou.Analyzer.Annotations/StructuredLogFieldAttribute.cs +++ b/src/Meziantou.Analyzer.Annotations/StructuredLogFieldAttribute.cs @@ -2,7 +2,6 @@ #pragma warning disable IDE0060 #pragma warning disable IDE0290 #pragma warning disable CA1019 -#nullable disable namespace Meziantou.Analyzer.Annotations; diff --git a/src/Meziantou.Analyzer.CodeFixers/Internals/DocumentBasedFixAllProvider.cs b/src/Meziantou.Analyzer.CodeFixers/Internals/DocumentBasedFixAllProvider.cs deleted file mode 100644 index bb2c05e93..000000000 --- a/src/Meziantou.Analyzer.CodeFixers/Internals/DocumentBasedFixAllProvider.cs +++ /dev/null @@ -1,114 +0,0 @@ -// File initially copied from -// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/4d9b3e3bb785a55f73b3029a843f0c0b73cc9ea7/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Helpers/DocumentBasedFixAllProvider.cs -// Original copyright statement: -// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Threading.Tasks; -using Meziantou.Analyzer.Internals; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CodeActions; -using Microsoft.CodeAnalysis.CodeFixes; - -namespace Meziantou.Analyzer; - -/// -/// Provides a base class to write a that fixes documents independently. -/// -internal abstract class DocumentBasedFixAllProvider : FixAllProvider -{ - protected abstract string CodeActionTitle { get; } - - public override Task GetFixAsync(FixAllContext fixAllContext) - { - return Task.FromResult(fixAllContext.Scope switch - { - FixAllScope.Document => CodeAction.Create( - CodeActionTitle, - cancellationToken => GetDocumentFixesAsync(fixAllContext.WithCancellationToken(cancellationToken)), - nameof(DocumentBasedFixAllProvider)), - FixAllScope.Project => CodeAction.Create( - CodeActionTitle, - cancellationToken => GetProjectFixesAsync(fixAllContext.WithCancellationToken(cancellationToken), fixAllContext.Project), - nameof(DocumentBasedFixAllProvider)), - FixAllScope.Solution => CodeAction.Create( - CodeActionTitle, - cancellationToken => GetSolutionFixesAsync(fixAllContext.WithCancellationToken(cancellationToken)), - nameof(DocumentBasedFixAllProvider)), - _ => null, - }); - } - - /// - /// Fixes all occurrences of a diagnostic in a specific document. - /// - /// The context for the Fix All operation. - /// The document to fix. - /// The diagnostics to fix in the document. - /// - /// The new representing the root of the fixed document. - /// -or- - /// , if no changes were made to the document. - /// - protected abstract Task FixAllInDocumentAsync(FixAllContext fixAllContext, Document document, ImmutableArray diagnostics); - - private async Task GetDocumentFixesAsync(FixAllContext fixAllContext) - { - var document = fixAllContext.Document!; - var documentDiagnosticsToFix = await FixAllContextHelper.GetDocumentDiagnosticsToFixAsync(fixAllContext).ConfigureAwait(false); - if (!documentDiagnosticsToFix.TryGetValue(document, out var diagnostics)) - { - return document; - } - - var newRoot = await FixAllInDocumentAsync(fixAllContext, document, diagnostics).ConfigureAwait(false); - if (newRoot is null) - { - return document; - } - - return document.WithSyntaxRoot(newRoot); - } - - private async Task GetSolutionFixesAsync(FixAllContext fixAllContext, ImmutableArray documents) - { - var documentDiagnosticsToFix = await FixAllContextHelper.GetDocumentDiagnosticsToFixAsync(fixAllContext).ConfigureAwait(false); - - var solution = fixAllContext.Solution; - var newDocuments = new List>(documents.Length); - foreach (var document in documents) - { - if (!documentDiagnosticsToFix.TryGetValue(document, out var diagnostics)) - { - newDocuments.Add(document.GetSyntaxRootAsync(fixAllContext.CancellationToken)); - continue; - } - - newDocuments.Add(FixAllInDocumentAsync(fixAllContext, document, diagnostics)); - } - - for (var i = 0; i < documents.Length; i++) - { - var newDocumentRoot = await newDocuments[i].ConfigureAwait(false); - if (newDocumentRoot is null) - continue; - - solution = solution.WithDocumentSyntaxRoot(documents[i].Id, newDocumentRoot); - } - - return solution; - } - - private Task GetProjectFixesAsync(FixAllContext fixAllContext, Project project) - { - return GetSolutionFixesAsync(fixAllContext, project.Documents.ToImmutableArray()); - } - - private Task GetSolutionFixesAsync(FixAllContext fixAllContext) - { - var documents = fixAllContext.Solution.Projects.SelectMany(i => i.Documents).ToImmutableArray(); - return GetSolutionFixesAsync(fixAllContext, documents); - } -} diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs index 0b4666a05..fbea59859 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs @@ -9,16 +9,14 @@ internal sealed class AvoidUsingRedundantElseFixAllProvider : DocumentBasedFixAl { public static AvoidUsingRedundantElseFixAllProvider Instance { get; } = new AvoidUsingRedundantElseFixAllProvider(); - protected override string CodeActionTitle => "Remove redundant else"; + protected override string GetFixAllTitle(FixAllContext fixAllContext) => "Remove redundant else"; - /// - protected override async Task FixAllInDocumentAsync(FixAllContext fixAllContext, Document document, ImmutableArray diagnostics) + protected override async Task FixAllAsync(FixAllContext fixAllContext, Document document, ImmutableArray diagnostics) { if (diagnostics.IsEmpty) return null; var newDocument = await AvoidUsingRedundantElseFixer.RemoveRedundantElseClausesInDocument(document, diagnostics, fixAllContext.CancellationToken).ConfigureAwait(false); - - return await newDocument.GetSyntaxRootAsync(fixAllContext.CancellationToken).ConfigureAwait(false); + return newDocument; } } diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs index f649c9187..aadb5961c 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs @@ -103,16 +103,15 @@ internal sealed class MakeMemberReadOnlyFixAllProvider : DocumentBasedFixAllProv { public static MakeMemberReadOnlyFixAllProvider Instance { get; } = new MakeMemberReadOnlyFixAllProvider(); - protected override string CodeActionTitle => "Add readonly"; + protected override string GetFixAllTitle(FixAllContext fixAllContext) => "Add readonly"; - /// - protected override async Task FixAllInDocumentAsync(FixAllContext fixAllContext, Document document, ImmutableArray diagnostics) + protected override async Task FixAllAsync(FixAllContext fixAllContext, Document document, ImmutableArray diagnostics) { if (diagnostics.IsEmpty) return null; var newDocument = await MakeReadOnly(document, diagnostics, fixAllContext.CancellationToken).ConfigureAwait(false); - return await newDocument.GetSyntaxRootAsync(fixAllContext.CancellationToken).ConfigureAwait(false); + return newDocument; } internal static async Task MakeReadOnly(Document document, ImmutableArray diagnostics, CancellationToken cancellationToken) diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs index 054ab14f9..1b65d702f 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs @@ -54,13 +54,12 @@ private static async Task Refactor(Document document, SyntaxNode nodeT var attribute = editor.Generator.Attribute( generator.TypeExpression(attributeUsageAttribute, addImport: true), - new[] - { + [ generator.AttributeArgument( generator.MemberAccessExpression( generator.TypeExpression(attributeTargets, addImport: true), nameof(AttributeTargets.All))), - }); + ]); editor.AddAttribute(classNode, attribute); return editor.GetChangedDocument(); diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs index d8298ff4e..7723ec7d8 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs @@ -34,6 +34,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) equivalenceKey: title); context.RegisterCodeFix(codeAction, context.Diagnostics); } + { var title = "Negate all or patterns"; var codeAction = CodeAction.Create( diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs index b1c9df2d0..2802ed8eb 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs index 2abe2a0c4..9cc33dcd1 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs @@ -58,13 +58,12 @@ private static async Task Refactor(Document document, SyntaxNode nodeT var attribute = editor.Generator.Attribute( generator.TypeExpression(structLayoutAttribute).WithAdditionalAnnotations(Simplifier.AddImportsAnnotation), - new[] - { + [ generator.AttributeArgument( generator.MemberAccessExpression( generator.TypeExpression(layoutKindEnum).WithAdditionalAnnotations(Simplifier.AddImportsAnnotation), layoutKind.ToString())), - }); + ]); editor.AddAttribute(nodeToFix, attribute); return editor.GetChangedDocument(); diff --git a/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs b/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs index 292119c22..c9675124b 100644 --- a/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs @@ -2,7 +2,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; -namespace Meziantou.Analyzer; +namespace Meziantou.Analyzer.Internals; internal static class EnumerableExtensions { diff --git a/src/Meziantou.Analyzer/Internals/OperationExtensions.cs b/src/Meziantou.Analyzer/Internals/OperationExtensions.cs index c14b66aa2..e18a942c5 100644 --- a/src/Meziantou.Analyzer/Internals/OperationExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/OperationExtensions.cs @@ -7,7 +7,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; -namespace Meziantou.Analyzer; +namespace Meziantou.Analyzer.Internals; internal static class OperationExtensions { diff --git a/src/Meziantou.Analyzer/Internals/StringExtensions.cs b/src/Meziantou.Analyzer/Internals/StringExtensions.cs index 0264027bf..1b3a2b5fa 100644 --- a/src/Meziantou.Analyzer/Internals/StringExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/StringExtensions.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace Meziantou.Analyzer.Rules; +namespace Meziantou.Analyzer.Internals; internal static partial class StringExtensions { diff --git a/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs b/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs index 82426e422..a4e7e39e2 100644 --- a/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs @@ -205,7 +205,7 @@ static IEnumerable GetParameters(IOperation operation) return GetParameters(delegateCreation.Target); } - return Enumerable.Empty(); + return []; } } diff --git a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs index 49cf8b099..aa8978e5a 100644 --- a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs @@ -76,6 +76,7 @@ private static IEnumerable FindLocalIdentifiersIn(SyntaxNode node) { foreach (var child in node.DescendantNodes()) { +#pragma warning disable switch (child) { case VariableDeclaratorSyntax variableDeclarator: @@ -90,6 +91,7 @@ private static IEnumerable FindLocalIdentifiersIn(SyntaxNode node) yield return singleVariableDesignation.Identifier.Text; break; } +#pragma warning restore IDE0010 // Add missing cases } } } diff --git a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs index d2a756935..90a6f036d 100644 --- a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs +++ b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs @@ -10,6 +10,6 @@ internal static IEnumerable GetElseClauseChildren(ElseClauseSyntax e { return elseClauseSyntax.Statement is BlockSyntax elseBlockSyntax ? elseBlockSyntax.ChildNodes() : - new[] { elseClauseSyntax.Statement }; + [elseClauseSyntax.Statement]; } } diff --git a/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs b/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs index 78377ffe4..8756ae248 100644 --- a/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Immutable; using System.Linq; +using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs b/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs index 42d6ba15e..f68d59499 100644 --- a/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs @@ -139,7 +139,7 @@ public override void Initialize(AnalysisContext context) { IMethodSymbol methodSymbol => methodSymbol.Parameters, IPropertySymbol propertySymbol => propertySymbol.Parameters, - _ => ImmutableArray.Empty, + _ => [], }; if (invokedMethodParameters.Length < GetMinimumMethodArgumentsConfiguration(syntaxContext.Options, expression)) diff --git a/src/Meziantou.Analyzer/Rules/NotPatternShouldBeParenthesizedAnalyzer.cs b/src/Meziantou.Analyzer/Rules/NotPatternShouldBeParenthesizedAnalyzer.cs index 64268e87c..ef8bafb8e 100644 --- a/src/Meziantou.Analyzer/Rules/NotPatternShouldBeParenthesizedAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/NotPatternShouldBeParenthesizedAnalyzer.cs @@ -45,4 +45,4 @@ private void AnalyzeNotPatternSyntax(SyntaxNodeAnalysisContext context) } } } -#endif \ No newline at end of file +#endif diff --git a/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs index 3f4390f13..538e0b309 100644 --- a/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs @@ -135,7 +135,7 @@ private static ImmutableArray GetParameters(ISymbol symbol) { SymbolKind.Method => ((IMethodSymbol)symbol).Parameters, SymbolKind.Property => ((IPropertySymbol)symbol).Parameters, - _ => ImmutableArray.Empty, + _ => [], }; } } diff --git a/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs index 9f4f7b157..aa414a83c 100644 --- a/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs @@ -65,13 +65,13 @@ private static void AnalyzeObjectCreation(OperationAnalysisContext context) return; } - var properties = ImmutableDictionary.CreateRange(new[] - { + var properties = ImmutableDictionary.CreateRange( + [ new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.PatternIndexName, "0"), new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.RegexOptionsIndexName, op.Arguments.Length > 1 ? "1" : null), new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.RegexTimeoutIndexName, op.Arguments.Length > 2 ? "2" : null), new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.RegexTimeoutName, op.Arguments.Length > 2 ? TimeSpanOperation.GetMilliseconds(op.Arguments[2].Value)?.ToString(CultureInfo.InvariantCulture) : null), - }); + ]); context.ReportDiagnostic(RegexSourceGeneratorRule, properties, op); } @@ -110,13 +110,13 @@ private static void AnalyzeInvocation(OperationAnalysisContext context) return; } - var properties = ImmutableDictionary.CreateRange(new[] - { + var properties = ImmutableDictionary.CreateRange( + [ new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.PatternIndexName, "1"), new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.RegexOptionsIndexName, op.Arguments.Length > 2 ? "2" : null), new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.RegexTimeoutIndexName, op.Arguments.Length > 3 ? "3" : null), new KeyValuePair(UseRegexSourceGeneratorAnalyzerCommon.RegexTimeoutName, op.Arguments.Length > 3 ? TimeSpanOperation.GetMilliseconds(op.Arguments[3].Value)?.ToString(CultureInfo.InvariantCulture) : null), - }); + ]); context.ReportDiagnostic(RegexSourceGeneratorRule, properties, op); } diff --git a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs index a172ebf84..7fa46ba4a 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs @@ -119,5 +119,4 @@ await CreateProjectBuilder() .WithSourceCode(originalCode) .ValidateAsync(); } - } diff --git a/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs index 395391773..182bdf3e8 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs @@ -38,5 +38,4 @@ await CreateProjectBuilder() .WithSourceCode(SourceCode) .ValidateAsync(); } - }