From a7a54e8a864fb28c7118fdea238f4a9e89f4b946 Mon Sep 17 00:00:00 2001 From: Oleksandr Liakhevych Date: Mon, 6 Jan 2025 15:58:10 +0200 Subject: [PATCH] Update SDK to 8.0 --- appveyor.yml | 2 +- global.json | 2 +- src/Directory.Build.props | 8 ++++---- ...voidUninstantiatedInternalClassesSuppressorTests.cs | 2 +- .../DisposableFieldsSuppressorTests.cs | 4 ++-- src/nunit.analyzers.tests/nunit.analyzers.tests.csproj | 2 +- .../ConstraintUsage/EqualConstraintUsageCodeFix.cs | 10 +++++----- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dd82465d..b8ace0fc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ image: Visual Studio 2022 environment: - CLI_CHANNEL: 6.0.1xx + CLI_CHANNEL: 8.0 install: - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk" diff --git a/global.json b/global.json index dffff818..c7e4561c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.100", + "version": "8.0.100", "rollForward" : "latestFeature", "allowPrerelease": false } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 2a57b873..ddf9e4ec 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -22,7 +22,7 @@ - + @@ -31,9 +31,9 @@ false - - - + + + diff --git a/src/nunit.analyzers.tests/DiagnosticSuppressors/AvoidUninstantiatedInternalClassesSuppressorTests.cs b/src/nunit.analyzers.tests/DiagnosticSuppressors/AvoidUninstantiatedInternalClassesSuppressorTests.cs index 8dbba997..1f44b734 100644 --- a/src/nunit.analyzers.tests/DiagnosticSuppressors/AvoidUninstantiatedInternalClassesSuppressorTests.cs +++ b/src/nunit.analyzers.tests/DiagnosticSuppressors/AvoidUninstantiatedInternalClassesSuppressorTests.cs @@ -59,7 +59,7 @@ public void OneTimeSetUp() { // Find the NetAnalyzers assembly (note version should match the one referenced) string netAnalyzersPath = Path.Combine(PathHelper.GetNuGetPackageDirectory(), - "microsoft.codeanalysis.netanalyzers/7.0.4/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll"); + "microsoft.codeanalysis.netanalyzers/8.0.0/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll"); Assembly netAnalyzerAssembly = Assembly.LoadFrom(netAnalyzersPath); Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.CSharp.Analyzers.Maintainability.CSharpAvoidUninstantiatedInternalClasses", true)!; this.analyzer = (DiagnosticAnalyzer)Activator.CreateInstance(analyzerType)!; diff --git a/src/nunit.analyzers.tests/DiagnosticSuppressors/DisposableFieldsSuppressorTests.cs b/src/nunit.analyzers.tests/DiagnosticSuppressors/DisposableFieldsSuppressorTests.cs index 6b1899f3..0466dd11 100644 --- a/src/nunit.analyzers.tests/DiagnosticSuppressors/DisposableFieldsSuppressorTests.cs +++ b/src/nunit.analyzers.tests/DiagnosticSuppressors/DisposableFieldsSuppressorTests.cs @@ -19,9 +19,9 @@ public void OneTimeSetUp() { // Find the NetAnalyzers assembly (note version should match the one referenced) string netAnalyzersPath = Path.Combine(PathHelper.GetNuGetPackageDirectory(), - "microsoft.codeanalysis.netanalyzers/7.0.4/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll"); + "microsoft.codeanalysis.netanalyzers/8.0.0/analyzers/dotnet/cs/Microsoft.CodeAnalysis.NetAnalyzers.dll"); Assembly netAnalyzerAssembly = Assembly.LoadFrom(netAnalyzersPath); - Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.CSharp.Analyzers.ApiDesignGuidelines.CSharpTypesThatOwnDisposableFieldsShouldBeDisposableAnalyzer", true)!; + Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.TypesThatOwnDisposableFieldsShouldBeDisposableAnalyzer", true)!; this.analyzer = (DiagnosticAnalyzer)Activator.CreateInstance(analyzerType)!; this.analyzer = new DefaultEnabledAnalyzer(this.analyzer); diff --git a/src/nunit.analyzers.tests/nunit.analyzers.tests.csproj b/src/nunit.analyzers.tests/nunit.analyzers.tests.csproj index 402afc2f..45b5b851 100644 --- a/src/nunit.analyzers.tests/nunit.analyzers.tests.csproj +++ b/src/nunit.analyzers.tests/nunit.analyzers.tests.csproj @@ -1,7 +1,7 @@ NUnit.Analyzers.Tests - net6.0;net462 + net8.0;net462 4 diff --git a/src/nunit.analyzers/ConstraintUsage/EqualConstraintUsageCodeFix.cs b/src/nunit.analyzers/ConstraintUsage/EqualConstraintUsageCodeFix.cs index cc059520..bd1f3da7 100644 --- a/src/nunit.analyzers/ConstraintUsage/EqualConstraintUsageCodeFix.cs +++ b/src/nunit.analyzers/ConstraintUsage/EqualConstraintUsageCodeFix.cs @@ -26,7 +26,7 @@ protected override (ExpressionSyntax? actual, ExpressionSyntax? constraintExpres } else if (expected is PatternSyntax pattern) { - constraintExpression = this.ConvertPattern( + constraintExpression = ConvertPattern( SyntaxFactory.IdentifierName(NUnitFrameworkConstants.NameOfIs), pattern); } @@ -91,7 +91,7 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G /// supported-pattern or supported-pattern, /// supported-pattern and supported-pattern. /// - private InvocationExpressionSyntax? ConvertPattern(ExpressionSyntax member, PatternSyntax pattern) + private static InvocationExpressionSyntax? ConvertPattern(ExpressionSyntax member, PatternSyntax pattern) { if (pattern is ConstantPatternSyntax constantPattern) { @@ -125,7 +125,7 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G } else if (pattern is UnaryPatternSyntax unaryPattern && unaryPattern.IsKind(SyntaxKind.NotPattern)) { - return this.ConvertPattern( + return ConvertPattern( SyntaxFactory.MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, member, @@ -143,11 +143,11 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G if (constraint is not null) { - InvocationExpressionSyntax? leftExpression = this.ConvertPattern(member, binaryPattern.Left); + InvocationExpressionSyntax? leftExpression = ConvertPattern(member, binaryPattern.Left); if (leftExpression is not null) { - return this.ConvertPattern( + return ConvertPattern( SyntaxFactory.MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, leftExpression,