Skip to content

Commit

Permalink
Revert to dotnet 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Олександр Ляхевич committed Jan 6, 2025
1 parent 64a68b9 commit 8cc9968
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
image: Visual Studio 2022

environment:
CLI_CHANNEL: 8.0
CLI_CHANNEL: 6.0.1xx

install:
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "6.0.100",
"rollForward" : "latestFeature",
"allowPrerelease": false
}
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.11.0" PrivateAssets="all" />
<PackageReference Include="CSharpIsNullAnalyzer" Version="0.1.593" PrivateAssets="all" />
</ItemGroup>
Expand All @@ -31,9 +31,9 @@
<GenerateNullableAttributes>false</GenerateNullableAttributes>
</PropertyGroup>

<!-- Get nullability information from .NET8.0 when compiling for non net8.0 targets -->
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[8.0.0]" />
<!-- Get nullability information from .NET7.0 when compiling for non net7.0 targets -->
<ItemGroup Condition="'$(TargetFramework)' != 'net7.0'">
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[7.0.0]" />
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/8.0.0/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll");
"microsoft.codeanalysis.netanalyzers/7.0.4/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)!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/8.0.0/analyzers/dotnet/cs/Microsoft.CodeAnalysis.NetAnalyzers.dll");
"microsoft.codeanalysis.netanalyzers/7.0.4/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll");
Assembly netAnalyzerAssembly = Assembly.LoadFrom(netAnalyzersPath);
Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.TypesThatOwnDisposableFieldsShouldBeDisposableAnalyzer", true)!;
Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.CSharp.Analyzers.ApiDesignGuidelines.CSharpTypesThatOwnDisposableFieldsShouldBeDisposableAnalyzer", true)!;
this.analyzer = (DiagnosticAnalyzer)Activator.CreateInstance(analyzerType)!;

this.analyzer = new DefaultEnabledAnalyzer(this.analyzer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static IEnumerable<TestCaseData> GetTestData()
SetName("CanAssignToWhenParameterIsVersionAndArgumentIsValidString");
yield return new TestCaseData("\"a.b.c.d\"", "Version", "object", Is.True).
SetName("CanAssignToWhenParameterIsVersionAndArgumentIsInValidString");
#if NET8_0_OR_GREATER
#if NET6_0_OR_GREATER
yield return new TestCaseData("\"00:03:00\"", "TimeOnly", "string", Is.True).
SetName("CanAssignToWhenParameterIsTimeSpanAndArgumentIsValidString");
yield return new TestCaseData("\"2020-05-08\"", "DateOnly", "string", Is.True).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private static IEnumerable<TestCaseData> SpecialConversions
}
}

#if NET8_0_OR_GREATER
#if NET6_0_OR_GREATER
private static IEnumerable<TestCaseData> SpecialConversions_NET8
{
get
Expand Down Expand Up @@ -768,7 +768,7 @@ public void TestWithGenericParameter<T>(T arg1) { }
}

#if NUNIT4
#if NET8_0_OR_GREATER
#if NET6_0_OR_GREATER
[Test]
public void AnalyzeWhenArgumentIsCorrectGenericTypeParameter()
{
Expand Down
2 changes: 1 addition & 1 deletion src/nunit.analyzers.tests/nunit.analyzers.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>NUnit.Analyzers.Tests</RootNamespace>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<NUnitVersion Condition="'$(NUnitVersion)'==''">4</NUnitVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override (ExpressionSyntax? actual, ExpressionSyntax? constraintExpres
}
else if (expected is PatternSyntax pattern)
{
constraintExpression = ConvertPattern(
constraintExpression = this.ConvertPattern(
SyntaxFactory.IdentifierName(NUnitFrameworkConstants.NameOfIs),
pattern);
}
Expand Down Expand Up @@ -91,7 +91,7 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G
/// supported-pattern or supported-pattern,
/// supported-pattern and supported-pattern.
/// </remarks>
private static InvocationExpressionSyntax? ConvertPattern(ExpressionSyntax member, PatternSyntax pattern)
private InvocationExpressionSyntax? ConvertPattern(ExpressionSyntax member, PatternSyntax pattern)
{
if (pattern is ConstantPatternSyntax constantPattern)
{
Expand Down Expand Up @@ -125,7 +125,7 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G
}
else if (pattern is UnaryPatternSyntax unaryPattern && unaryPattern.IsKind(SyntaxKind.NotPattern))
{
return ConvertPattern(
return this.ConvertPattern(
SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
member,
Expand All @@ -143,11 +143,11 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G

if (constraint is not null)
{
InvocationExpressionSyntax? leftExpression = ConvertPattern(member, binaryPattern.Left);
InvocationExpressionSyntax? leftExpression = this.ConvertPattern(member, binaryPattern.Left);

if (leftExpression is not null)
{
return ConvertPattern(
return this.ConvertPattern(
SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
leftExpression,
Expand Down

0 comments on commit 8cc9968

Please sign in to comment.