From 360d54ea0dd2d4e67f25de70de4010aaec19972c Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Sun, 25 Aug 2019 13:27:58 -0700 Subject: [PATCH] Update to latest packages --- Directory.Build.props | 2 +- build.ps1 | 6 +- global.json | 5 -- .../CodeActions/ConvertAttributeCodeAction.cs | 2 +- .../xunit.analyzers.fixes.csproj | 7 +- .../source.extension.vsixmanifest | 23 ------ .../xunit.analyzers.vsix.csproj | 74 ------------------- .../Analysis/AssertUsageAnalyzerBase.cs | 3 +- .../Analysis/XunitDiagnosticAnalyzer.cs | 1 + ...ClassDataAttributeMustPointAtValidClass.cs | 2 +- .../InlineDataMustMatchTheoryParameters.cs | 2 +- .../InlineDataShouldBeUniqueWithinTheory.cs | 2 +- .../MemberDataShouldReferenceValidMember.cs | 4 +- .../PublicMethodShouldBeMarkedAsTest.cs | 2 +- src/xunit.analyzers/SymbolExtensions.cs | 2 +- src/xunit.analyzers/xunit.analyzers.csproj | 7 +- ...nlineDataMustMatchTheoryParametersTests.cs | 6 +- .../xunit.analyzers.tests.csproj | 16 ++-- tools/DocBuilder/DocBuilder.csproj | 5 +- xunit.analyzers.sln | 9 +-- 20 files changed, 34 insertions(+), 146 deletions(-) delete mode 100644 global.json delete mode 100644 src/xunit.analyzers.vsix/source.extension.vsixmanifest delete mode 100644 src/xunit.analyzers.vsix/xunit.analyzers.vsix.csproj diff --git a/Directory.Build.props b/Directory.Build.props index 4d13e60b..fd69be7e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 7.3 + latest diff --git a/build.ps1 b/build.ps1 index 10df77a3..eb94c854 100644 --- a/build.ps1 +++ b/build.ps1 @@ -49,7 +49,7 @@ function __target_build() { _build_step "Compiling binaries" _msbuild "xunit.analyzers.sln" $configuration - _dotnet ("tools\DocBuilder\bin\Release\netcoreapp2.0\Xunit.Analyzers.DocBuilder.dll " + (Join-Path $PSScriptRoot "docs")) # "Verifying documentation files" + _dotnet ("tools\DocBuilder\bin\Release\netcoreapp2.1\Xunit.Analyzers.DocBuilder.dll " + (Join-Path $PSScriptRoot "docs")) # "Verifying documentation files" } function __target_ci() { @@ -64,7 +64,7 @@ function __target_packagerestore() { _build_step "Restoring NuGet packages" _mkdir packages _exec ('& "' + $nugetExe + '" restore xunit.analyzers.sln -NonInteractive') - _exec ('& "' + $nugetExe + '" install xunit.runner.console -OutputDirectory "' + (Join-Path $PSScriptRoot "packages") + '" -NonInteractive -pre -ExcludeVersion') + _exec ('& "' + $nugetExe + '" install xunit.runner.console -OutputDirectory "' + (Join-Path $PSScriptRoot "packages") + '" -NonInteractive -ExcludeVersion') } function __target_packages() { @@ -130,7 +130,7 @@ function __target__signpackages() { function __target__test() { _build_step "Running unit tests" - _xunit_console ("test\xunit.analyzers.tests\bin\" + $configuration + "\net452\xunit.analyzers.tests.dll -xml artifacts\test\TestResults.xml -diagnostics") + _xunit_console ("test\xunit.analyzers.tests\bin\" + $configuration + "\net472\xunit.analyzers.tests.dll -xml artifacts\test\TestResults.xml -diagnostics") } # Dispatch diff --git a/global.json b/global.json deleted file mode 100644 index 4ac738bc..00000000 --- a/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "2.1.504" - } -} diff --git a/src/xunit.analyzers.fixes/CodeActions/ConvertAttributeCodeAction.cs b/src/xunit.analyzers.fixes/CodeActions/ConvertAttributeCodeAction.cs index a093bba7..3c99b3ec 100644 --- a/src/xunit.analyzers.fixes/CodeActions/ConvertAttributeCodeAction.cs +++ b/src/xunit.analyzers.fixes/CodeActions/ConvertAttributeCodeAction.cs @@ -40,7 +40,7 @@ protected override async Task GetChangedDocumentAsync(CancellationToke cancellationToken.ThrowIfCancellationRequested(); var currentType = semanticModel.GetTypeInfo(attribute).Type; - if (currentType == fromTypeSymbol) + if (Equals(currentType, fromTypeSymbol)) editor.SetName(attribute, toTypeName); } } diff --git a/src/xunit.analyzers.fixes/xunit.analyzers.fixes.csproj b/src/xunit.analyzers.fixes/xunit.analyzers.fixes.csproj index 0affe711..df0e71ae 100644 --- a/src/xunit.analyzers.fixes/xunit.analyzers.fixes.csproj +++ b/src/xunit.analyzers.fixes/xunit.analyzers.fixes.csproj @@ -9,15 +9,14 @@ false false false - portable-net45+win8 Xunit.Analyzers - netstandard1.1 + netstandard1.3 full - - + + diff --git a/src/xunit.analyzers.vsix/source.extension.vsixmanifest b/src/xunit.analyzers.vsix/source.extension.vsixmanifest deleted file mode 100644 index 9bd564c8..00000000 --- a/src/xunit.analyzers.vsix/source.extension.vsixmanifest +++ /dev/null @@ -1,23 +0,0 @@ - - - - - xunit.analyzers - Code Analyzers for projects using xUnit.net that help find and fix frequent issues when writing tests. - - - - - - - - - - - - - - - - - diff --git a/src/xunit.analyzers.vsix/xunit.analyzers.vsix.csproj b/src/xunit.analyzers.vsix/xunit.analyzers.vsix.csproj deleted file mode 100644 index 4b0b9f26..00000000 --- a/src/xunit.analyzers.vsix/xunit.analyzers.vsix.csproj +++ /dev/null @@ -1,74 +0,0 @@ - - - - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - Debug - AnyCPU - 2.0 - {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {381C5B6A-C37A-4B60-A7DC-8A5208AFA309} - Library - Properties - xunit.analyzers.vsix - xunit.analyzers.vsix - v4.5.2 - false - false - false - false - false - false - Roslyn - $(NoWarn);CS2008 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Program - $(DevEnvDir)devenv.exe - /rootsuffix Roslyn - - - - Designer - - - - - {F513916A-00AD-499A-9B76-E52D9FBFCED5} - xunit.analyzers - - - {F563B984-0E18-4479-A42C-DF2BA970A4C2} - xunit.analyzers.fixes - - - - - - \ No newline at end of file diff --git a/src/xunit.analyzers/Analysis/AssertUsageAnalyzerBase.cs b/src/xunit.analyzers/Analysis/AssertUsageAnalyzerBase.cs index d2d28485..1e9e2c6a 100644 --- a/src/xunit.analyzers/Analysis/AssertUsageAnalyzerBase.cs +++ b/src/xunit.analyzers/Analysis/AssertUsageAnalyzerBase.cs @@ -27,6 +27,7 @@ protected AssertUsageAnalyzerBase(IEnumerable descriptors, public sealed override void Initialize(AnalysisContext context) { + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); context.EnableConcurrentExecution(); context.RegisterCompilationStartAction(compilationContext => @@ -45,7 +46,7 @@ public sealed override void Initialize(AnalysisContext context) var methodSymbol = (IMethodSymbol)symbolInfo.Symbol; if (methodSymbol.MethodKind != MethodKind.Ordinary || - methodSymbol.ContainingType != assertType || + !Equals(methodSymbol.ContainingType, assertType) || !methodNames.Contains(methodSymbol.Name)) return; diff --git a/src/xunit.analyzers/Analysis/XunitDiagnosticAnalyzer.cs b/src/xunit.analyzers/Analysis/XunitDiagnosticAnalyzer.cs index c9129e90..df3924d0 100644 --- a/src/xunit.analyzers/Analysis/XunitDiagnosticAnalyzer.cs +++ b/src/xunit.analyzers/Analysis/XunitDiagnosticAnalyzer.cs @@ -17,6 +17,7 @@ public XunitDiagnosticAnalyzer(Version versionOverride) public override void Initialize(AnalysisContext context) { + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); context.EnableConcurrentExecution(); context.RegisterCompilationStartAction(compilationStartContext => diff --git a/src/xunit.analyzers/ClassDataAttributeMustPointAtValidClass.cs b/src/xunit.analyzers/ClassDataAttributeMustPointAtValidClass.cs index ab036072..5008ba81 100644 --- a/src/xunit.analyzers/ClassDataAttributeMustPointAtValidClass.cs +++ b/src/xunit.analyzers/ClassDataAttributeMustPointAtValidClass.cs @@ -22,7 +22,7 @@ internal override void AnalyzeCompilation(CompilationStartAnalysisContext compil { var attribute = syntaxNodeContext.Node as AttributeSyntax; var semanticModel = syntaxNodeContext.SemanticModel; - if (semanticModel.GetTypeInfo(attribute).Type != xunitContext.Core.ClassDataAttributeType) + if (!Equals(semanticModel.GetTypeInfo(attribute).Type, xunitContext.Core.ClassDataAttributeType)) return; var argumentExpression = attribute.ArgumentList?.Arguments.FirstOrDefault()?.Expression as TypeOfExpressionSyntax; diff --git a/src/xunit.analyzers/InlineDataMustMatchTheoryParameters.cs b/src/xunit.analyzers/InlineDataMustMatchTheoryParameters.cs index 104c4575..e4615638 100644 --- a/src/xunit.analyzers/InlineDataMustMatchTheoryParameters.cs +++ b/src/xunit.analyzers/InlineDataMustMatchTheoryParameters.cs @@ -101,7 +101,7 @@ internal override void AnalyzeCompilation(CompilationStartAnalysisContext compil ? arrayParam.ElementType : parameter.Type; - if (parameterType == compilation.ObjectType) + if (Equals(parameterType, compilation.ObjectType)) { // Everything is assignable to object and 'params object[]' so move on if (xunitSupportsParameterArrays && parameter.IsParams) diff --git a/src/xunit.analyzers/InlineDataShouldBeUniqueWithinTheory.cs b/src/xunit.analyzers/InlineDataShouldBeUniqueWithinTheory.cs index 66d2fe3d..a2d1f5a2 100644 --- a/src/xunit.analyzers/InlineDataShouldBeUniqueWithinTheory.cs +++ b/src/xunit.analyzers/InlineDataShouldBeUniqueWithinTheory.cs @@ -30,7 +30,7 @@ private static void AnalyzeMethod(SymbolAnalysisContext context, XunitContext xu var objectArrayType = TypeSymbolFactory.GetObjectArrayType(context.Compilation); var wellFormedInlineDataAttributes = methodAllAttributes - .Where(a => a.AttributeClass == xunitContext.Core.InlineDataAttributeType + .Where(a => Equals(a.AttributeClass, xunitContext.Core.InlineDataAttributeType) && HasAttributeDeclarationNoCompilationErrors(a, objectArrayType)); AnalyzeInlineDataAttributesWithinTheory(context, wellFormedInlineDataAttributes); diff --git a/src/xunit.analyzers/MemberDataShouldReferenceValidMember.cs b/src/xunit.analyzers/MemberDataShouldReferenceValidMember.cs index 74dcb02d..03c543f9 100644 --- a/src/xunit.analyzers/MemberDataShouldReferenceValidMember.cs +++ b/src/xunit.analyzers/MemberDataShouldReferenceValidMember.cs @@ -36,7 +36,7 @@ internal override void AnalyzeCompilation(CompilationStartAnalysisContext compil { var attribute = symbolContext.Node as AttributeSyntax; var semanticModel = symbolContext.SemanticModel; - if (semanticModel.GetTypeInfo(attribute, symbolContext.CancellationToken).Type != xunitContext.Core.MemberDataAttributeType) + if (!Equals(semanticModel.GetTypeInfo(attribute, symbolContext.CancellationToken).Type, xunitContext.Core.MemberDataAttributeType)) return; var memberNameArgument = attribute.ArgumentList.Arguments.FirstOrDefault(); @@ -83,7 +83,7 @@ internal override void AnalyzeCompilation(CompilationStartAnalysisContext compil if (supportsNameofOperator && memberNameArgument.Expression.IsKind(SyntaxKind.StringLiteralExpression)) { var builder = ImmutableDictionary.CreateBuilder(); - if (memberSymbol.ContainingType != testClassTypeSymbol) + if (!Equals(memberSymbol.ContainingType, testClassTypeSymbol)) { builder.Add("DeclaringType", memberSymbol.ContainingType.ToDisplayString()); } diff --git a/src/xunit.analyzers/PublicMethodShouldBeMarkedAsTest.cs b/src/xunit.analyzers/PublicMethodShouldBeMarkedAsTest.cs index b474306c..6afc500b 100644 --- a/src/xunit.analyzers/PublicMethodShouldBeMarkedAsTest.cs +++ b/src/xunit.analyzers/PublicMethodShouldBeMarkedAsTest.cs @@ -60,7 +60,7 @@ internal override void AnalyzeCompilation(CompilationStartAnalysisContext compil continue; if (method.DeclaredAccessibility == Accessibility.Public && - (method.ReturnsVoid || (taskType != null && method.ReturnType == taskType))) + (method.ReturnsVoid || (taskType != null && Equals(method.ReturnType, taskType)))) { var shouldIgnore = false; while (!shouldIgnore || method.IsOverride) diff --git a/src/xunit.analyzers/SymbolExtensions.cs b/src/xunit.analyzers/SymbolExtensions.cs index 274d4c2c..a191161d 100644 --- a/src/xunit.analyzers/SymbolExtensions.cs +++ b/src/xunit.analyzers/SymbolExtensions.cs @@ -13,7 +13,7 @@ internal static bool ContainsAttributeType(this ImmutableArray at internal static INamedTypeSymbol GetGenericInterfaceImplementation(this ITypeSymbol implementingType, INamedTypeSymbol openInterfaceType) { - return implementingType.AllInterfaces.FirstOrDefault(i => i.OriginalDefinition == openInterfaceType); + return implementingType.AllInterfaces.FirstOrDefault(i => Equals(i.OriginalDefinition, openInterfaceType)); } internal static ISymbol GetMember(this INamespaceOrTypeSymbol namespaceOrType, string name) diff --git a/src/xunit.analyzers/xunit.analyzers.csproj b/src/xunit.analyzers/xunit.analyzers.csproj index 5cc9bf79..9d23e53e 100644 --- a/src/xunit.analyzers/xunit.analyzers.csproj +++ b/src/xunit.analyzers/xunit.analyzers.csproj @@ -9,15 +9,14 @@ false false false - portable-net45+win8 Xunit.Analyzers - netstandard1.1 + netstandard1.3 full - - + + \ No newline at end of file diff --git a/test/xunit.analyzers.tests/InlineDataMustMatchTheoryParametersTests.cs b/test/xunit.analyzers.tests/InlineDataMustMatchTheoryParametersTests.cs index cdcc52b0..37e1696c 100644 --- a/test/xunit.analyzers.tests/InlineDataMustMatchTheoryParametersTests.cs +++ b/test/xunit.analyzers.tests/InlineDataMustMatchTheoryParametersTests.cs @@ -12,7 +12,6 @@ public abstract class InlineDataMustMatchTheoryParametersTests public class ForFactMethod : InlineDataMustMatchTheoryParametersTests { - [Fact] public async void DoesNotFindError_WhenNoDataAttributes() { @@ -974,7 +973,8 @@ public async void FindsError__ForAnalyzerLessThan_2_4_0v_FromString(string inlin { var source = CreateSource(inlineData); - var diagnostics = await CodeAnalyzerHelper.GetDiagnosticsAsync(analyzer, source); + var diagnosticAnalyzer = new InlineDataMustMatchTheoryParameters("2.3.99"); + var diagnostics = await CodeAnalyzerHelper.GetDiagnosticsAsync(diagnosticAnalyzer, source); Assert.Collection(diagnostics, d => @@ -991,7 +991,7 @@ public async void DoesNotFindError_ForAnalyzerGreaterThanEqual_2_4_0v_FromString { var source = CreateSource(inlineData); - var diagnosticAnalyzer = new InlineDataMustMatchTheoryParameters("2.5.0"); + var diagnosticAnalyzer = new InlineDataMustMatchTheoryParameters("2.4.0"); var diagnostics = await CodeAnalyzerHelper.GetDiagnosticsAsync(diagnosticAnalyzer, source); Assert.Empty(diagnostics); diff --git a/test/xunit.analyzers.tests/xunit.analyzers.tests.csproj b/test/xunit.analyzers.tests/xunit.analyzers.tests.csproj index 9e84a228..507fd0b6 100644 --- a/test/xunit.analyzers.tests/xunit.analyzers.tests.csproj +++ b/test/xunit.analyzers.tests/xunit.analyzers.tests.csproj @@ -2,15 +2,15 @@ Xunit.Analyzers - net452 + net472 - - - - - + + + + + @@ -18,10 +18,6 @@ - - - - PreserveNewest diff --git a/tools/DocBuilder/DocBuilder.csproj b/tools/DocBuilder/DocBuilder.csproj index 689a073b..34490c95 100644 --- a/tools/DocBuilder/DocBuilder.csproj +++ b/tools/DocBuilder/DocBuilder.csproj @@ -2,11 +2,10 @@ Exe - netcoreapp2.0 + netcoreapp2.1 + 2.1.0 Xunit.Analyzers.DocBuilder Xunit.Analyzers.DocBuilder - $(PackageTargetFallback);portable-net45+win8;netcore50 - 1.6.1 ..\..\src\signing.snk true diff --git a/xunit.analyzers.sln b/xunit.analyzers.sln index f540302f..04b85598 100644 --- a/xunit.analyzers.sln +++ b/xunit.analyzers.sln @@ -1,14 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29006.145 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.136 MinimumVisualStudioVersion = 15.0.26228.4 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "xunit.analyzers", "src\xunit.analyzers\xunit.analyzers.csproj", "{F513916A-00AD-499A-9B76-E52D9FBFCED5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "xunit.analyzers.tests", "test\xunit.analyzers.tests\xunit.analyzers.tests.csproj", "{31AD5C1D-71FF-4129-97BA-E42BF1120917}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xunit.analyzers.vsix", "src\xunit.analyzers.vsix\xunit.analyzers.vsix.csproj", "{381C5B6A-C37A-4B60-A7DC-8A5208AFA309}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{31701222-FE1A-4D88-92F7-06DA84184794}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig @@ -34,9 +32,6 @@ Global {31AD5C1D-71FF-4129-97BA-E42BF1120917}.Debug|Any CPU.Build.0 = Debug|Any CPU {31AD5C1D-71FF-4129-97BA-E42BF1120917}.Release|Any CPU.ActiveCfg = Release|Any CPU {31AD5C1D-71FF-4129-97BA-E42BF1120917}.Release|Any CPU.Build.0 = Release|Any CPU - {381C5B6A-C37A-4B60-A7DC-8A5208AFA309}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {381C5B6A-C37A-4B60-A7DC-8A5208AFA309}.Debug|Any CPU.Build.0 = Debug|Any CPU - {381C5B6A-C37A-4B60-A7DC-8A5208AFA309}.Release|Any CPU.ActiveCfg = Release|Any CPU {FD9C12EA-2A4B-49A8-AC8B-4AFFE1C1E9F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD9C12EA-2A4B-49A8-AC8B-4AFFE1C1E9F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD9C12EA-2A4B-49A8-AC8B-4AFFE1C1E9F4}.Release|Any CPU.ActiveCfg = Release|Any CPU