Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Ensure analyzer package is referenced by Microsoft.AspNetCore.Mvc #7943

Merged
merged 1 commit into from
Jun 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ActionsMustNotBeAsyncVoidAnalyzer : ControllerAnalyzerBase
public static readonly string ReturnTypeKey = "ReturnType";

public ActionsMustNotBeAsyncVoidAnalyzer()
: base(DiagnosticDescriptors.MVC7003_ActionsMustNotBeAsyncVoid)
: base(ExperimentalDiagnosticDescriptors.MVC7003_ActionsMustNotBeAsyncVoid)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some diamond dependency shennanigans. Renaming the type in the experimental package

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where else does DiagnosticDescriptors exist? What is it clashing with?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
public class ActionsMustNotBeAsyncVoidFixProvider : CodeFixProvider
{
public sealed override ImmutableArray<string> FixableDiagnosticIds =>
ImmutableArray.Create(DiagnosticDescriptors.MVC7003_ActionsMustNotBeAsyncVoid.Id);
ImmutableArray.Create(ExperimentalDiagnosticDescriptors.MVC7003_ActionsMustNotBeAsyncVoid.Id);

public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ApiActionsAreAttributeRoutedAnalyzer : ApiControllerAnalyzerBase
internal const string MethodNameKey = "MethodName";

public ApiActionsAreAttributeRoutedAnalyzer()
: base(DiagnosticDescriptors.MVC7000_ApiActionsMustBeAttributeRouted)
: base(ExperimentalDiagnosticDescriptors.MVC7000_ApiActionsMustBeAttributeRouted)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class ApiActionsAreAttributeRoutedFixProvider : CodeFixProvider
};

public sealed override ImmutableArray<string> FixableDiagnosticIds =>
ImmutableArray.Create(DiagnosticDescriptors.MVC7000_ApiActionsMustBeAttributeRouted.Id);
ImmutableArray.Create(ExperimentalDiagnosticDescriptors.MVC7000_ApiActionsMustBeAttributeRouted.Id);

public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
public class ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer : ApiControllerAnalyzerBase
{
public ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer()
: base(DiagnosticDescriptors.MVC7001_ApiActionsHaveBadModelStateFilter)
: base(ExperimentalDiagnosticDescriptors.MVC7001_ApiActionsHaveBadModelStateFilter)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
public class ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProvider : CodeFixProvider
{
public sealed override ImmutableArray<string> FixableDiagnosticIds =>
ImmutableArray.Create(DiagnosticDescriptors.MVC7001_ApiActionsHaveBadModelStateFilter.Id);
ImmutableArray.Create(ExperimentalDiagnosticDescriptors.MVC7001_ApiActionsHaveBadModelStateFilter.Id);

public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ApiActionsShouldUseActionResultOfTAnalyzer : ApiControllerAnalyzerB
public static readonly string ReturnTypeKey = "ReturnType";

public ApiActionsShouldUseActionResultOfTAnalyzer()
: base(DiagnosticDescriptors.MVC7002_ApiActionsShouldReturnActionResultOf)
: base(ExperimentalDiagnosticDescriptors.MVC7002_ApiActionsShouldReturnActionResultOf)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
public class ApiActionsShouldUseActionResultOfTCodeFixProvider : CodeFixProvider
{
public sealed override ImmutableArray<string> FixableDiagnosticIds =>
ImmutableArray.Create(DiagnosticDescriptors.MVC7002_ApiActionsShouldReturnActionResultOf.Id);
ImmutableArray.Create(ExperimentalDiagnosticDescriptors.MVC7002_ApiActionsShouldReturnActionResultOf.Id);

public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Microsoft.AspNetCore.Mvc.Analyzers
{
public static class DiagnosticDescriptors
public static class ExperimentalDiagnosticDescriptors
{
public static readonly DiagnosticDescriptor MVC7000_ApiActionsMustBeAttributeRouted =
new DiagnosticDescriptor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.Analyzers\Microsoft.AspNetCore.Mvc.Analyzers.csproj" PrivateAssets="None" ReferenceOutputAssembly="false" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual change

<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.Analyzers\Microsoft.AspNetCore.Mvc.Analyzers.csproj" PrivateAssets="None" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.ApiExplorer\Microsoft.AspNetCore.Mvc.ApiExplorer.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.Cors\Microsoft.AspNetCore.Mvc.Cors.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.DataAnnotations\Microsoft.AspNetCore.Mvc.DataAnnotations.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
{
public class ActionsMustNotBeAsyncVoidFacts : AnalyzerTestBase
{
private static DiagnosticDescriptor DiagnosticDescriptor = DiagnosticDescriptors.MVC7003_ActionsMustNotBeAsyncVoid;
private static DiagnosticDescriptor DiagnosticDescriptor = ExperimentalDiagnosticDescriptors.MVC7003_ActionsMustNotBeAsyncVoid;

protected override DiagnosticAnalyzer DiagnosticAnalyzer { get; }
= new ActionsMustNotBeAsyncVoidAnalyzer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
{
public class ApiActionsDoNotRequireExplicitModelValidationCheckFacts : AnalyzerTestBase
{
private static DiagnosticDescriptor DiagnosticDescriptor = DiagnosticDescriptors.MVC7001_ApiActionsHaveBadModelStateFilter;
private static DiagnosticDescriptor DiagnosticDescriptor = ExperimentalDiagnosticDescriptors.MVC7001_ApiActionsHaveBadModelStateFilter;

protected override DiagnosticAnalyzer DiagnosticAnalyzer { get; }
= new ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
{
public class ApiActionsAreAttributeRoutedFacts : AnalyzerTestBase
{
private static DiagnosticDescriptor DiagnosticDescriptor = DiagnosticDescriptors.MVC7000_ApiActionsMustBeAttributeRouted;
private static DiagnosticDescriptor DiagnosticDescriptor = ExperimentalDiagnosticDescriptors.MVC7000_ApiActionsMustBeAttributeRouted;

protected override DiagnosticAnalyzer DiagnosticAnalyzer { get; }
= new ApiActionsAreAttributeRoutedAnalyzer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
{
public class ApiActionsShouldUseActionResultOfTFacts : AnalyzerTestBase
{
private static DiagnosticDescriptor DiagnosticDescriptor = DiagnosticDescriptors.MVC7002_ApiActionsShouldReturnActionResultOf;
private static DiagnosticDescriptor DiagnosticDescriptor = ExperimentalDiagnosticDescriptors.MVC7002_ApiActionsShouldReturnActionResultOf;

protected override DiagnosticAnalyzer DiagnosticAnalyzer { get; }
= new ApiActionsShouldUseActionResultOfTAnalyzer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public void ReferenceAssemblies_ReturnsLoadableReferenceAssemblies()
// Arrange
var excludeAssemblies = new string[]
{
"Microsoft.AspNetCore.Mvc.Analyzers",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package reference is in the deps file, so this is expected.

"Microsoft.AspNetCore.Mvc.Test",
"Microsoft.AspNetCore.Mvc.Core.TestCommon",
};
Expand Down