diff --git a/.editorconfig b/.editorconfig index c2c0b3e7..378f83d7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# reference:https://raw.githubusercontent.com/meziantou/Meziantou.DotNet.CodingStandard/refs/heads/main/.editorconfig +# reference:https://raw.githubusercontent.com/meziantou/Meziantou.DotNet.CodingStandard/refs/heads/main/.editorconfig # Schema: http://EditorConfig.org # Docs: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference @@ -41,7 +41,6 @@ insert_final_newline = true # endreference [*.cs] -dotnet_diagnostic.IDE0058.severity = none dotnet_diagnostic.IDE0303.severity = none dotnet_diagnostic.CA1508.severity = none dotnet_diagnostic.CA2000.severity = none diff --git a/Directory.Build.props b/Directory.Build.props index 70297f45..fa20c6b3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/global.json b/global.json index e7a1b53a..7d0d05b7 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "9.0.304", + "version": "10.0.100-rc.2.25502.107", "rollForward": "latestPatch" }, "msbuild-sdks": { - "Meziantou.NET.Sdk": "1.0.9", - "Meziantou.NET.Sdk.Test": "1.0.9", - "Meziantou.NET.Sdk.Web": "1.0.9" + "Meziantou.NET.Sdk": "1.0.38", + "Meziantou.NET.Sdk.Test": "1.0.38", + "Meziantou.NET.Sdk.Web": "1.0.38" } } diff --git a/src/DocumentationGenerator/DocumentationGenerator.csproj b/src/DocumentationGenerator/DocumentationGenerator.csproj index 42fa597d..759553d1 100644 --- a/src/DocumentationGenerator/DocumentationGenerator.csproj +++ b/src/DocumentationGenerator/DocumentationGenerator.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/DocumentationGenerator/Program.cs b/src/DocumentationGenerator/Program.cs index a1766482..d6c7aad0 100644 --- a/src/DocumentationGenerator/Program.cs +++ b/src/DocumentationGenerator/Program.cs @@ -2,8 +2,6 @@ #pragma warning disable CA1849 #pragma warning disable MA0004 #pragma warning disable MA0009 -using System.Globalization; -using System.Text; using System.Text.Encodings.Web; using System.Text.RegularExpressions; using Meziantou.Framework; diff --git a/src/ListDotNetTypes/ListDotNetTypes.csproj b/src/ListDotNetTypes/ListDotNetTypes.csproj index 2348a2ee..e37b0a6b 100644 --- a/src/ListDotNetTypes/ListDotNetTypes.csproj +++ b/src/ListDotNetTypes/ListDotNetTypes.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Meziantou.Analyzer.CodeFixers/Internals/FixAllContextHelper.cs b/src/Meziantou.Analyzer.CodeFixers/Internals/FixAllContextHelper.cs index 05507550..bc720e4b 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Internals/FixAllContextHelper.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Internals/FixAllContextHelper.cs @@ -1,13 +1,10 @@ -// File initially copied from +// File initially copied from // https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/4d9b3e3bb785a55f73b3029a843f0c0b73cc9ea7/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Helpers/FixAllContextHelper.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.Concurrent; using System.Collections.Immutable; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; @@ -40,9 +37,7 @@ public static async Task p.Language == project.Language) - .ToImmutableArray(); + projectsToFix = ImmutableArray.Empty.AddRange(project.Solution.Projects.Where(p => p.Language == project.Language)); var diagnostics = new ConcurrentDictionary>(); var tasks = new Task[projectsToFix.Length]; diff --git a/src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj b/src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj index 6dc7ebe5..9befcd77 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj +++ b/src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj @@ -1,6 +1,6 @@  - net9.0;netstandard2.0 + net10.0;netstandard2.0 false 1.0.1 bin\$(RoslynVersion)\ diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/AbstractTypesShouldNotHaveConstructorsFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/AbstractTypesShouldNotHaveConstructorsFixer.cs index ed0b65fc..03c8175e 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/AbstractTypesShouldNotHaveConstructorsFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/AbstractTypesShouldNotHaveConstructorsFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/ArgumentExceptionShouldSpecifyArgumentNameFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/ArgumentExceptionShouldSpecifyArgumentNameFixer.cs index 0f93eced..296fdd47 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/ArgumentExceptionShouldSpecifyArgumentNameFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/ArgumentExceptionShouldSpecifyArgumentNameFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidComparisonWithBoolConstantFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidComparisonWithBoolConstantFixer.cs index f95de44b..509d89b7 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidComparisonWithBoolConstantFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidComparisonWithBoolConstantFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs index fbea5985..eff03398 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixAllProvider.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Threading.Tasks; +using System.Collections.Immutable; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixer.cs index 41ecc4ca..1d6af479 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/AvoidUsingRedundantElseFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/ClassMustBeSealedFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/ClassMustBeSealedFixer.cs index f6effc16..91e7e4f0 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/ClassMustBeSealedFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/ClassMustBeSealedFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/CommaFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/CommaFixer.cs index 8a8a9b8c..ee1bcd25 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/CommaFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/CommaFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotRemoveOriginalExceptionFromThrowStatementFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotRemoveOriginalExceptionFromThrowStatementFixer.cs index 6f49e947..30a2d196 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotRemoveOriginalExceptionFromThrowStatementFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotRemoveOriginalExceptionFromThrowStatementFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseBlockingCallInAsyncContextFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseBlockingCallInAsyncContextFixer.cs index 1f2bb743..03b5b6ee 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseBlockingCallInAsyncContextFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseBlockingCallInAsyncContextFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityComparerDefaultOfStringFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityComparerDefaultOfStringFixer.cs index c2b7abbe..c5dd8ed3 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityComparerDefaultOfStringFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityComparerDefaultOfStringFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityOperatorsForSpanOfCharFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityOperatorsForSpanOfCharFixer.cs index d8971b88..b22f331f 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityOperatorsForSpanOfCharFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseEqualityOperatorsForSpanOfCharFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseStringGetHashCodeFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseStringGetHashCodeFixer.cs index b3090704..557b297c 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseStringGetHashCodeFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/DoNotUseStringGetHashCodeFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/EqualityShouldBeCorrectlyImplementedFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/EqualityShouldBeCorrectlyImplementedFixer.cs index d5bf6ae5..35faf59d 100755 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/EqualityShouldBeCorrectlyImplementedFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/EqualityShouldBeCorrectlyImplementedFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/EventsShouldHaveProperArgumentsFixer.MA0091.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/EventsShouldHaveProperArgumentsFixer.MA0091.cs index 64403be2..41fea353 100755 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/EventsShouldHaveProperArgumentsFixer.MA0091.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/EventsShouldHaveProperArgumentsFixer.MA0091.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeClassStaticFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeClassStaticFixer.cs index bb33b0e1..257af17d 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeClassStaticFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeClassStaticFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeInterpolatedStringFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeInterpolatedStringFixer.cs index 686320ab..68f8b550 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeInterpolatedStringFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeInterpolatedStringFixer.cs @@ -1,15 +1,11 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; -using Microsoft.CodeAnalysis.Formatting; namespace Meziantou.Analyzer.Rules; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs index aadb5961..d2641b63 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMemberReadOnlyFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMethodStaticFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMethodStaticFixer.cs index 61377f1c..25b50cdb 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMethodStaticFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MakeMethodStaticFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; @@ -27,7 +25,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); var nodeToFix = root?.FindNode(context.Span, getInnermostNodeForTie: true); - if (nodeToFix is MethodDeclarationSyntax || nodeToFix is PropertyDeclarationSyntax) + if (nodeToFix is MethodDeclarationSyntax or PropertyDeclarationSyntax) { var title = "Add static modifier"; var codeAction = CodeAction.Create( diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs index 1b65d702..0e5d8263 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MarkAttributesWithAttributeUsageAttributeFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/MethodOverridesShouldNotChangeParameterDefaultsFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/MethodOverridesShouldNotChangeParameterDefaultsFixer.cs index 9f4cacaf..e25fc5d9 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/MethodOverridesShouldNotChangeParameterDefaultsFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/MethodOverridesShouldNotChangeParameterDefaultsFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/NamedParameterFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/NamedParameterFixer.cs index 7f5f3d96..62cb6076 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/NamedParameterFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/NamedParameterFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs index 7723ec7d..3e7befa4 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/NotPatternShouldBeParenthesizedCodeFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeGuidCreationFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeGuidCreationFixer.cs index b415af91..c021b492 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeGuidCreationFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeGuidCreationFixer.cs @@ -1,9 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Net.NetworkInformation; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeLinqUsageFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeLinqUsageFixer.cs index f120f2ad..69f5ba2a 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeLinqUsageFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeLinqUsageFixer.cs @@ -1,10 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Globalization; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStartsWithFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStartsWithFixer.cs index c45b71c8..51911812 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStartsWithFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStartsWithFixer.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs index 2802ed8e..82f170a6 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/OptimizeStringBuilderUsageFixer.cs @@ -1,11 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; @@ -260,7 +254,7 @@ private static async Task ReplaceStringFormatWithAppendFormat(Document var stringFormatOperation = (IInvocationOperation)operation.Arguments[0].Value; var newExpression = generator.InvocationExpression(generator.MemberAccessExpression(operation.GetChildOperations().First().Syntax, "AppendFormat"), - stringFormatOperation.Arguments.Select(a => a.Syntax).ToArray()); + [.. stringFormatOperation.Arguments.Select(a => a.Syntax)]); if (isAppendLine) { @@ -285,7 +279,7 @@ private static async Task ReplaceStringJoinWithAppendJoin(Document doc var stringFormatOperation = (IInvocationOperation)operation.Arguments[0].Value; var newExpression = generator.InvocationExpression(generator.MemberAccessExpression(operation.GetChildOperations().First().Syntax, "AppendJoin"), - stringFormatOperation.Arguments.Select(a => a.Syntax).ToArray()); + [.. stringFormatOperation.Arguments.Select(a => a.Syntax)]); if (isAppendLine) { diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/ParameterAttributeForRazorComponentFixer.AddParameterAttribute.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/ParameterAttributeForRazorComponentFixer.AddParameterAttribute.cs index 8f9f2083..cada87ff 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/ParameterAttributeForRazorComponentFixer.AddParameterAttribute.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/ParameterAttributeForRazorComponentFixer.AddParameterAttribute.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/PreserveParamsOnOverrideFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/PreserveParamsOnOverrideFixer.cs index 38827a6c..68215a8b 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/PreserveParamsOnOverrideFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/PreserveParamsOnOverrideFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveEmptyStatementFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveEmptyStatementFixer.cs index 210b68ec..0ab4a653 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveEmptyStatementFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveEmptyStatementFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveUselessToStringFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveUselessToStringFixer.cs index e90ca3b4..b93d475e 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveUselessToStringFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/RemoveUselessToStringFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/ReplaceEnumToStringWithNameofFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/ReplaceEnumToStringWithNameofFixer.cs index e6a11bea..8000eb42 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/ReplaceEnumToStringWithNameofFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/ReplaceEnumToStringWithNameofFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/ReturnTaskFromResultInsteadOfReturningNullFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/ReturnTaskFromResultInsteadOfReturningNullFixer.cs index c65422c6..6fd24d1a 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/ReturnTaskFromResultInsteadOfReturningNullFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/ReturnTaskFromResultInsteadOfReturningNullFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/SimplifyCallerArgumentExpressionFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/SimplifyCallerArgumentExpressionFixer.cs index ae4e15a0..36b34931 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/SimplifyCallerArgumentExpressionFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/SimplifyCallerArgumentExpressionFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; @@ -24,7 +22,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); var nodeToFix = root?.FindNode(context.Span, getInnermostNodeForTie: false); - if (nodeToFix is null || nodeToFix is not ArgumentSyntax) + if (nodeToFix is null or not ArgumentSyntax) return; var title = "Remove argument"; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/StringShouldNotContainsNonDeterministicEndOfLineFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/StringShouldNotContainsNonDeterministicEndOfLineFixer.cs index 1d444975..94bb91ea 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/StringShouldNotContainsNonDeterministicEndOfLineFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/StringShouldNotContainsNonDeterministicEndOfLineFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_Argument.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_Argument.cs index 1212d8ca..75ad0f94 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_Argument.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_Argument.cs @@ -1,8 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_AwaitForEach.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_AwaitForEach.cs index 47159c90..e086f4f7 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_AwaitForEach.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasCancellationTokenFixer_AwaitForEach.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasTimeProviderFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasTimeProviderFixer.cs index 1ffc923d..a3612b84 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasTimeProviderFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseAnOverloadThatHasTimeProviderFixer.cs @@ -1,15 +1,11 @@ using System.Collections.Immutable; using System.Composition; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; -using Microsoft.CodeAnalysis.Operations; namespace Meziantou.Analyzer.Rules; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseArrayEmptyFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseArrayEmptyFixer.cs index 68168ee3..f2611aff 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseArrayEmptyFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseArrayEmptyFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseConfigureAwaitFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseConfigureAwaitFixer.cs index 1008d7c2..46ca11b9 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseConfigureAwaitFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseConfigureAwaitFixer.cs @@ -1,8 +1,5 @@ using System.Collections.Immutable; using System.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseDateTimeUnixEpochFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseDateTimeUnixEpochFixer.cs index 416e70d7..99729b80 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseDateTimeUnixEpochFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseDateTimeUnixEpochFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseEventArgsEmptyFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseEventArgsEmptyFixer.cs index b2b152ba..a9d59575 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseEventArgsEmptyFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseEventArgsEmptyFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseGuidEmptyFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseGuidEmptyFixer.cs index 218771a2..e960c578 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseGuidEmptyFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseGuidEmptyFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseIsPatternInsteadOfSequenceEqualFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseIsPatternInsteadOfSequenceEqualFixer.cs index d18e6bd0..1dcf0831 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseIsPatternInsteadOfSequenceEqualFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseIsPatternInsteadOfSequenceEqualFixer.cs @@ -1,12 +1,10 @@ -using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis; using System.Composition; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Operations; using System.Collections.Immutable; -using System.Threading.Tasks; -using System.Threading; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedFixer.cs index 650ae32f..17a24622 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseLangwordInXmlCommentFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseLangwordInXmlCommentFixer.cs index 496506a1..622d09a0 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseLangwordInXmlCommentFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseLangwordInXmlCommentFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingForEqualityComparisonsFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingForEqualityComparisonsFixer.cs index fdda62f3..f64fc744 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingForEqualityComparisonsFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingForEqualityComparisonsFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingInsteadOfHasvalueFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingInsteadOfHasvalueFixer.cs index c0b9a9cb..086d5861 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingInsteadOfHasvalueFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UsePatternMatchingInsteadOfHasvalueFixer.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; @@ -71,7 +71,7 @@ private static (SyntaxNode Node, bool Negate) GetNodeToReplace(IOperation operat } } - if (operation.Parent is IIsPatternOperation { Pattern: IConstantPatternOperation { Value: ILiteralOperation { ConstantValue: { Value: bool value } } } }) + if (operation.Parent is IIsPatternOperation { Pattern: IConstantPatternOperation { Value: ILiteralOperation { ConstantValue.Value: bool value } } }) { if (value) { diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseRegexSourceGeneratorFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseRegexSourceGeneratorFixer.cs index d6e93ba2..8a239a48 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseRegexSourceGeneratorFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseRegexSourceGeneratorFixer.cs @@ -1,10 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Globalization; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; @@ -117,13 +112,13 @@ private static async Task ConvertToSourceGenerator(Document document, TryParseInt32(properties, UseRegexSourceGeneratorAnalyzerCommon.RegexOptionsIndexName), TryParseInt32(properties, UseRegexSourceGeneratorAnalyzerCommon.RegexTimeoutIndexName), }; - foreach (var index in indices.Where(value => value is not null).OrderByDescending(value => value)) + foreach (var index in indices.Where(value => value is not null).OrderDescending()) { arguments = arguments.RemoveAt(index.GetValueOrDefault()); } var createRegexMethod = generator.InvocationExpression(generator.IdentifierName(methodName)); - var method = generator.InvocationExpression(generator.MemberAccessExpression(createRegexMethod, invocationOperation.TargetMethod.Name), arguments.Select(arg => arg.Syntax).ToArray()); + var method = generator.InvocationExpression(generator.MemberAccessExpression(createRegexMethod, invocationOperation.TargetMethod.Name), [.. arguments.Select(arg => arg.Syntax)]); newTypeDeclaration = newTypeDeclaration.ReplaceNode(nodeToFix, method); } diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparerFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparerFixer.cs index e101c81e..692bcc98 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparerFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparerFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparisonFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparisonFixer.cs index d16eb0c1..1e8a3ef2 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparisonFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringComparisonFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringCreateInsteadOfFormattableStringFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringCreateInsteadOfFormattableStringFixer.cs index 1d180379..6a3415a8 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringCreateInsteadOfFormattableStringFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringCreateInsteadOfFormattableStringFixer.cs @@ -1,7 +1,5 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringEqualsFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringEqualsFixer.cs index ea8e163a..0e6baa65 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringEqualsFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStringEqualsFixer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Composition; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs index 9cc33dcd..4cf70f63 100644 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/UseStructLayoutAttributeFixer.cs @@ -1,8 +1,6 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Composition; using System.Runtime.InteropServices; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer.CodeFixers/Rules/ValidateArgumentsCorrectlyFixer.cs b/src/Meziantou.Analyzer.CodeFixers/Rules/ValidateArgumentsCorrectlyFixer.cs index 58f24c40..356cc333 100755 --- a/src/Meziantou.Analyzer.CodeFixers/Rules/ValidateArgumentsCorrectlyFixer.cs +++ b/src/Meziantou.Analyzer.CodeFixers/Rules/ValidateArgumentsCorrectlyFixer.cs @@ -1,10 +1,5 @@ -using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; -using System.Globalization; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; diff --git a/src/Meziantou.Analyzer/Configurations/AnalyzerOptionsExtensions.cs b/src/Meziantou.Analyzer/Configurations/AnalyzerOptionsExtensions.cs index 587cf09b..62a783b6 100644 --- a/src/Meziantou.Analyzer/Configurations/AnalyzerOptionsExtensions.cs +++ b/src/Meziantou.Analyzer/Configurations/AnalyzerOptionsExtensions.cs @@ -1,6 +1,3 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Internals/AwaitableTypes.cs b/src/Meziantou.Analyzer/Internals/AwaitableTypes.cs index 4367fc39..e84d5893 100644 --- a/src/Meziantou.Analyzer/Internals/AwaitableTypes.cs +++ b/src/Meziantou.Analyzer/Internals/AwaitableTypes.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; -using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Operations; diff --git a/src/Meziantou.Analyzer/Internals/ConcurrentHashSet.cs b/src/Meziantou.Analyzer/Internals/ConcurrentHashSet.cs index 2fec8bc5..04ffa7ae 100644 --- a/src/Meziantou.Analyzer/Internals/ConcurrentHashSet.cs +++ b/src/Meziantou.Analyzer/Internals/ConcurrentHashSet.cs @@ -1,6 +1,5 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Collections; -using System.Collections.Generic; namespace Meziantou.Analyzer.Internals; internal sealed class ConcurrentHashSet : ICollection, IReadOnlyCollection diff --git a/src/Meziantou.Analyzer/Internals/ContextExtensions.cs b/src/Meziantou.Analyzer/Internals/ContextExtensions.cs index 63a6353f..008d45bb 100755 --- a/src/Meziantou.Analyzer/Internals/ContextExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/ContextExtensions.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Immutable; using System.Data; -using System.Linq; -using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; diff --git a/src/Meziantou.Analyzer/Internals/CultureSensitiveFormattingContext.cs b/src/Meziantou.Analyzer/Internals/CultureSensitiveFormattingContext.cs index c0c04845..8385ee76 100755 --- a/src/Meziantou.Analyzer/Internals/CultureSensitiveFormattingContext.cs +++ b/src/Meziantou.Analyzer/Internals/CultureSensitiveFormattingContext.cs @@ -1,7 +1,4 @@ -using System; -using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; namespace Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Internals/CultureSensitiveOptions.cs b/src/Meziantou.Analyzer/Internals/CultureSensitiveOptions.cs index 29982093..23775661 100644 --- a/src/Meziantou.Analyzer/Internals/CultureSensitiveOptions.cs +++ b/src/Meziantou.Analyzer/Internals/CultureSensitiveOptions.cs @@ -1,5 +1,3 @@ -using System; - namespace Meziantou.Analyzer.Internals; [Flags] diff --git a/src/Meziantou.Analyzer/Internals/DiagnosticFieldReportOptions.cs b/src/Meziantou.Analyzer/Internals/DiagnosticFieldReportOptions.cs index 5d63e67b..137b1091 100644 --- a/src/Meziantou.Analyzer/Internals/DiagnosticFieldReportOptions.cs +++ b/src/Meziantou.Analyzer/Internals/DiagnosticFieldReportOptions.cs @@ -1,5 +1,3 @@ -using System; - namespace Meziantou.Analyzer.Internals; [Flags] diff --git a/src/Meziantou.Analyzer/Internals/DiagnosticInvocationReportOptions.cs b/src/Meziantou.Analyzer/Internals/DiagnosticInvocationReportOptions.cs index 6aa0e8d2..c0305c16 100644 --- a/src/Meziantou.Analyzer/Internals/DiagnosticInvocationReportOptions.cs +++ b/src/Meziantou.Analyzer/Internals/DiagnosticInvocationReportOptions.cs @@ -1,5 +1,3 @@ -using System; - namespace Meziantou.Analyzer.Internals; [Flags] diff --git a/src/Meziantou.Analyzer/Internals/DiagnosticMethodReportOptions.cs b/src/Meziantou.Analyzer/Internals/DiagnosticMethodReportOptions.cs index 71c28384..617c53a8 100644 --- a/src/Meziantou.Analyzer/Internals/DiagnosticMethodReportOptions.cs +++ b/src/Meziantou.Analyzer/Internals/DiagnosticMethodReportOptions.cs @@ -1,5 +1,3 @@ -using System; - namespace Meziantou.Analyzer.Internals; [Flags] diff --git a/src/Meziantou.Analyzer/Internals/DiagnosticParameterReportOptions.cs b/src/Meziantou.Analyzer/Internals/DiagnosticParameterReportOptions.cs index 8d05bac6..d4303c0b 100644 --- a/src/Meziantou.Analyzer/Internals/DiagnosticParameterReportOptions.cs +++ b/src/Meziantou.Analyzer/Internals/DiagnosticParameterReportOptions.cs @@ -1,5 +1,3 @@ -using System; - namespace Meziantou.Analyzer.Internals; [Flags] diff --git a/src/Meziantou.Analyzer/Internals/DiagnosticPropertyReportOptions.cs b/src/Meziantou.Analyzer/Internals/DiagnosticPropertyReportOptions.cs index 135b05bf..5769c25a 100644 --- a/src/Meziantou.Analyzer/Internals/DiagnosticPropertyReportOptions.cs +++ b/src/Meziantou.Analyzer/Internals/DiagnosticPropertyReportOptions.cs @@ -1,5 +1,3 @@ -using System; - namespace Meziantou.Analyzer.Internals; [Flags] diff --git a/src/Meziantou.Analyzer/Internals/DiagnosticReporter.cs b/src/Meziantou.Analyzer/Internals/DiagnosticReporter.cs index c9f275f9..ab2fb63f 100644 --- a/src/Meziantou.Analyzer/Internals/DiagnosticReporter.cs +++ b/src/Meziantou.Analyzer/Internals/DiagnosticReporter.cs @@ -1,5 +1,3 @@ -using System; -using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs b/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs index c9675124..90c9d468 100644 --- a/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/EnumerableExtensions.cs @@ -1,7 +1,3 @@ -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; - namespace Meziantou.Analyzer.Internals; internal static class EnumerableExtensions diff --git a/src/Meziantou.Analyzer/Internals/HashSetExtensions.cs b/src/Meziantou.Analyzer/Internals/HashSetExtensions.cs index 9c0bfb38..abe54305 100644 --- a/src/Meziantou.Analyzer/Internals/HashSetExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/HashSetExtensions.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - namespace Meziantou.Analyzer.Internals; internal static class HashSetExtensions { diff --git a/src/Meziantou.Analyzer/Internals/ListExtensions.cs b/src/Meziantou.Analyzer/Internals/ListExtensions.cs index bf5425f5..3672a908 100644 --- a/src/Meziantou.Analyzer/Internals/ListExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/ListExtensions.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - namespace Meziantou.Analyzer.Internals; internal static class ListExtensions diff --git a/src/Meziantou.Analyzer/Internals/LocationExtensions.cs b/src/Meziantou.Analyzer/Internals/LocationExtensions.cs index 34a01931..5daea14f 100644 --- a/src/Meziantou.Analyzer/Internals/LocationExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/LocationExtensions.cs @@ -1,4 +1,3 @@ -using System.Threading; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Internals/MethodSymbolExtensions.cs b/src/Meziantou.Analyzer/Internals/MethodSymbolExtensions.cs index 824476c7..e39e60bd 100755 --- a/src/Meziantou.Analyzer/Internals/MethodSymbolExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/MethodSymbolExtensions.cs @@ -1,4 +1,3 @@ -using System.Linq; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Internals/ObjectPool.cs b/src/Meziantou.Analyzer/Internals/ObjectPool.cs index e00cc117..f9670c31 100644 --- a/src/Meziantou.Analyzer/Internals/ObjectPool.cs +++ b/src/Meziantou.Analyzer/Internals/ObjectPool.cs @@ -1,9 +1,6 @@ #pragma warning disable MA0048 // File name must match type name #pragma warning disable RS1035 // Do not use APIs banned for analyzers using System.Collections.Concurrent; -using System.Threading; -using System; -using System.Text; namespace Meziantou.Analyzer.Internals; @@ -128,7 +125,7 @@ public DefaultObjectPool(IPooledObjectPolicy policy, int maximumRetained) public override T Get() { var item = FastItem; - if (item == null || Interlocked.CompareExchange(ref FastItem, null, item) != item) + if (item == null || Interlocked.CompareExchange(ref FastItem, value: null, item) != item) { if (Items.TryDequeue(out item)) { diff --git a/src/Meziantou.Analyzer/Internals/OperationExtensions.cs b/src/Meziantou.Analyzer/Internals/OperationExtensions.cs index b877367c..4e017488 100644 --- a/src/Meziantou.Analyzer/Internals/OperationExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/OperationExtensions.cs @@ -1,7 +1,3 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Internals/OverloadFinder.cs b/src/Meziantou.Analyzer/Internals/OverloadFinder.cs index a89847cb..a1ca6eeb 100644 --- a/src/Meziantou.Analyzer/Internals/OverloadFinder.cs +++ b/src/Meziantou.Analyzer/Internals/OverloadFinder.cs @@ -1,5 +1,4 @@ using System.Collections.Immutable; -using System.Linq; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Internals; @@ -64,7 +63,7 @@ public bool HasOverloadWithAdditionalParameterOfType( if (additionalParameterTypes is null) return null; - additionalParameterTypes = additionalParameterTypes.Where(type => type is not null).ToArray(); + additionalParameterTypes = [.. additionalParameterTypes.Where(type => type is not null)]; if (additionalParameterTypes.Length == 0) return null; diff --git a/src/Meziantou.Analyzer/Internals/StringExtensions.cs b/src/Meziantou.Analyzer/Internals/StringExtensions.cs index 1b3a2b5f..6ad4921a 100644 --- a/src/Meziantou.Analyzer/Internals/StringExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/StringExtensions.cs @@ -1,4 +1,3 @@ -using System; using System.Runtime.InteropServices; namespace Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Internals/SuppressorHelpers.cs b/src/Meziantou.Analyzer/Internals/SuppressorHelpers.cs index e8c94012..c84d26a9 100644 --- a/src/Meziantou.Analyzer/Internals/SuppressorHelpers.cs +++ b/src/Meziantou.Analyzer/Internals/SuppressorHelpers.cs @@ -1,4 +1,3 @@ -using System.Threading; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Internals/SymbolExtensions.cs b/src/Meziantou.Analyzer/Internals/SymbolExtensions.cs index 4452256d..acaf0eb4 100644 --- a/src/Meziantou.Analyzer/Internals/SymbolExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/SymbolExtensions.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Threading; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Internals; @@ -20,9 +17,7 @@ public static bool IsVisibleOutsideOfAssembly([NotNullWhen(true)] this ISymbol? if (symbol is null) return false; - if (symbol.DeclaredAccessibility != Accessibility.Public && - symbol.DeclaredAccessibility != Accessibility.Protected && - symbol.DeclaredAccessibility != Accessibility.ProtectedOrInternal) + if (symbol.DeclaredAccessibility is not Accessibility.Public and not Accessibility.Protected and not Accessibility.ProtectedOrInternal) { return false; } diff --git a/src/Meziantou.Analyzer/Internals/SyntaxNodeExtensions.cs b/src/Meziantou.Analyzer/Internals/SyntaxNodeExtensions.cs index f4c37cc7..5018b7c0 100644 --- a/src/Meziantou.Analyzer/Internals/SyntaxNodeExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/SyntaxNodeExtensions.cs @@ -1,5 +1,3 @@ -using System; -using System.Linq; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Internals/SyntaxTokenListExtensions.cs b/src/Meziantou.Analyzer/Internals/SyntaxTokenListExtensions.cs index 486dcbf6..e3b36603 100644 --- a/src/Meziantou.Analyzer/Internals/SyntaxTokenListExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/SyntaxTokenListExtensions.cs @@ -1,4 +1,3 @@ -using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Meziantou.Analyzer/Internals/TimeSpanOperation.cs b/src/Meziantou.Analyzer/Internals/TimeSpanOperation.cs index 2c040091..8b424cd8 100644 --- a/src/Meziantou.Analyzer/Internals/TimeSpanOperation.cs +++ b/src/Meziantou.Analyzer/Internals/TimeSpanOperation.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Operations; diff --git a/src/Meziantou.Analyzer/Internals/TypeSymbolExtensions.cs b/src/Meziantou.Analyzer/Internals/TypeSymbolExtensions.cs index 7e26287d..98ca2e8d 100755 --- a/src/Meziantou.Analyzer/Internals/TypeSymbolExtensions.cs +++ b/src/Meziantou.Analyzer/Internals/TypeSymbolExtensions.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Meziantou.Analyzer.csproj b/src/Meziantou.Analyzer/Meziantou.Analyzer.csproj index 57b7855b..6df94616 100644 --- a/src/Meziantou.Analyzer/Meziantou.Analyzer.csproj +++ b/src/Meziantou.Analyzer/Meziantou.Analyzer.csproj @@ -1,6 +1,6 @@  - net9.0;netstandard2.0 + net10.0;netstandard2.0 false 1.0.1 diff --git a/src/Meziantou.Analyzer/RuleIdentifiers.cs b/src/Meziantou.Analyzer/RuleIdentifiers.cs index 0afe3709..64a7420b 100755 --- a/src/Meziantou.Analyzer/RuleIdentifiers.cs +++ b/src/Meziantou.Analyzer/RuleIdentifiers.cs @@ -1,5 +1,3 @@ -using System.Globalization; - namespace Meziantou.Analyzer; internal static class RuleIdentifiers diff --git a/src/Meziantou.Analyzer/Rules/AddOverloadWithSpanOrMemoryAnalyzer.cs b/src/Meziantou.Analyzer/Rules/AddOverloadWithSpanOrMemoryAnalyzer.cs index cfe6041f..b99a1ded 100644 --- a/src/Meziantou.Analyzer/Rules/AddOverloadWithSpanOrMemoryAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/AddOverloadWithSpanOrMemoryAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer.cs index c7e3e597..ce48df78 100644 --- a/src/Meziantou.Analyzer/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; -using System.Threading; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs b/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs index a4e7e39e..76c45813 100644 --- a/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/AvoidClosureWhenUsingConcurrentDictionaryAnalyzer.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/AvoidComparisonWithBoolConstantAnalyzer.cs b/src/Meziantou.Analyzer/Rules/AvoidComparisonWithBoolConstantAnalyzer.cs index e796aff5..1a63feb5 100644 --- a/src/Meziantou.Analyzer/Rules/AvoidComparisonWithBoolConstantAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/AvoidComparisonWithBoolConstantAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Globalization; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs index aa8978e5..12a63195 100644 --- a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzer.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs index 90a6f036..62cd72d7 100644 --- a/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs +++ b/src/Meziantou.Analyzer/Rules/AvoidUsingRedundantElseAnalyzerCommon.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/AwaitTaskBeforeDisposingResourcesAnalyzer.cs b/src/Meziantou.Analyzer/Rules/AwaitTaskBeforeDisposingResourcesAnalyzer.cs index cf336ae2..35b61237 100644 --- a/src/Meziantou.Analyzer/Rules/AwaitTaskBeforeDisposingResourcesAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/AwaitTaskBeforeDisposingResourcesAnalyzer.cs @@ -1,6 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/ClassMustBeSealedAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ClassMustBeSealedAnalyzer.cs index b225dada..db3c9ade 100644 --- a/src/Meziantou.Analyzer/Rules/ClassMustBeSealedAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ClassMustBeSealedAnalyzer.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; -using System.Threading; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; @@ -113,7 +110,7 @@ private bool IsPotentialSealed(AnalyzerOptions options, INamedTypeSymbol symbol, if (symbol.GetMembers().Any(member => member.IsVirtual) && !SealedClassWithVirtualMember(options, symbol)) return false; - var canBeInheritedOutsideOfAssembly = symbol.IsVisibleOutsideOfAssembly() && symbol.GetMembers().OfType().Where(member => member.MethodKind is MethodKind.Constructor).Any(member => member.IsVisibleOutsideOfAssembly()); + var canBeInheritedOutsideOfAssembly = symbol.IsVisibleOutsideOfAssembly() && symbol.GetMembers().OfType().Any(member => member.MethodKind is MethodKind.Constructor && member.IsVisibleOutsideOfAssembly()); if (canBeInheritedOutsideOfAssembly && !PublicClassShouldBeSealed(options, symbol)) return false; diff --git a/src/Meziantou.Analyzer/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzer.cs index c2bd3d39..7dfcff41 100644 --- a/src/Meziantou.Analyzer/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/DebuggerDisplayAttributeShouldContainValidExpressionsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DebuggerDisplayAttributeShouldContainValidExpressionsAnalyzer.cs index 5437e820..d4611f27 100644 --- a/src/Meziantou.Analyzer/Rules/DebuggerDisplayAttributeShouldContainValidExpressionsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DebuggerDisplayAttributeShouldContainValidExpressionsAnalyzer.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; -using System.Diagnostics.SymbolStore; -using System.Globalization; -using System.Linq; -using System.Linq.Expressions; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -209,7 +203,7 @@ private static bool IsValid(Compilation compilation, ISymbol rootSymbol, List.Result), StringComparison.Ordinal)) + if (string.Equals(operation.Property.Name, nameof(Task<>.Result), StringComparison.Ordinal)) { if (operation.Member.ContainingType.OriginalDefinition.IsEqualToAny(TaskOfTSymbol, ValueTaskOfTSymbol)) { diff --git a/src/Meziantou.Analyzer/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzer.cs index f6b659ba..c990a6ca 100644 --- a/src/Meziantou.Analyzer/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzer.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; @@ -34,7 +32,7 @@ public override void Initialize(AnalysisContext context) private static void Analyze(OperationAnalysisContext context) { var operation = (IPropertyReferenceOperation)context.Operation; - if (!string.Equals(operation.Member.Name, nameof(EqualityComparer.Default), StringComparison.Ordinal)) + if (!string.Equals(operation.Member.Name, nameof(EqualityComparer<>.Default), StringComparison.Ordinal)) return; var equalityComparerSymbol = context.Compilation.GetBestTypeByMetadataName("System.Collections.Generic.EqualityComparer`1"); diff --git a/src/Meziantou.Analyzer/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzer.cs index 14182096..3918b8a5 100644 --- a/src/Meziantou.Analyzer/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzer.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; @@ -45,8 +45,7 @@ private sealed class AnalyzerContext(Compilation compilation, params INamedTypeS public void AnalyzeBinaryOperator(OperationAnalysisContext context) { var operation = (IBinaryOperation)context.Operation; - if (operation.OperatorKind == BinaryOperatorKind.Equals || - operation.OperatorKind == BinaryOperatorKind.NotEquals) + if (operation.OperatorKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals) { if (!IsSpanOfString(operation.LeftOperand.Type) || !IsSpanOfString(operation.RightOperand.Type)) return; diff --git a/src/Meziantou.Analyzer/Rules/DoNotUseServerCertificateValidationCallbackAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DoNotUseServerCertificateValidationCallbackAnalyzer.cs index 8872aff5..21e59824 100644 --- a/src/Meziantou.Analyzer/Rules/DoNotUseServerCertificateValidationCallbackAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DoNotUseServerCertificateValidationCallbackAnalyzer.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/DoNotUseToStringIfObjectAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DoNotUseToStringIfObjectAnalyzer.cs index 6cf2a2ab..08851be2 100644 --- a/src/Meziantou.Analyzer/Rules/DoNotUseToStringIfObjectAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DoNotUseToStringIfObjectAnalyzer.cs @@ -1,6 +1,5 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzer.cs index 2627802d..c176ed5f 100644 --- a/src/Meziantou.Analyzer/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzer.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/DontUseDangerousThreadingMethodsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DontUseDangerousThreadingMethodsAnalyzer.cs index 692f0ba5..94f59129 100644 --- a/src/Meziantou.Analyzer/Rules/DontUseDangerousThreadingMethodsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DontUseDangerousThreadingMethodsAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/DotNotUseNameFromBCLAnalyzer.cs b/src/Meziantou.Analyzer/Rules/DotNotUseNameFromBCLAnalyzer.cs index f68e1ca8..2b447aec 100644 --- a/src/Meziantou.Analyzer/Rules/DotNotUseNameFromBCLAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/DotNotUseNameFromBCLAnalyzer.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.IO; using System.Text.RegularExpressions; -using System.Threading; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzer.cs b/src/Meziantou.Analyzer/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzer.cs index e4e5f71a..dbd71a21 100644 --- a/src/Meziantou.Analyzer/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/EqualityShouldBeCorrectlyImplementedAnalyzer.cs b/src/Meziantou.Analyzer/Rules/EqualityShouldBeCorrectlyImplementedAnalyzer.cs index 4ae180f8..bc7cc5b3 100644 --- a/src/Meziantou.Analyzer/Rules/EqualityShouldBeCorrectlyImplementedAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/EqualityShouldBeCorrectlyImplementedAnalyzer.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/EventsShouldHaveProperArgumentsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/EventsShouldHaveProperArgumentsAnalyzer.cs index 9ad51062..56b08eb5 100644 --- a/src/Meziantou.Analyzer/Rules/EventsShouldHaveProperArgumentsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/EventsShouldHaveProperArgumentsAnalyzer.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Threading; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/FileNameMustMatchTypeNameAnalyzer.cs b/src/Meziantou.Analyzer/Rules/FileNameMustMatchTypeNameAnalyzer.cs index a94bb667..d4aff689 100644 --- a/src/Meziantou.Analyzer/Rules/FileNameMustMatchTypeNameAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/FileNameMustMatchTypeNameAnalyzer.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Globalization; -using System.Linq; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; @@ -113,7 +110,7 @@ private static void AnalyzeSymbol(SymbolAnalysisContext context) continue; // Type{T} - if (fileName.Equals((symbolName + '{' + string.Join(",", symbol.TypeParameters.Select(t => t.Name)) + '}').AsSpan(), StringComparison.OrdinalIgnoreCase)) + if (fileName.Equals((symbolName + '{' + string.Join(',', symbol.TypeParameters.Select(t => t.Name)) + '}').AsSpan(), StringComparison.OrdinalIgnoreCase)) continue; } diff --git a/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs b/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs index 8756ae24..623725c7 100644 --- a/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/FixToDoAnalyzer.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Meziantou.Analyzer/Rules/LocalVariablesShouldNotHideSymbolsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/LocalVariablesShouldNotHideSymbolsAnalyzer.cs index bf71d28d..d35e926e 100644 --- a/src/Meziantou.Analyzer/Rules/LocalVariablesShouldNotHideSymbolsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/LocalVariablesShouldNotHideSymbolsAnalyzer.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Threading; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Meziantou.Analyzer/Rules/LoggerParameterTypeAnalyzer.cs b/src/Meziantou.Analyzer/Rules/LoggerParameterTypeAnalyzer.cs index 78194787..88763673 100644 --- a/src/Meziantou.Analyzer/Rules/LoggerParameterTypeAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/LoggerParameterTypeAnalyzer.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Globalization; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using Microsoft.CodeAnalysis.CSharp.Syntax; -using System.IO; using Microsoft.CodeAnalysis.Text; using Meziantou.Analyzer.Configurations; using Microsoft.CodeAnalysis.CSharp; @@ -213,7 +207,7 @@ LoggerConfigurationFile LoadConfiguration() if (attribute.ConstructorArguments is [{ Type.SpecialType: SpecialType.System_String, IsNull: false, Value: string name }, TypedConstant { Kind: TypedConstantKind.Array } types]) { - configuration[name] = types.Values.Select(v => v.Value as ITypeSymbol).WhereNotNull().ToArray(); + configuration[name] = [.. types.Values.Select(v => v.Value as ITypeSymbol).WhereNotNull()]; } } } @@ -335,7 +329,7 @@ public void AnalyzeInvocationDeclaration(OperationAnalysisContext context) return; formatExpression = arg.Value; - argumentTypes = operation.TargetMethod.TypeArguments.Select((arg, index) => ((ITypeSymbol?)arg, GetSyntaxNode(operation, index))).ToArray(); + argumentTypes = [.. operation.TargetMethod.TypeArguments.Select((arg, index) => ((ITypeSymbol?)arg, GetSyntaxNode(operation, index)))]; static SyntaxNode GetSyntaxNode(IOperation operation, int index) { @@ -364,7 +358,7 @@ static SyntaxNode GetSyntaxNode(IOperation operation, int index) { if (argument.ArgumentKind == ArgumentKind.ParamArray && argument.Value is IArrayCreationOperation arrayCreation && arrayCreation.Initializer is not null) { - argumentTypes = arrayCreation.Initializer.ElementValues.Select(v => (v.UnwrapImplicitConversionOperations().Type, v.Syntax)).ToArray(); + argumentTypes = [.. arrayCreation.Initializer.ElementValues.Select(v => (v.UnwrapImplicitConversionOperations().Type, v.Syntax))]; } } } @@ -384,13 +378,13 @@ static SyntaxNode GetSyntaxNode(IOperation operation, int index) if (argument.ArgumentKind == ArgumentKind.ParamArray && argument.Value is IArrayCreationOperation arrayCreation && arrayCreation.Initializer is not null) { - argumentTypes = arrayCreation.Initializer.ElementValues.Select(v => (v.UnwrapImplicitConversionOperations().Type, v.Syntax)).ToArray(); + argumentTypes = [.. arrayCreation.Initializer.ElementValues.Select(v => (v.UnwrapImplicitConversionOperations().Type, v.Syntax))]; } } if (operation.Arguments.Length >= templateIndex && argumentTypes is null) { - argumentTypes = operation.Arguments.Skip(templateIndex + 1).Select(v => (v.Value.UnwrapImplicitConversionOperations().Type, v.Syntax)).ToArray(); + argumentTypes = [.. operation.Arguments.Skip(templateIndex + 1).Select(v => (v.Value.UnwrapImplicitConversionOperations().Type, v.Syntax))]; } } diff --git a/src/Meziantou.Analyzer/Rules/MakeClassStaticAnalyzer.cs b/src/Meziantou.Analyzer/Rules/MakeClassStaticAnalyzer.cs index f9ac2585..e7245ed1 100644 --- a/src/Meziantou.Analyzer/Rules/MakeClassStaticAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/MakeClassStaticAnalyzer.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; -using System.Threading; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/MakeInterpolatedStringAnalyzer.cs b/src/Meziantou.Analyzer/Rules/MakeInterpolatedStringAnalyzer.cs index c0b0970d..96472200 100644 --- a/src/Meziantou.Analyzer/Rules/MakeInterpolatedStringAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/MakeInterpolatedStringAnalyzer.cs @@ -1,11 +1,9 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.CodeAnalysis.Operations; namespace Meziantou.Analyzer.Rules; diff --git a/src/Meziantou.Analyzer/Rules/MakeMemberReadOnlyAnalyzer.cs b/src/Meziantou.Analyzer/Rules/MakeMemberReadOnlyAnalyzer.cs index e8428ad9..0ab470e4 100644 --- a/src/Meziantou.Analyzer/Rules/MakeMemberReadOnlyAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/MakeMemberReadOnlyAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Meziantou.Analyzer/Rules/MakeMethodStaticAnalyzer.cs b/src/Meziantou.Analyzer/Rules/MakeMethodStaticAnalyzer.cs index 012da045..60480771 100644 --- a/src/Meziantou.Analyzer/Rules/MakeMethodStaticAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/MakeMethodStaticAnalyzer.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Meziantou.Analyzer/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzer.cs index fc6b663a..d5601a4a 100644 --- a/src/Meziantou.Analyzer/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzer.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Threading; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -99,6 +97,6 @@ private static string GetParameterDisplayValue(IParameterSymbol parameter) return "null"; } - return FormattableString.Invariant($"'{parameter.ExplicitDefaultValue}'"); + return string.Create(CultureInfo.InvariantCulture, $"'{parameter.ExplicitDefaultValue}'"); } } diff --git a/src/Meziantou.Analyzer/Rules/MethodShouldNotBeTooLongAnalyzer.cs b/src/Meziantou.Analyzer/Rules/MethodShouldNotBeTooLongAnalyzer.cs index d24fbe85..9b30e3bd 100644 --- a/src/Meziantou.Analyzer/Rules/MethodShouldNotBeTooLongAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/MethodShouldNotBeTooLongAnalyzer.cs @@ -1,6 +1,4 @@ -using System.Collections.Immutable; -using System.Globalization; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; @@ -161,7 +159,7 @@ bool ShouldDescendIntoChildren(SyntaxNode node) static bool IsCountableStatement(StatementSyntax statement) { - if (statement is BlockSyntax || statement is LocalFunctionStatementSyntax) + if (statement is BlockSyntax or LocalFunctionStatementSyntax) return false; return true; diff --git a/src/Meziantou.Analyzer/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzer.cs b/src/Meziantou.Analyzer/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzer.cs index e574dcb1..58b34cc8 100644 --- a/src/Meziantou.Analyzer/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs b/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs index 55096749..9fcbbde2 100644 --- a/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/NamedParameterAnalyzer.cs @@ -1,11 +1,7 @@ -using System; using System.Collections.Immutable; -using System.Globalization; using System.Linq.Expressions; using System.Reflection; using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; @@ -36,29 +32,29 @@ public override void Initialize(AnalysisContext context) context.EnableConcurrentExecution(); context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); - context.RegisterCompilationStartAction(compilationContext => + context.RegisterCompilationStartAction(context => { - var callerMustUseNamedArgumentType = compilationContext.Compilation.GetBestTypeByMetadataName("Meziantou.Analyzer.Annotations.RequireNamedArgumentAttribute"); - - var objectType = compilationContext.Compilation.GetSpecialType(SpecialType.System_Object); - var taskTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.Task"); - var taskGenericTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.Task`1"); - var valueTaskTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.ValueTask"); - var valueTaskGenericTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.ValueTask`1"); - var taskCompletionSourceType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.TaskCompletionSource`1"); - var methodBaseTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Reflection.MethodBase"); - var fieldInfoTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Reflection.FieldInfo"); - var propertyInfoTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Reflection.PropertyInfo"); - var msTestAssertTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("Microsoft.VisualStudio.TestTools.UnitTesting.Assert"); - var nunitAssertTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("NUnit.Framework.Assert"); - var xunitAssertTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("Xunit.Assert"); - var keyValuePairTokenType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Collection.Generic.KeyValuePair`2"); - var propertyBuilderType = compilationContext.Compilation.GetBestTypeByMetadataName("Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder`1"); - var syntaxNodeType = compilationContext.Compilation.GetBestTypeByMetadataName("Microsoft.CodeAnalysis.SyntaxNode"); - var expressionType = compilationContext.Compilation.GetBestTypeByMetadataName("System.Linq.Expressions.Expression"); - var operationUtilities = new OperationUtilities(compilationContext.Compilation); - - compilationContext.RegisterSyntaxNodeAction(syntaxContext => + var callerMustUseNamedArgumentType = context.Compilation.GetBestTypeByMetadataName("Meziantou.Analyzer.Annotations.RequireNamedArgumentAttribute"); + + var objectType = context.Compilation.GetSpecialType(SpecialType.System_Object); + var taskTokenType = context.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.Task"); + var taskGenericTokenType = context.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.Task`1"); + var valueTaskTokenType = context.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.ValueTask"); + var valueTaskGenericTokenType = context.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.ValueTask`1"); + var taskCompletionSourceType = context.Compilation.GetBestTypeByMetadataName("System.Threading.Tasks.TaskCompletionSource`1"); + var methodBaseTokenType = context.Compilation.GetBestTypeByMetadataName("System.Reflection.MethodBase"); + var fieldInfoTokenType = context.Compilation.GetBestTypeByMetadataName("System.Reflection.FieldInfo"); + var propertyInfoTokenType = context.Compilation.GetBestTypeByMetadataName("System.Reflection.PropertyInfo"); + var msTestAssertTokenType = context.Compilation.GetBestTypeByMetadataName("Microsoft.VisualStudio.TestTools.UnitTesting.Assert"); + var nunitAssertTokenType = context.Compilation.GetBestTypeByMetadataName("NUnit.Framework.Assert"); + var xunitAssertTokenType = context.Compilation.GetBestTypeByMetadataName("Xunit.Assert"); + var keyValuePairTokenType = context.Compilation.GetBestTypeByMetadataName("System.Collection.Generic.KeyValuePair`2"); + var propertyBuilderType = context.Compilation.GetBestTypeByMetadataName("Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder`1"); + var syntaxNodeType = context.Compilation.GetBestTypeByMetadataName("Microsoft.CodeAnalysis.SyntaxNode"); + var expressionType = context.Compilation.GetBestTypeByMetadataName("System.Linq.Expressions.Expression"); + var operationUtilities = new OperationUtilities(context.Compilation); + + context.RegisterSyntaxNodeAction(syntaxContext => { var argument = (ArgumentSyntax)syntaxContext.Node; if (argument.NameColon is not null) @@ -220,10 +216,10 @@ bool IsParams(SyntaxNode node) if (IsMethod(invokedMethodSymbol, valueTaskTokenType, nameof(Task.FromResult))) return; - if (IsMethod(invokedMethodSymbol, taskCompletionSourceType, nameof(TaskCompletionSource.SetResult))) + if (IsMethod(invokedMethodSymbol, taskCompletionSourceType, nameof(TaskCompletionSource<>.SetResult))) return; - if (IsMethod(invokedMethodSymbol, taskCompletionSourceType, nameof(TaskCompletionSource.TrySetResult))) + if (IsMethod(invokedMethodSymbol, taskCompletionSourceType, nameof(TaskCompletionSource<>.TrySetResult))) return; if (IsMethod(invokedMethodSymbol, methodBaseTokenType, nameof(MethodBase.Invoke)) && argumentIndex == 0) diff --git a/src/Meziantou.Analyzer/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzer.cs b/src/Meziantou.Analyzer/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzer.cs index 337ba18b..3f6131d3 100644 --- a/src/Meziantou.Analyzer/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzer.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/NullableAttributeUsageAnalyzer.cs b/src/Meziantou.Analyzer/Rules/NullableAttributeUsageAnalyzer.cs index c65cfef4..b301b9aa 100644 --- a/src/Meziantou.Analyzer/Rules/NullableAttributeUsageAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/NullableAttributeUsageAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/OptimizeLinqUsageAnalyzer.cs b/src/Meziantou.Analyzer/Rules/OptimizeLinqUsageAnalyzer.cs index b6c59ee9..3e9df666 100755 --- a/src/Meziantou.Analyzer/Rules/OptimizeLinqUsageAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/OptimizeLinqUsageAnalyzer.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Globalization; -using System.Linq; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; @@ -10,7 +6,6 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; -using static System.FormattableString; namespace Meziantou.Analyzer.Rules; @@ -566,7 +561,7 @@ private void OptimizeCountUsage(OperationAnalysisContext context, IInvocationOpe // expr.Count() == 1 if (!HasTake(operation, ExtensionMethodOwnerTypes)) { - message = Invariant($"Replace 'Count() == {value}' with 'Take({value + 1}).Count() == {value}'"); + message = string.Create(CultureInfo.InvariantCulture, $"Replace 'Count() == {value}' with 'Take({value + 1}).Count() == {value}'"); properties = CreateProperties(OptimizeLinqUsageData.UseTakeAndCount); } } @@ -591,7 +586,7 @@ private void OptimizeCountUsage(OperationAnalysisContext context, IInvocationOpe // expr.Count() != 1 if (!HasTake(operation, ExtensionMethodOwnerTypes)) { - message = Invariant($"Replace 'Count() != {value}' with 'Take({value + 1}).Count() != {value}'"); + message = string.Create(CultureInfo.InvariantCulture, $"Replace 'Count() != {value}' with 'Take({value + 1}).Count() != {value}'"); properties = CreateProperties(OptimizeLinqUsageData.UseTakeAndCount); } } @@ -614,7 +609,7 @@ private void OptimizeCountUsage(OperationAnalysisContext context, IInvocationOpe else { // expr.Count() < 10 - message = Invariant($"Replace 'Count() < {value}' with 'Skip({value - 1}).Any() == false'"); + message = string.Create(CultureInfo.InvariantCulture, $"Replace 'Count() < {value}' with 'Skip({value - 1}).Any() == false'"); properties = CreateProperties(OptimizeLinqUsageData.UseSkipAndNotAny) .Add("SkipMinusOne", value: ""); } @@ -637,7 +632,7 @@ private void OptimizeCountUsage(OperationAnalysisContext context, IInvocationOpe else { // expr.Count() < 10 - message = Invariant($"Replace 'Count() <= {value}' with 'Skip({value}).Any() == false'"); + message = string.Create(CultureInfo.InvariantCulture, $"Replace 'Count() <= {value}' with 'Skip({value}).Any() == false'"); properties = CreateProperties(OptimizeLinqUsageData.UseSkipAndNotAny); } @@ -659,7 +654,7 @@ private void OptimizeCountUsage(OperationAnalysisContext context, IInvocationOpe else { // expr.Count() > 1 - message = Invariant($"Replace 'Count() > {value}' with 'Skip({value}).Any()'"); + message = string.Create(CultureInfo.InvariantCulture, $"Replace 'Count() > {value}' with 'Skip({value}).Any()'"); properties = CreateProperties(OptimizeLinqUsageData.UseSkipAndAny); } @@ -681,7 +676,7 @@ private void OptimizeCountUsage(OperationAnalysisContext context, IInvocationOpe else { // expr.Count() >= 2 - message = Invariant($"Replace 'Count() >= {value}' with 'Skip({value - 1}).Any()'"); + message = string.Create(CultureInfo.InvariantCulture, $"Replace 'Count() >= {value}' with 'Skip({value - 1}).Any()'"); properties = CreateProperties(OptimizeLinqUsageData.UseSkipAndAny) .Add("SkipMinusOne", value: ""); } diff --git a/src/Meziantou.Analyzer/Rules/OptimizeStartsWithAnalyzer.cs b/src/Meziantou.Analyzer/Rules/OptimizeStartsWithAnalyzer.cs index fbe6b2a3..e58bd332 100644 --- a/src/Meziantou.Analyzer/Rules/OptimizeStartsWithAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/OptimizeStartsWithAnalyzer.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzer.cs b/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzer.cs index 704cdaf3..87e352df 100644 --- a/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzer.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; -using System.Text; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzerCommon.cs b/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzerCommon.cs index 4e0cb48d..aede1967 100644 --- a/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzerCommon.cs +++ b/src/Meziantou.Analyzer/Rules/OptimizeStringBuilderUsageAnalyzerCommon.cs @@ -1,4 +1,3 @@ -using System.Text; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Operations; diff --git a/src/Meziantou.Analyzer/Rules/ParameterAttributeForRazorComponentAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ParameterAttributeForRazorComponentAnalyzer.cs index cbb6d2d9..92c7bbe1 100644 --- a/src/Meziantou.Analyzer/Rules/ParameterAttributeForRazorComponentAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ParameterAttributeForRazorComponentAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzer.cs b/src/Meziantou.Analyzer/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzer.cs index c825703c..e7529139 100644 --- a/src/Meziantou.Analyzer/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzer.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/PreserveParamsOnOverrideAnalyzer.cs b/src/Meziantou.Analyzer/Rules/PreserveParamsOnOverrideAnalyzer.cs index 97a8626b..13a68373 100644 --- a/src/Meziantou.Analyzer/Rules/PreserveParamsOnOverrideAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/PreserveParamsOnOverrideAnalyzer.cs @@ -1,6 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; -using System.Threading; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzer.cs b/src/Meziantou.Analyzer/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzer.cs index 2f9e203c..d1fe3583 100644 --- a/src/Meziantou.Analyzer/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzer.cs @@ -1,8 +1,5 @@ -#if CSHARP12_OR_GREATER -using System.Collections.Generic; +#if CSHARP12_OR_GREATER using System.Collections.Immutable; -using System.Linq; -using System.Threading; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/ProcessStartAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ProcessStartAnalyzer.cs index 7e7004f5..a4d04bcb 100644 --- a/src/Meziantou.Analyzer/Rules/ProcessStartAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ProcessStartAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/RegexUsageAnalyzerBase.cs b/src/Meziantou.Analyzer/Rules/RegexUsageAnalyzerBase.cs index 82d116da..efc75570 100644 --- a/src/Meziantou.Analyzer/Rules/RegexUsageAnalyzerBase.cs +++ b/src/Meziantou.Analyzer/Rules/RegexUsageAnalyzerBase.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Linq; using System.Text.RegularExpressions; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/RemoveEmptyBlockAnalyzer.cs b/src/Meziantou.Analyzer/Rules/RemoveEmptyBlockAnalyzer.cs index 4ce5f33e..6a796856 100644 --- a/src/Meziantou.Analyzer/Rules/RemoveEmptyBlockAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/RemoveEmptyBlockAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Meziantou.Analyzer/Rules/RemoveUselessToStringAnalyzer.cs b/src/Meziantou.Analyzer/Rules/RemoveUselessToStringAnalyzer.cs index 1158626e..393c6c0f 100644 --- a/src/Meziantou.Analyzer/Rules/RemoveUselessToStringAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/RemoveUselessToStringAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzer.cs index da33d4c7..37e8e0fe 100644 --- a/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerCommon.cs b/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerCommon.cs index 651ad3d6..573123d9 100644 --- a/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerCommon.cs +++ b/src/Meziantou.Analyzer/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerCommon.cs @@ -1,4 +1,3 @@ -using System.Threading; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/SequenceNumberMustBeAConstantAnalyzer.cs b/src/Meziantou.Analyzer/Rules/SequenceNumberMustBeAConstantAnalyzer.cs index 15661573..c5ce1410 100644 --- a/src/Meziantou.Analyzer/Rules/SequenceNumberMustBeAConstantAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/SequenceNumberMustBeAConstantAnalyzer.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/SimplifyCallerArgumentExpressionAnalyzer.cs b/src/Meziantou.Analyzer/Rules/SimplifyCallerArgumentExpressionAnalyzer.cs index 0a0900fd..c9ca2a03 100644 --- a/src/Meziantou.Analyzer/Rules/SimplifyCallerArgumentExpressionAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/SimplifyCallerArgumentExpressionAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/ThrowIfNullWithNonNullableInstanceAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ThrowIfNullWithNonNullableInstanceAnalyzer.cs index c5c46c6e..23473091 100644 --- a/src/Meziantou.Analyzer/Rules/ThrowIfNullWithNonNullableInstanceAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ThrowIfNullWithNonNullableInstanceAnalyzer.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/TypeNameMustNotMatchNamespaceAnalyzer.cs b/src/Meziantou.Analyzer/Rules/TypeNameMustNotMatchNamespaceAnalyzer.cs index 65d66580..da2e21ca 100644 --- a/src/Meziantou.Analyzer/Rules/TypeNameMustNotMatchNamespaceAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/TypeNameMustNotMatchNamespaceAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasCancellationTokenAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasCancellationTokenAnalyzer.cs index f6604a13..a34712da 100644 --- a/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasCancellationTokenAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasCancellationTokenAnalyzer.cs @@ -1,13 +1,7 @@ -using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Linq; using System.Runtime.InteropServices; -using System.Threading; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; @@ -242,7 +236,7 @@ public void AnalyzeLoop(OperationAnalysisContext context) .Add("ParameterIndex", parameterInfo.ParameterIndex.ToString(CultureInfo.InvariantCulture)) .Add("ParameterName", parameterInfo.Name) .Add("ParameterIsEnumeratorCancellation", parameterInfo.HasEnumeratorCancellationAttribute.ToString()) - .Add("CancellationTokens", string.Join(",", cancellationTokens)); + .Add("CancellationTokens", string.Join(',', cancellationTokens)); } private List? GetMembers(ITypeSymbol symbol, int maxDepth) @@ -297,7 +291,7 @@ public void AnalyzeLoop(OperationAnalysisContext context) { foreach (var objectMember in typeMembers) { - result.Add(Prepend(member, objectMember).ToArray()); + result.Add([.. Prepend(member, objectMember)]); } } } @@ -376,9 +370,9 @@ static bool AreAllSymbolsAccessibleFromOperation(IEnumerable symbols, I static string ComputeFullPath(string? prefix, IEnumerable symbols) { if (prefix is null) - return string.Join(".", symbols.Select(symbol => symbol.Name)); + return string.Join('.', symbols.Select(symbol => symbol.Name)); - var suffix = string.Join(".", symbols.Select(symbol => symbol.Name)); + var suffix = string.Join('.', symbols.Select(symbol => symbol.Name)); if (string.IsNullOrEmpty(suffix)) return prefix; diff --git a/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasTimeProviderAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasTimeProviderAnalyzer.cs index b79caa08..db7c11ee 100644 --- a/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasTimeProviderAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseAnOverloadThatHasTimeProviderAnalyzer.cs @@ -1,18 +1,9 @@ -using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Linq; using System.Runtime.InteropServices; -using System.Threading; -using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; @@ -147,7 +138,7 @@ public void AnalyzeInvocation(OperationAnalysisContext context) return ImmutableDictionary.Create() .Add("ParameterIndex", parameterInfo.ParameterIndex.ToString(CultureInfo.InvariantCulture)) .Add("ParameterName", parameterInfo.Name) - .Add("Paths", string.Join(",", cancellationTokens)); + .Add("Paths", string.Join(',', cancellationTokens)); } private List? GetMembers(ITypeSymbol symbol, int maxDepth) @@ -199,7 +190,7 @@ public void AnalyzeInvocation(OperationAnalysisContext context) { foreach (var objectMember in typeMembers) { - result.Add(Prepend(member, objectMember).ToArray()); + result.Add([.. Prepend(member, objectMember)]); } } } @@ -270,9 +261,9 @@ static bool AreAllSymbolsAccessibleFromOperation(IEnumerable symbols, I static string ComputeFullPath(string? prefix, IEnumerable symbols) { if (prefix is null) - return string.Join(".", symbols.Select(symbol => symbol.Name)); + return string.Join('.', symbols.Select(symbol => symbol.Name)); - var suffix = string.Join(".", symbols.Select(symbol => symbol.Name)); + var suffix = string.Join('.', symbols.Select(symbol => symbol.Name)); if (string.IsNullOrEmpty(suffix)) return prefix; diff --git a/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs index 3f4390f1..54275f55 100644 --- a/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseArrayEmptyAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; diff --git a/src/Meziantou.Analyzer/Rules/UseConfigureAwaitAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseConfigureAwaitAnalyzer.cs index e78f5709..95a204bc 100644 --- a/src/Meziantou.Analyzer/Rules/UseConfigureAwaitAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseConfigureAwaitAnalyzer.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Linq; -using System.Threading; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzer.cs index 7ba4d8ac..6b8819c0 100644 --- a/src/Meziantou.Analyzer/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzer.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/UseDateTimeUnixEpochAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseDateTimeUnixEpochAnalyzer.cs index 16cf8550..59ddad12 100644 --- a/src/Meziantou.Analyzer/Rules/UseDateTimeUnixEpochAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseDateTimeUnixEpochAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/UseEqualsMethodInsteadOfOperatorAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseEqualsMethodInsteadOfOperatorAnalyzer.cs index d275ca79..8d808d8e 100644 --- a/src/Meziantou.Analyzer/Rules/UseEqualsMethodInsteadOfOperatorAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseEqualsMethodInsteadOfOperatorAnalyzer.cs @@ -1,5 +1,4 @@ using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/UseEventHandlerOfTAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseEventHandlerOfTAnalyzer.cs index 01c9c59c..1749b4d9 100644 --- a/src/Meziantou.Analyzer/Rules/UseEventHandlerOfTAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseEventHandlerOfTAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/UseIFormatProviderAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseIFormatProviderAnalyzer.cs index 5136e300..c0ca6619 100644 --- a/src/Meziantou.Analyzer/Rules/UseIFormatProviderAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseIFormatProviderAnalyzer.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Collections.Immutable; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; diff --git a/src/Meziantou.Analyzer/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzer.cs index 98869c11..05358e2c 100644 --- a/src/Meziantou.Analyzer/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzer.cs @@ -1,9 +1,7 @@ -using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Operations; -using System.Linq; -using System; using Meziantou.Analyzer.Internals; namespace Meziantou.Analyzer.Rules; diff --git a/src/Meziantou.Analyzer/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedAnalyzer.cs index 4429aad5..6b1d20c6 100644 --- a/src/Meziantou.Analyzer/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedAnalyzer.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; @@ -73,7 +73,7 @@ static bool IsValueUsed(IInvocationOperation operation) parent = parent.Parent; } - if (parent is null || parent is IBlockOperation || parent is IExpressionStatementOperation) + if (parent is null or IBlockOperation or IExpressionStatementOperation) return false; return true; diff --git a/src/Meziantou.Analyzer/Rules/UseLangwordInXmlCommentAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseLangwordInXmlCommentAnalyzer.cs index 1dc30fea..75bd486c 100644 --- a/src/Meziantou.Analyzer/Rules/UseLangwordInXmlCommentAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseLangwordInXmlCommentAnalyzer.cs @@ -1,9 +1,7 @@ -using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Syntax; -using System.Collections.Generic; using Meziantou.Analyzer.Internals; using System.Linq.Expressions; diff --git a/src/Meziantou.Analyzer/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzer.cs index ea9aad65..2055b50a 100644 --- a/src/Meziantou.Analyzer/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzer.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; @@ -27,7 +27,7 @@ public override void Initialize(AnalysisContext context) context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); context.RegisterCompilationStartAction(context => { - var isOSPlatformSymbol = DocumentationCommentId.GetFirstSymbolForDeclarationId("M:System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform)", context.Compilation) as IMethodSymbol; + var isOSPlatformSymbol = DocumentationCommentId.GetFirstSymbolForDeclarationId("M:System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform)", context.Compilation); var osPlatformSymbol = context.Compilation.GetBestTypeByMetadataName("System.Runtime.InteropServices.OSPlatform"); var operatingSystemSymbol = DocumentationCommentId.GetFirstSymbolForDeclarationId("M:System.OperatingSystem.IsWindows", context.Compilation); if (isOSPlatformSymbol is null || operatingSystemSymbol is null || !context.Compilation.IsSymbolAccessibleWithin(operatingSystemSymbol, context.Compilation.Assembly) || osPlatformSymbol is null) @@ -37,7 +37,7 @@ public override void Initialize(AnalysisContext context) }); } - private static void AnalyzeInvocation(OperationAnalysisContext context, IMethodSymbol runtimeInformationSymbol, INamedTypeSymbol osPlatformSymbol) + private static void AnalyzeInvocation(OperationAnalysisContext context, ISymbol runtimeInformationSymbol, INamedTypeSymbol osPlatformSymbol) { var operation = (IInvocationOperation)context.Operation; if (operation.Arguments.Length == 1 && SymbolEqualityComparer.Default.Equals(runtimeInformationSymbol, operation.TargetMethod)) diff --git a/src/Meziantou.Analyzer/Rules/UsePatternMatchingForEqualityComparisonsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UsePatternMatchingForEqualityComparisonsAnalyzer.cs index a79e4f4e..99457e55 100644 --- a/src/Meziantou.Analyzer/Rules/UsePatternMatchingForEqualityComparisonsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UsePatternMatchingForEqualityComparisonsAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/UsePatternMatchingInsteadOfHasValueAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UsePatternMatchingInsteadOfHasValueAnalyzer.cs index 72bc9720..5939523d 100644 --- a/src/Meziantou.Analyzer/Rules/UsePatternMatchingInsteadOfHasValueAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UsePatternMatchingInsteadOfHasValueAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs index bee638a3..2e4abd8c 100644 --- a/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseRegexSourceGeneratorAnalyzer.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Globalization; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/UseStringComparerAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseStringComparerAnalyzer.cs index 9cb952b8..c04e42f3 100644 --- a/src/Meziantou.Analyzer/Rules/UseStringComparerAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseStringComparerAnalyzer.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Meziantou.Analyzer.Configurations; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/UseStringComparisonAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseStringComparisonAnalyzer.cs index 795f6e7a..d1ccde79 100644 --- a/src/Meziantou.Analyzer/Rules/UseStringComparisonAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseStringComparisonAnalyzer.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; diff --git a/src/Meziantou.Analyzer/Rules/UseStringCreateInsteadOfFormattableStringAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseStringCreateInsteadOfFormattableStringAnalyzer.cs index 7d411030..a13020c5 100644 --- a/src/Meziantou.Analyzer/Rules/UseStringCreateInsteadOfFormattableStringAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseStringCreateInsteadOfFormattableStringAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/UseStringEqualsAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseStringEqualsAnalyzer.cs index f6ee18ee..5f37a6d2 100644 --- a/src/Meziantou.Analyzer/Rules/UseStringEqualsAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseStringEqualsAnalyzer.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; @@ -36,8 +36,7 @@ public override void Initialize(AnalysisContext context) private static void AnalyzeInvocation(OperationAnalysisContext context, OperationUtilities operationUtilities) { var operation = (IBinaryOperation)context.Operation; - if (operation.OperatorKind == BinaryOperatorKind.Equals || - operation.OperatorKind == BinaryOperatorKind.NotEquals) + if (operation.OperatorKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals) { if (operation.LeftOperand.Type.IsString() && operation.RightOperand.Type.IsString()) { diff --git a/src/Meziantou.Analyzer/Rules/UseStructLayoutAttributeAnalyzer.cs b/src/Meziantou.Analyzer/Rules/UseStructLayoutAttributeAnalyzer.cs index 67a128f1..b12de10c 100644 --- a/src/Meziantou.Analyzer/Rules/UseStructLayoutAttributeAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/UseStructLayoutAttributeAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.Linq; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Meziantou.Analyzer/Rules/ValidateArgumentsCorrectlyAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ValidateArgumentsCorrectlyAnalyzer.cs index 21b5187b..6b68e77a 100755 --- a/src/Meziantou.Analyzer/Rules/ValidateArgumentsCorrectlyAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ValidateArgumentsCorrectlyAnalyzer.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; using System.Collections.Immutable; -using System.Globalization; -using System.Linq; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -153,7 +150,7 @@ private static bool FilterDescendants(SyntaxNode node) if (operation is IMethodBodyOperation) break; - if (operation.Parent is not null && operation.Parent is IBlockOperation) + if (operation.Parent is IBlockOperation) { if (operation.Parent.Parent is IMethodBodyOperation) break; diff --git a/src/Meziantou.Analyzer/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzer.cs b/src/Meziantou.Analyzer/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzer.cs index 1c2a1ac1..359d9a27 100644 --- a/src/Meziantou.Analyzer/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzer.cs +++ b/src/Meziantou.Analyzer/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzer.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using System.IO; +using System.Collections.Immutable; using Meziantou.Analyzer.Internals; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; @@ -41,7 +40,7 @@ private static void AnalyzeOperation(OperationAnalysisContext context, INamedTyp { var invocation = (IInvocationOperation)context.Operation; var targetMethod = invocation.TargetMethod; - if (targetMethod.Name != nameof(Stream.Read) && targetMethod.Name != nameof(Stream.ReadAsync)) + if (targetMethod.Name is not nameof(Stream.Read) and not nameof(Stream.ReadAsync)) return; if (!targetMethod.ContainingType.IsOrInheritFrom(streamSymbol)) @@ -53,7 +52,7 @@ private static void AnalyzeOperation(OperationAnalysisContext context, INamedTyp parent = parent.Parent; } - if (parent is null || parent is IBlockOperation || parent is IExpressionStatementOperation) + if (parent is null or IBlockOperation or IExpressionStatementOperation) { context.ReportDiagnostic(Rule, invocation, targetMethod.Name); } diff --git a/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResult.cs b/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResult.cs index 263fc6b9..7dd20877 100755 --- a/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResult.cs +++ b/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResult.cs @@ -1,16 +1,13 @@ -using System.Collections.Generic; using Microsoft.CodeAnalysis; namespace Meziantou.Analyzer.Test.Helpers; public sealed class DiagnosticResult { - private IReadOnlyList? _locations; - public IReadOnlyList Locations { - get => _locations ??= []; - set => _locations = value; + get => field ??= []; + set; } public DiagnosticSeverity? Severity { get; set; } diff --git a/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResultLocation.cs b/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResultLocation.cs index e1b6bd66..31e30c23 100644 --- a/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResultLocation.cs +++ b/tests/Meziantou.Analyzer.Test/Helpers/DiagnosticResultLocation.cs @@ -1,4 +1,3 @@ -using System; using System.Runtime.InteropServices; namespace Meziantou.Analyzer.Test.Helpers; diff --git a/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.Validation.cs b/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.Validation.cs index 6210a9d8..ec978770 100755 --- a/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.Validation.cs +++ b/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.Validation.cs @@ -58,14 +58,14 @@ private void VerifyDiagnosticResults(IEnumerable actualResults, ILis var expectedCount = expectedResults.Count; if (DefaultAnalyzerId is not null) { - actualResults = actualResults.Where(diagnostic => diagnostic.Id == DefaultAnalyzerId).ToArray(); + actualResults = [.. actualResults.Where(diagnostic => diagnostic.Id == DefaultAnalyzerId)]; } var actualCount = actualResults.Count(); if (expectedCount != actualCount) { - var diagnosticsOutput = actualResults.Any() ? FormatDiagnostics(analyzers, actualResults.ToArray()) : " NONE."; + var diagnosticsOutput = actualResults.Any() ? FormatDiagnostics(analyzers, [.. actualResults]) : " NONE."; Assert.Fail($"Mismatch between number of diagnostics returned, expected \"{expectedCount.ToString(CultureInfo.InvariantCulture)}\" actual \"{actualCount.ToString(CultureInfo.InvariantCulture)}\"\r\n\r\nDiagnostics:\r\n{diagnosticsOutput}\r\n"); } @@ -474,7 +474,7 @@ private async Task VerifyFix(IList analyzers, CodeFixProvide { if (!codeFixProvider.FixableDiagnosticIds.Any(id => string.Equals(diagnostic.Id, id, StringComparison.Ordinal))) { - Assert.Fail($"The CodeFixProvider is not valid for the DiagnosticAnalyzer. DiagnosticId: {diagnostic.Id}, Supported diagnostics: {string.Join(",", codeFixProvider.FixableDiagnosticIds)}"); + Assert.Fail($"The CodeFixProvider is not valid for the DiagnosticAnalyzer. DiagnosticId: {diagnostic.Id}, Supported diagnostics: {string.Join(',', codeFixProvider.FixableDiagnosticIds)}"); } } diff --git a/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.cs b/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.cs index 9f9814b2..aafb16eb 100755 --- a/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.cs +++ b/tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.cs @@ -1,24 +1,15 @@ -using System; using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.IO; using System.IO.Compression; -using System.Linq; using System.Reflection; using System.Reflection.Metadata; using System.Reflection.PortableExecutable; using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; using Meziantou.Analyzer.Annotations; -using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Diagnostics; -using Xunit; namespace TestHelper; @@ -37,11 +28,11 @@ public sealed partial class ProjectBuilder public bool IsValidFixCode { get; private set; } = true; public LanguageVersion LanguageVersion { get; private set; } = LanguageVersion.Latest; public TargetFramework TargetFramework { get; private set; } = TargetFramework.NetStandard2_0; - public IList References { get; } = new List(); - public IList ApiReferences { get; } = new List(); - public IList DiagnosticAnalyzer { get; } = new List(); + public IList References { get; } = []; + public IList ApiReferences { get; } = []; + public IList DiagnosticAnalyzer { get; } = []; public CodeFixProvider? CodeFixProvider { get; private set; } - public IList ExpectedDiagnosticResults { get; } = new List(); + public IList ExpectedDiagnosticResults { get; } = []; public string? ExpectedFixedCode { get; private set; } public int? CodeFixIndex { get; private set; } public bool UseBatchFixer { get; private set; } @@ -50,13 +41,8 @@ public sealed partial class ProjectBuilder private static async Task GetNuGetReferences(string packageName, string version, params string[] paths) { - var bytes = Encoding.UTF8.GetBytes(packageName + '@' + version + ':' + string.Join(",", paths)); -#if NET8_0_OR_GREATER + var bytes = Encoding.UTF8.GetBytes(packageName + '@' + version + ':' + string.Join(',', paths)); var hash = SHA256.HashData(bytes); -#else - using var sha256 = SHA256.Create(); - var hash = sha256.ComputeHash(bytes); -#endif var key = Convert.ToBase64String(hash).Replace('/', '_'); var task = NuGetPackagesCache.GetOrAdd(key, _ => new Lazy>(Download)); return await task.Value.ConfigureAwait(false); @@ -71,13 +57,13 @@ async Task Download() var tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")); Directory.CreateDirectory(tempFolder); - using var stream = await SharedHttpClient.Instance.GetStreamAsync(new Uri($"https://www.nuget.org/api/v2/package/{packageName}/{version}")).ConfigureAwait(false); - using var zip = new ZipArchive(stream, ZipArchiveMode.Read); + await using var stream = await SharedHttpClient.Instance.GetStreamAsync(new Uri($"https://www.nuget.org/api/v2/package/{packageName}/{version}")).ConfigureAwait(false); + await using var zip = new ZipArchive(stream, ZipArchiveMode.Read); var hasEntry = false; foreach (var entry in zip.Entries.Where(file => paths.Any(path => file.FullName.StartsWith(path, StringComparison.Ordinal)))) { - entry.ExtractToFile(Path.Combine(tempFolder, entry.Name), overwrite: true); + await entry.ExtractToFileAsync(Path.Combine(tempFolder, entry.Name), overwrite: true); hasEntry = true; } diff --git a/tests/Meziantou.Analyzer.Test/Helpers/SharedHttpClient.cs b/tests/Meziantou.Analyzer.Test/Helpers/SharedHttpClient.cs index 2205fdd9..e5279915 100644 --- a/tests/Meziantou.Analyzer.Test/Helpers/SharedHttpClient.cs +++ b/tests/Meziantou.Analyzer.Test/Helpers/SharedHttpClient.cs @@ -1,8 +1,3 @@ -using System; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; - namespace Meziantou.Analyzer.Test.Helpers; internal static class SharedHttpClient { diff --git a/tests/Meziantou.Analyzer.Test/Helpers/TestAnalyzerConfigOptionsProvider.cs b/tests/Meziantou.Analyzer.Test/Helpers/TestAnalyzerConfigOptionsProvider.cs index ed39d17e..13598b4b 100644 --- a/tests/Meziantou.Analyzer.Test/Helpers/TestAnalyzerConfigOptionsProvider.cs +++ b/tests/Meziantou.Analyzer.Test/Helpers/TestAnalyzerConfigOptionsProvider.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/tests/Meziantou.Analyzer.Test/Meziantou.Analyzer.Test.csproj b/tests/Meziantou.Analyzer.Test/Meziantou.Analyzer.Test.csproj index 5499be77..61aa0cee 100644 --- a/tests/Meziantou.Analyzer.Test/Meziantou.Analyzer.Test.csproj +++ b/tests/Meziantou.Analyzer.Test/Meziantou.Analyzer.Test.csproj @@ -1,11 +1,10 @@  - + - - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Meziantou.Analyzer.Test/RuleHelpUri.cs b/tests/Meziantou.Analyzer.Test/RuleHelpUri.cs index 798fd556..58d2cbf5 100755 --- a/tests/Meziantou.Analyzer.Test/RuleHelpUri.cs +++ b/tests/Meziantou.Analyzer.Test/RuleHelpUri.cs @@ -1,7 +1,5 @@ -using System; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis.Diagnostics; -using Xunit; namespace Meziantou.Analyzer.Test; public sealed class RuleHelpUri diff --git a/tests/Meziantou.Analyzer.Test/Rules/AbstractTypesShouldNotHaveConstructorsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AbstractTypesShouldNotHaveConstructorsAnalyzerTests.cs index 7ae5ae76..13c912ac 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/AbstractTypesShouldNotHaveConstructorsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AbstractTypesShouldNotHaveConstructorsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/AddOverloadWithSpanOrMemoryAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AddOverloadWithSpanOrMemoryAnalyzerTests.cs index da5de3b8..3f5c9988 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/AddOverloadWithSpanOrMemoryAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AddOverloadWithSpanOrMemoryAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/AnonymousDelegatesShouldNotBeUsedToUnsubscribeFromEventsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AnonymousDelegatesShouldNotBeUsedToUnsubscribeFromEventsAnalyzerTests.cs index deb81ffa..34df7741 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/AnonymousDelegatesShouldNotBeUsedToUnsubscribeFromEventsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AnonymousDelegatesShouldNotBeUsedToUnsubscribeFromEventsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzerTests.cs index 2c70c8da..a8be3f61 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer_UseNameofTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer_UseNameofTests.cs index ed19c700..67c56cf0 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer_UseNameofTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ArgumentExceptionShouldSpecifyArgumentNameAnalyzer_UseNameofTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/AttributeNameShouldEndWithAttributeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AttributeNameShouldEndWithAttributeAnalyzerTests.cs index df2ba3bf..d8c24b70 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/AttributeNameShouldEndWithAttributeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AttributeNameShouldEndWithAttributeAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/AvoidComparisonWithBoolConstantAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AvoidComparisonWithBoolConstantAnalyzerTests.cs index b34629e2..1d9ef66e 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/AvoidComparisonWithBoolConstantAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AvoidComparisonWithBoolConstantAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/AvoidLockingOnPubliclyAccessibleInstanceAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AvoidLockingOnPubliclyAccessibleInstanceAnalyzerTests.cs index 295e6069..3e73ce4e 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/AvoidLockingOnPubliclyAccessibleInstanceAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AvoidLockingOnPubliclyAccessibleInstanceAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/AvoidUsingRedundantElseAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AvoidUsingRedundantElseAnalyzerTests.cs index 5d9d4f88..057e9579 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/AvoidUsingRedundantElseAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AvoidUsingRedundantElseAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/AwaitAwaitableMethodInSyncMethodAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AwaitAwaitableMethodInSyncMethodAnalyzerTests.cs index 6b2ba046..2bd34ebc 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/AwaitAwaitableMethodInSyncMethodAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AwaitAwaitableMethodInSyncMethodAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class AwaitAwaitableMethodInSyncMethodAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/AwaitTaskBeforeDisposingResourcesAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/AwaitTaskBeforeDisposingResourcesAnalyzerTests.cs index 3450721a..1f257d02 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/AwaitTaskBeforeDisposingResourcesAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/AwaitTaskBeforeDisposingResourcesAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/BothSideOfTheConditionAreIdenticalAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/BothSideOfTheConditionAreIdenticalAnalyzerTests.cs index 1e1f8c05..ceaca887 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/BothSideOfTheConditionAreIdenticalAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/BothSideOfTheConditionAreIdenticalAnalyzerTests.cs @@ -1,6 +1,5 @@ using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ClassMustBeSealedAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ClassMustBeSealedAnalyzerTests.cs index f5e9e154..bbb0f1bf 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/ClassMustBeSealedAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ClassMustBeSealedAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/CommaAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/CommaAnalyzerTests.cs index 046e34c5..a818f4ec 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/CommaAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/CommaAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0105.cs b/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0105.cs index c1d9c09c..98f9cf47 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0105.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0105.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0106.cs b/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0106.cs index b895b813..95dd3a44 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0106.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ConcurrentDictionaryMustPreventClosureWhenAccessingTheKeyAnalyzerTests_MA0106.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzerTests.cs index 578f916b..ae8d0958 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ConstructorArgumentParametersShouldExistInConstructorsAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DeclareTypesInNamespacesAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DeclareTypesInNamespacesAnalyzerTests.cs index f24253e8..ee41c292 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DeclareTypesInNamespacesAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DeclareTypesInNamespacesAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotCallVirtualMethodInConstructorAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotCallVirtualMethodInConstructorAnalyzerTests.cs index a95a5aae..99300b12 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotCallVirtualMethodInConstructorAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotCallVirtualMethodInConstructorAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0132.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0132.cs index deb34872..ee6089ad 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0132.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0132.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0133.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0133.cs index 7581f47c..a99ba464 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0133.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotCompareDateTimeWithDateTimeOffsetAnalyzerTests_MA0133.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotDeclareStaticMembersOnGenericTypesTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotDeclareStaticMembersOnGenericTypesTests.cs index fdc649b6..c4913ec8 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotDeclareStaticMembersOnGenericTypesTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotDeclareStaticMembersOnGenericTypesTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotLogClassifiedDataAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotLogClassifiedDataAnalyzerTests.cs index 0a84535a..0f085143 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotLogClassifiedDataAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotLogClassifiedDataAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class DoNotLogClassifiedDataAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotNaNInComparisonsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotNaNInComparisonsAnalyzerTests.cs index 7677dfd4..4700f13a 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotNaNInComparisonsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotNaNInComparisonsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotOverwriteRazorComponentParameterValueTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotOverwriteRazorComponentParameterValueTests.cs index 92cce507..5a69dab7 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotOverwriteRazorComponentParameterValueTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotOverwriteRazorComponentParameterValueTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class DoNotOverwriteRazorComponentParameterValueTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseApplicationExceptionAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseApplicationExceptionAnalyzerTests.cs index 7e781242..12f7e7b1 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseApplicationExceptionAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseApplicationExceptionAnalyzerTests.cs @@ -1,8 +1,6 @@ -#pragma warning disable CA1030 // Use events where appropriate -using System.Threading.Tasks; +#pragma warning disable CA1030 // Use events where appropriate using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseNotImplementedExceptionAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseNotImplementedExceptionAnalyzerTests.cs index 5d2568ef..53c4426c 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseNotImplementedExceptionAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseNotImplementedExceptionAnalyzerTests.cs @@ -1,8 +1,6 @@ -#pragma warning disable CA1030 // Use events where appropriate -using System.Threading.Tasks; +#pragma warning disable CA1030 // Use events where appropriate using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseReservedExceptionTypeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseReservedExceptionTypeAnalyzerTests.cs index dfd5d8c4..a29ad5db 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseReservedExceptionTypeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotRaiseReservedExceptionTypeAnalyzerTests.cs @@ -1,8 +1,6 @@ -#pragma warning disable CA1030 // Use events where appropriate -using System.Threading.Tasks; +#pragma warning disable CA1030 // Use events where appropriate using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotRemoveOriginalExceptionFromThrowStatementAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotRemoveOriginalExceptionFromThrowStatementAnalyzerTests.cs index 56cdf701..354b95e3 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotRemoveOriginalExceptionFromThrowStatementAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotRemoveOriginalExceptionFromThrowStatementAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinalizerAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinalizerAnalyzerTests.cs index e146bbe7..e048d14d 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinalizerAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinalizerAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinallyBlockAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinallyBlockAnalyzerTests.cs index 9aa4ec83..0d3903dd 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinallyBlockAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotThrowFromFinallyBlockAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncDelegateForSyncDelegateAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncDelegateForSyncDelegateAnalyzerTests.cs index 8d79ec49..8994cafb 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncDelegateForSyncDelegateAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncDelegateForSyncDelegateAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncVoidAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncVoidAnalyzerTests.cs index 6e569baa..3108adb5 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncVoidAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseAsyncVoidAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class DoNotUseAsyncVoidAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_AsyncContextTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_AsyncContextTests.cs index b22d7995..0bfd6fa2 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_AsyncContextTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_AsyncContextTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_NonAsyncContextTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_NonAsyncContextTests.cs index 6ded213e..b6616fd6 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_NonAsyncContextTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseBlockingCallInAsyncContextAnalyzer_NonAsyncContextTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_EqualsTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_EqualsTests.cs index b3e7c067..3c371225 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_EqualsTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_EqualsTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_HashSetTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_HashSetTests.cs index 2434024a..9c5b533d 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_HashSetTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseDefaultEqualsOnValueTypeAnalyzer_HashSetTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; @@ -137,7 +135,7 @@ await CreateProjectBuilder() [InlineData("System.Collections.Immutable.ImmutableSortedDictionary.Create()")] public async Task GetHashCode_Enum(string text) { - string sourceCode = @" + var sourceCode = @" enum Test { A, diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzerTests.cs index b99b6c7a..cb84d546 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityComparerDefaultOfStringAnalyzerTests.cs @@ -1,6 +1,5 @@ -using Meziantou.Analyzer.Rules; +using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzerTests.cs index 50a14f8b..d949f2b1 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseEqualityOperatorsForSpanOfCharAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseFinalizerAnalyzerTests.cs.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseFinalizerAnalyzerTests.cs.cs index ae836e46..9c7da5f1 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseFinalizerAnalyzerTests.cs.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseFinalizerAnalyzerTests.cs.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseImplicitCultureSensitiveToStringAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseImplicitCultureSensitiveToStringAnalyzerTests.cs index ebd461e1..ddb80038 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseImplicitCultureSensitiveToStringAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseImplicitCultureSensitiveToStringAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseServerCertificateValidationCallbackAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseServerCertificateValidationCallbackAnalyzerTests.cs index 34d6db3c..de73622b 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseServerCertificateValidationCallbackAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseServerCertificateValidationCallbackAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseStringGetHashCodeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseStringGetHashCodeAnalyzerTests.cs index 340de04e..94246d64 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseStringGetHashCodeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseStringGetHashCodeAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseToStringIfObjectAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseToStringIfObjectAnalyzerTests.cs index 44896853..2e31120f 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseToStringIfObjectAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseToStringIfObjectAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class DoNotUseToStringIfObjectAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzerTests.cs index 9497fbcf..c7f95187 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseUnknownParameterForRazorComponentAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class DoNotUseUnknownParameterForRazorComponentAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseZeroToInitializeAnEnumValueTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseZeroToInitializeAnEnumValueTests.cs index 153cad8a..f82d690a 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DoNotUseZeroToInitializeAnEnumValueTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DoNotUseZeroToInitializeAnEnumValueTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DontTagInstanceFieldsWithThreadStaticAttributeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DontTagInstanceFieldsWithThreadStaticAttributeAnalyzerTests.cs index 64b54cb3..9efe002a 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DontTagInstanceFieldsWithThreadStaticAttributeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DontTagInstanceFieldsWithThreadStaticAttributeAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DontUseDangerousThreadingMethodsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DontUseDangerousThreadingMethodsAnalyzerTests.cs index 120cb9f1..623fbb62 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DontUseDangerousThreadingMethodsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DontUseDangerousThreadingMethodsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/DotNotUseNameFromBCLAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/DotNotUseNameFromBCLAnalyzerTests.cs index 85f439fc..c21481d0 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/DotNotUseNameFromBCLAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/DotNotUseNameFromBCLAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzerTests.cs index 6a132298..117112ef 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EmbedCaughtExceptionAsInnerExceptionAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0077Tests.cs b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0077Tests.cs index eec47713..9ce592e1 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0077Tests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0077Tests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs index 7fa46ba4..6f4ae45e 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0094Tests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0097Tests.cs b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0097Tests.cs index f7a26cea..7b26c425 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0097Tests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EqualityShouldBeCorrectlyImplementedAnalyzerMA0097Tests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs index 182bdf3e..22468579 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EventArgsNameShouldEndWithEventArgsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/EventsShouldHaveProperArgumentsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/EventsShouldHaveProperArgumentsAnalyzerTests.cs index ccff4fcb..0857bd5f 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/EventsShouldHaveProperArgumentsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/EventsShouldHaveProperArgumentsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ExceptionNameShouldEndWithExceptionAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ExceptionNameShouldEndWithExceptionAnalyzerTests.cs index 6955ea2f..b762b10f 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ExceptionNameShouldEndWithExceptionAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ExceptionNameShouldEndWithExceptionAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/FileNameMustMatchTypeNameAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/FileNameMustMatchTypeNameAnalyzerTests.cs index 2a007dbf..132ac8fb 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/FileNameMustMatchTypeNameAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/FileNameMustMatchTypeNameAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/FixToDoAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/FixToDoAnalyzerTests.cs index 9c1eae61..1b757137 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/FixToDoAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/FixToDoAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/IfElseBranchesAreIdenticalAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/IfElseBranchesAreIdenticalAnalyzerTests.cs index be68da77..73f52b76 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/IfElseBranchesAreIdenticalAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/IfElseBranchesAreIdenticalAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class IfElseBranchesAreIdenticalAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/JSInteropMustNotBeUsedInOnInitializedAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/JSInteropMustNotBeUsedInOnInitializedAnalyzerTests.cs index b8d3bea5..4945a241 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/JSInteropMustNotBeUsedInOnInitializedAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/JSInteropMustNotBeUsedInOnInitializedAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class JSInteropMustNotBeUsedInOnInitializedAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/JSInvokableMethodsMustBePublicAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/JSInvokableMethodsMustBePublicAnalyzerTests.cs index af85b499..cf4573e9 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/JSInvokableMethodsMustBePublicAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/JSInvokableMethodsMustBePublicAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class JSInvokableMethodsMustBePublicAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/LocalVariablesShouldNotHideSymbolsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/LocalVariablesShouldNotHideSymbolsAnalyzerTests.cs index 5272f92f..f01082df 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/LocalVariablesShouldNotHideSymbolsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/LocalVariablesShouldNotHideSymbolsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzerTests.cs index c0377593..a30bdedc 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class LoggerParameterTypeAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzer_SerilogTests.cs b/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzer_SerilogTests.cs index 6b7d51e2..80dce8f5 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzer_SerilogTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/LoggerParameterTypeAnalyzer_SerilogTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class LoggerParameterTypeAnalyzer_SerilogTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/MakeClassStaticAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/MakeClassStaticAnalyzerTests.cs index 134755c1..45e5f990 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/MakeClassStaticAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MakeClassStaticAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/MakeInterpolatedStringAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/MakeInterpolatedStringAnalyzerTests.cs index cf5cbd5e..6ed027b3 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MakeInterpolatedStringAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MakeInterpolatedStringAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class MakeInterpolatedStringAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/MakeMemberReadOnlyAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/MakeMemberReadOnlyAnalyzerTests.cs index 2470110e..c095d31f 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MakeMemberReadOnlyAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MakeMemberReadOnlyAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Methods.cs b/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Methods.cs index 5725b0d3..d3eef532 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Methods.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Methods.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Properties.cs b/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Properties.cs index f5538726..3cddc5e6 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Properties.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MakeMethodStaticAnalyzerTests_Properties.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/MarkAttributesWithAttributeUsageAttributeTests.cs b/tests/Meziantou.Analyzer.Test/Rules/MarkAttributesWithAttributeUsageAttributeTests.cs index 4c8d577d..e1f58925 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MarkAttributesWithAttributeUsageAttributeTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MarkAttributesWithAttributeUsageAttributeTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzerTests.cs index 527e6406..d006e543 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MethodOverridesShouldNotChangeParameterDefaultsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/MethodShouldNotBeTooLongAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/MethodShouldNotBeTooLongAnalyzerTests.cs index c07b3559..f7dc9a6e 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MethodShouldNotBeTooLongAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MethodShouldNotBeTooLongAnalyzerTests.cs @@ -1,10 +1,7 @@ -using System.Linq; -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzerTests.cs index 8082d72c..6dc62d9d 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/NamedParameterAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/NamedParameterAnalyzerTests.cs index 5a2e07d4..c3b8ea65 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/NamedParameterAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/NamedParameterAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/NonConstantStaticFieldsShouldNotBeVisibleAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/NonConstantStaticFieldsShouldNotBeVisibleAnalyzerTests.cs index b2a74114..75e0f3a8 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/NonConstantStaticFieldsShouldNotBeVisibleAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/NonConstantStaticFieldsShouldNotBeVisibleAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzerTests.cs index e53791d3..f460a499 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/NonFlagsEnumsShouldNotBeMarkedWithFlagsAttributeAnalyzerTests.cs @@ -1,9 +1,5 @@ -using System; -using System.Globalization; -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/NotPatternShouldBeParenthesizedAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/NotPatternShouldBeParenthesizedAnalyzerTests.cs index bfda1059..2c95d3bf 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/NotPatternShouldBeParenthesizedAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/NotPatternShouldBeParenthesizedAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class NotPatternShouldBeParenthesizedAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/NullableAttributeUsageAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/NullableAttributeUsageAnalyzerTests.cs index e95098f9..eb7aa1cb 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/NullableAttributeUsageAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/NullableAttributeUsageAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ObjectGetTypeOnTypeInstanceAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ObjectGetTypeOnTypeInstanceAnalyzerTests.cs index 0a49c5fe..bca6eb9d 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ObjectGetTypeOnTypeInstanceAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ObjectGetTypeOnTypeInstanceAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class ObjectGetTypeOnTypeInstanceAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/ObsoleteAttributesShouldIncludeExplanationsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ObsoleteAttributesShouldIncludeExplanationsAnalyzerTests.cs index 680c7053..aa6d44b3 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ObsoleteAttributesShouldIncludeExplanationsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ObsoleteAttributesShouldIncludeExplanationsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeGuidParsingAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeGuidParsingAnalyzerTests.cs index 276825e1..f1efc2ca 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeGuidParsingAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeGuidParsingAnalyzerTests.cs @@ -1,6 +1,5 @@ -using Meziantou.Analyzer.Rules; +using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCombineLinqMethodsTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCombineLinqMethodsTests.cs index cbcea894..3f8cde80 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCombineLinqMethodsTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCombineLinqMethodsTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCountTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCountTests.cs index 640f4121..8d33f248 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCountTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerCountTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerDuplicateOrderByTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerDuplicateOrderByTests.cs index da273a76..29df870d 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerDuplicateOrderByTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerDuplicateOrderByTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerOrderTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerOrderTests.cs index 27c88ac7..5bfdd169 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerOrderTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerOrderTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCastInsteadOfSelectTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCastInsteadOfSelectTests.cs index 364d753b..d5d08253 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCastInsteadOfSelectTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCastInsteadOfSelectTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCountInsteadOfAnyTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCountInsteadOfAnyTests.cs index 31a4d2a4..794f4ffd 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCountInsteadOfAnyTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseCountInsteadOfAnyTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseDirectMethodsTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseDirectMethodsTests.cs index 947f0180..a786ba1b 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseDirectMethodsTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseDirectMethodsTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseIndexerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseIndexerTests.cs index cc0bafdc..32351a65 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseIndexerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerUseIndexerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerWhereBeforeOrderByTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerWhereBeforeOrderByTests.cs index 7f1a4d9f..e902c0d4 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerWhereBeforeOrderByTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeLinqUsageAnalyzerWhereBeforeOrderByTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeStartsWithAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeStartsWithAnalyzerTests.cs index 483d79a2..8197538d 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeStartsWithAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeStartsWithAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptimizeStringBuilderUsageAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptimizeStringBuilderUsageAnalyzerTests.cs index 3144ba2d..125172cd 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/OptimizeStringBuilderUsageAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptimizeStringBuilderUsageAnalyzerTests.cs @@ -1,9 +1,6 @@ -using System.Collections.Generic; -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0087Tests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0087Tests.cs index ef8d81d4..50fa4ebb 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0087Tests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0087Tests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0088Tests.cs b/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0088Tests.cs index 79317ad8..6283c821 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0088Tests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/OptionalParametersAttributeAnalyzerMA0088Tests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ParameterAttributeForRazorComponentAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ParameterAttributeForRazorComponentAnalyzerTests.cs index 98be9fc9..d0f0fe16 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ParameterAttributeForRazorComponentAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ParameterAttributeForRazorComponentAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class ParameterAttributeForRazorComponentAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzerTests.cs index 2f9eff6a..18e78bca 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/PreferReturningCollectionAbstractionInsteadOfImplementationAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/PreserveParamsOnOverrideAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/PreserveParamsOnOverrideAnalyzerTests.cs index 85df9fa2..7dbc35f3 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/PreserveParamsOnOverrideAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/PreserveParamsOnOverrideAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzerTests.cs index 109597ab..0bbb2895 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/PrimaryConstructorParameterShouldBeReadOnlyAnalyzerTests.cs @@ -1,8 +1,6 @@ -#if CSHARP12_OR_GREATER -using System.Threading.Tasks; +#if CSHARP12_OR_GREATER using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ProcessStartAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ProcessStartAnalyzerTests.cs index 86af3dda..2bd8279b 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ProcessStartAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ProcessStartAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyBlockAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyBlockAnalyzerTests.cs index d3ac9b81..dee74ff5 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyBlockAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyBlockAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyStatementAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyStatementAnalyzerTests.cs index e07f182c..5225dd40 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyStatementAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/RemoveEmptyStatementAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/RemoveUselessToStringAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/RemoveUselessToStringAnalyzerTests.cs index f9e5e584..9f94c064 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/RemoveUselessToStringAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/RemoveUselessToStringAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ReplaceEnumToStringWithNameofAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ReplaceEnumToStringWithNameofAnalyzerTests.cs index 89521f5f..e2a1650c 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ReplaceEnumToStringWithNameofAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ReplaceEnumToStringWithNameofAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerTests.cs index beb309f0..65829c31 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ReturnTaskFromResultInsteadOfReturningNullAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/SequenceNumberMustBeAConstantAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/SequenceNumberMustBeAConstantAnalyzerTests.cs index 2c81091a..a42e7b72 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/SequenceNumberMustBeAConstantAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/SequenceNumberMustBeAConstantAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class SequenceNumberMustBeAConstantAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/SimplifyCallerArgumentExpressionAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/SimplifyCallerArgumentExpressionAnalyzerTests.cs index 41892daf..db610887 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/SimplifyCallerArgumentExpressionAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/SimplifyCallerArgumentExpressionAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/StringShouldNotContainsNonDeterministicEndOfLineAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/StringShouldNotContainsNonDeterministicEndOfLineAnalyzerTests.cs index 9f2ae2d3..2a7edb2a 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/StringShouldNotContainsNonDeterministicEndOfLineAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/StringShouldNotContainsNonDeterministicEndOfLineAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/TaskInUsingAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/TaskInUsingAnalyzerTests.cs index 8d8abd05..ecef195e 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/TaskInUsingAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/TaskInUsingAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class TaskInUsingAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/ThrowIfNullWithNonNullableInstanceAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ThrowIfNullWithNonNullableInstanceAnalyzerTests.cs index 9c95bb25..d67c7927 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ThrowIfNullWithNonNullableInstanceAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ThrowIfNullWithNonNullableInstanceAnalyzerTests.cs @@ -1,9 +1,7 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class ThrowIfNullWithNonNullableInstanceAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/TypeCannotBeUsedInAnAttributeParameterAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/TypeCannotBeUsedInAnAttributeParameterAnalyzerTests.cs index d54f03ee..dd257e4c 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/TypeCannotBeUsedInAnAttributeParameterAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/TypeCannotBeUsedInAnAttributeParameterAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class TypeCannotBeUsedInAnAttributeParameterAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/TypeNameMustNotMatchNamespaceAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/TypeNameMustNotMatchNamespaceAnalyzerTests.cs index 30f67d33..e3c0c11c 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/TypeNameMustNotMatchNamespaceAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/TypeNameMustNotMatchNamespaceAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/TypesShouldNotExtendSystemApplicationExceptionAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/TypesShouldNotExtendSystemApplicationExceptionAnalyzerTests.cs index cfb3ac99..8c5e35c3 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/TypesShouldNotExtendSystemApplicationExceptionAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/TypesShouldNotExtendSystemApplicationExceptionAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasCancellationTokenAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasCancellationTokenAnalyzerTests.cs index 17a1d023..2045cd25 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasCancellationTokenAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasCancellationTokenAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasTimeProviderAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasTimeProviderAnalyzerTests.cs index 230853b9..5d2a1ea3 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasTimeProviderAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseAnOverloadThatHasTimeProviderAnalyzerTests.cs @@ -1,9 +1,7 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseArrayEmptyAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseArrayEmptyAnalyzerTests.cs index c913d71d..b20752ae 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseArrayEmptyAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseArrayEmptyAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseConfigureAwaitAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseConfigureAwaitAnalyzerTests.cs index f4037ca9..aa8a7196 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseConfigureAwaitAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseConfigureAwaitAnalyzerTests.cs @@ -1,9 +1,7 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzerTests.cs index e243ea97..6a54e611 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseContainsKeyInsteadOfTryGetValueAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class UseContainsKeyInsteadOfTryGetValueAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseDateTimeUnixEpochAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseDateTimeUnixEpochAnalyzerTests.cs index 0df6798a..9d0472e0 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseDateTimeUnixEpochAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseDateTimeUnixEpochAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class UseDateTimeUnixEpochAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseEqualsMethodInsteadOfOperatorAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseEqualsMethodInsteadOfOperatorAnalyzerTests.cs index 59c3356a..1e89f92e 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseEqualsMethodInsteadOfOperatorAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseEqualsMethodInsteadOfOperatorAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class UseEqualsMethodInsteadOfOperatorAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseEventArgsEmptyAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseEventArgsEmptyAnalyzerTests.cs index c31168c8..fe2eda71 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseEventArgsEmptyAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseEventArgsEmptyAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseEventHandlerOfTAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseEventHandlerOfTAnalyzerTests.cs index b28f8130..db5f742d 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseEventHandlerOfTAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseEventHandlerOfTAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseGuidEmptyAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseGuidEmptyAnalyzerTests.cs index e7c22ade..982e305f 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseGuidEmptyAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseGuidEmptyAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseIFormatProviderAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseIFormatProviderAnalyzerTests.cs index 5e335e8b..9b24b4ce 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseIFormatProviderAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseIFormatProviderAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzerTests.cs index e700596f..78b391d0 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseIsPatternInsteadOfSequenceEqualAnalyzerTests.cs @@ -1,9 +1,7 @@ -#if CSHARP11_OR_GREATER -using System.Threading.Tasks; +#if CSHARP11_OR_GREATER using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class UseIsPatternInsteadOfSequenceEqualAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedTests.cs index 99c36b04..b12d43a6 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class UseJSRuntimeInvokeVoidAsyncWhenReturnValueIsNotUsedTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseLangwordInXmlCommentAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseLangwordInXmlCommentAnalyzerTests.cs index c5ce3b1f..e9de2f75 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseLangwordInXmlCommentAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseLangwordInXmlCommentAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class UseLangwordInXmlCommentAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseLazyInitializerEnsureInitializeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseLazyInitializerEnsureInitializeAnalyzerTests.cs index 96aa4a0a..a1ea3aa7 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseLazyInitializerEnsureInitializeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseLazyInitializerEnsureInitializeAnalyzerTests.cs @@ -1,7 +1,6 @@ using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzerTests.cs index aab1e1a0..9eceda2a 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseOperatingSystemInsteadOfRuntimeInformationAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class UseOperatingSystemInsteadOfRuntimeInformationAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerHasValueTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerHasValueTests.cs index 9d7be8c9..32529d20 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerHasValueTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerHasValueTests.cs @@ -1,6 +1,5 @@ -using Meziantou.Analyzer.Rules; +using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerTests.cs index 5a8752f9..fee0fbe5 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UsePatternMatchingForEqualityComparisonsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseReadOnlyStructForRefReadOnlyParametersAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseReadOnlyStructForRefReadOnlyParametersAnalyzerTests.cs index 15a21333..82d6b715 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseReadOnlyStructForRefReadOnlyParametersAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseReadOnlyStructForRefReadOnlyParametersAnalyzerTests.cs @@ -1,8 +1,6 @@ #if ROSLYN_4_8_OR_GREATER -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseRegexOptionsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseRegexOptionsAnalyzerTests.cs index 250b6a5c..252e476b 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseRegexOptionsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseRegexOptionsAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseRegexSourceGeneratorAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseRegexSourceGeneratorAnalyzerTests.cs index c1cb4d3a..64eba68f 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseRegexSourceGeneratorAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseRegexSourceGeneratorAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseRegexTimeoutAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseRegexTimeoutAnalyzerTests.cs index eca65067..496f769f 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseRegexTimeoutAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseRegexTimeoutAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseStringComparerAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseStringComparerAnalyzerTests.cs index 45d68a36..31973b83 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseStringComparerAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseStringComparerAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerNonCultureSensitiveTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerNonCultureSensitiveTests.cs index c6d257ed..953cfb96 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerNonCultureSensitiveTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerNonCultureSensitiveTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerTests.cs index 8880928b..77f7dd7a 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseStringComparisonAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseStringCreateInsteadOfFormattableStringAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseStringCreateInsteadOfFormattableStringAnalyzerTests.cs index bf44cf3e..a6faf1a4 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseStringCreateInsteadOfFormattableStringAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseStringCreateInsteadOfFormattableStringAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsAnalyzerTests.cs index fef97b74..f6826ced 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsInsteadOfIsPatternAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsInsteadOfIsPatternAnalyzerTests.cs index 5e41a9aa..b5ff1404 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsInsteadOfIsPatternAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseStringEqualsInsteadOfIsPatternAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseStructLayoutAttributeAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseStructLayoutAttributeAnalyzerTests.cs index 4b017638..4583becd 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseStructLayoutAttributeAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseStructLayoutAttributeAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseSystemThreadingLockInsteadOfObjectAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseSystemThreadingLockInsteadOfObjectAnalyzerTests.cs index 94ed5e3c..d5836c02 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/UseSystemThreadingLockInsteadOfObjectAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseSystemThreadingLockInsteadOfObjectAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public sealed class UseSystemThreadingLockInsteadOfObjectAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/UseTaskUnwrapAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/UseTaskUnwrapAnalyzerTests.cs index 9b011525..69c48aea 100755 --- a/tests/Meziantou.Analyzer.Test/Rules/UseTaskUnwrapAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/UseTaskUnwrapAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ValidateArgumentsCorrectlyAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ValidateArgumentsCorrectlyAnalyzerTests.cs index 5c5be2c4..8c4b5cda 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ValidateArgumentsCorrectlyAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ValidateArgumentsCorrectlyAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Rules/ValidateUnsafeAccessorAttributeUsageAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ValidateUnsafeAccessorAttributeUsageAnalyzerTests.cs index ed2dff7e..ba441772 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ValidateUnsafeAccessorAttributeUsageAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ValidateUnsafeAccessorAttributeUsageAnalyzerTests.cs @@ -1,8 +1,6 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; public class ValidateUnsafeAccessorAttributeUsageAnalyzerTests diff --git a/tests/Meziantou.Analyzer.Test/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzerTests.cs b/tests/Meziantou.Analyzer.Test/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzerTests.cs index 18ebd51e..5fc04922 100644 --- a/tests/Meziantou.Analyzer.Test/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzerTests.cs +++ b/tests/Meziantou.Analyzer.Test/Rules/ValueReturnedByStreamReadShouldBeUsedAnalyzerTests.cs @@ -1,7 +1,5 @@ -using System.Threading.Tasks; using Meziantou.Analyzer.Rules; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Rules; diff --git a/tests/Meziantou.Analyzer.Test/Suppressors/CA1507SerializationPropertyNameSuppressorTests.cs b/tests/Meziantou.Analyzer.Test/Suppressors/CA1507SerializationPropertyNameSuppressorTests.cs index 8107c271..48015548 100644 --- a/tests/Meziantou.Analyzer.Test/Suppressors/CA1507SerializationPropertyNameSuppressorTests.cs +++ b/tests/Meziantou.Analyzer.Test/Suppressors/CA1507SerializationPropertyNameSuppressorTests.cs @@ -1,9 +1,7 @@ #if ROSLYN_4_10_OR_GREATER -using System.Threading.Tasks; using Meziantou.Analyzer.Suppressors; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Suppressors; public sealed class CA1507SerializationPropertyNameSuppressorTests diff --git a/tests/Meziantou.Analyzer.Test/Suppressors/CA1822DecoratedMethodSuppressorTests.cs b/tests/Meziantou.Analyzer.Test/Suppressors/CA1822DecoratedMethodSuppressorTests.cs index 366e6a7a..4b8db255 100644 --- a/tests/Meziantou.Analyzer.Test/Suppressors/CA1822DecoratedMethodSuppressorTests.cs +++ b/tests/Meziantou.Analyzer.Test/Suppressors/CA1822DecoratedMethodSuppressorTests.cs @@ -1,9 +1,7 @@ -#if ROSLYN_4_10_OR_GREATER -using System.Threading.Tasks; +#if ROSLYN_4_10_OR_GREATER using Meziantou.Analyzer.Suppressors; using Meziantou.Analyzer.Test.Helpers; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Suppressors; public sealed class CA1822DecoratedMethodSuppressorTests diff --git a/tests/Meziantou.Analyzer.Test/Suppressors/IDE0058SuppressorTests.cs b/tests/Meziantou.Analyzer.Test/Suppressors/IDE0058SuppressorTests.cs index 9764d8d2..e8d422d4 100644 --- a/tests/Meziantou.Analyzer.Test/Suppressors/IDE0058SuppressorTests.cs +++ b/tests/Meziantou.Analyzer.Test/Suppressors/IDE0058SuppressorTests.cs @@ -1,9 +1,7 @@ -#if ROSLYN_4_10_OR_GREATER -using System.Threading.Tasks; +#if ROSLYN_4_10_OR_GREATER using Meziantou.Analyzer.Suppressors; using Microsoft.CodeAnalysis; using TestHelper; -using Xunit; namespace Meziantou.Analyzer.Test.Suppressors; public sealed class IDE0058SuppressorTests